我正在尝试将 mp4 流式传输到本地计算机上的 vlc 播放器,地址为 127.0.0.1:48550,但遇到此错误。
Failed to update header with correct duration.
Failed to update header with correct filesize.
我在Mac上流式传输时没有遇到此问题,但是在WindowsPC上遇到了此问题。
在我的 mac 上,我正在运行 ffmpeg 3.2.4,在 PC 上,使用 gcc 7.1.0 构建的 ffmpeg 版本 N-86755-g0780ad9
。以下是VLC媒体播放器调试日志:
core debug: adding item `udp://127.0.0.1:48550' ( udp://127.0.0.1:48550 )
core debug: processing request item: udp://127.0.0.1:48550, node: null, skip: 0
core debug: rebuilding array of current - root Playlist
core debug: rebuild done - 1 items, index 0
core debug: starting playback of the new playlist item
core debug: resyncing on udp://127.0.0.1:48550
core debug: udp://127.0.0.1:48550 is at 0
core debug: creating new input thread
core debug: Creating an input for 'udp://127.0.0.1:48550'
core debug: meta ok for (null), need to fetch art
core debug: requesting art for udp://127.0.0.1:48550
core debug: looking for meta fetcher module matching "any": 1 candidates
core debug: using timeshift granularity of 50 MiB, in path 'C:UsersOculusAppDataLocalTemp'
core debug: looking for meta fetcher module matching "any": 1 candidates
core debug: `udp://127.0.0.1:48550' gives access `udp' demux `' path `127.0.0.1:48550'
core debug: specified demux `any'
core debug: creating demux: access='udp' demux='any' location='127.0.0.1:48550' file='\127.0.0.1:48550'
core debug: looking for access_demux module matching "udp": 12 candidates
core debug: no access_demux modules matched
core debug: creating access 'udp' location='127.0.0.1:48550', path='\127.0.0.1:48550'
core debug: looking for access module matching "udp": 21 candidates
lua debug: Trying Lua scripts in C:UsersOculusAppDataRoamingvlcluametafetcher
lua debug: Trying Lua scripts in C:Program FilesVideoLANVLCluametafetcher
lua debug: Trying Lua scripts in C:UsersOculusAppDataRoamingvlcluametafetcher
lua debug: Trying Lua scripts in C:Program FilesVideoLANVLCluametafetcher
lua debug: Trying Lua playlist script C:Program FilesVideoLANVLCluametafetchertvrage.luac
lua debug: Trying Lua playlist script C:Program FilesVideoLANVLCluametafetchertvrage.luac
udp debug: opening server=127.0.0.1:48550 local=:1234
core debug: net: connecting to [127.0.0.1]:48550 from []:1234
lua debug: skipping script (unmatched scope) C:Program FilesVideoLANVLCluametafetchertvrage.luac
lua debug: skipping script (unmatched scope) C:Program FilesVideoLANVLCluametafetchertvrage.luac
core debug: no meta fetcher modules matched
core debug: searching art for udp://127.0.0.1:48550
core debug: looking for art finder module matching "any": 2 candidates
core debug: no meta fetcher modules matched
core debug: searching art for udp://127.0.0.1:48550
core debug: looking for art finder module matching "any": 2 candidates
lua debug: Trying Lua scripts in C:UsersOculusAppDataRoamingvlcluametaart
lua debug: Trying Lua scripts in C:UsersOculusAppDataRoamingvlcluametaart
lua debug: Trying Lua scripts in C:Program FilesVideoLANVLCluametaart
lua debug: Trying Lua scripts in C:Program FilesVideoLANVLCluametaart
lua debug: Trying Lua playlist script C:Program FilesVideoLANVLCluametaart 0_musicbrainz.luac
lua debug: Trying Lua playlist script C:Program FilesVideoLANVLCluametaart 0_musicbrainz.luac
lua debug: skipping script (unmatched scope) C:Program FilesVideoLANVLCluametaart 0_musicbrainz.luac
lua debug: skipping script (unmatched scope) C:Program FilesVideoLANVLCluametaart 0_musicbrainz.luac
lua debug: Trying Lua playlist script C:Program FilesVideoLANVLCluametaart 1_googleimage.luac
lua debug: Trying Lua playlist script C:Program FilesVideoLANVLCluametaart 1_googleimage.luac
lua debug: skipping script (unmatched scope) C:Program FilesVideoLANVLCluametaart 1_googleimage.luac
lua debug: skipping script (unmatched scope) C:Program FilesVideoLANVLCluametaart 1_googleimage.luac
lua debug: Trying Lua playlist script C:Program FilesVideoLANVLCluametaart 2_frenchtv.luac
lua debug: Trying Lua playlist script C:Program FilesVideoLANVLCluametaart 2_frenchtv.luac
lua debug: skipping script (unmatched scope) C:Program FilesVideoLANVLCluametaart 2_frenchtv.luac
lua debug: skipping script (unmatched scope) C:Program FilesVideoLANVLCluametaart 2_frenchtv.luac
lua debug: Trying Lua playlist script C:Program FilesVideoLANVLCluametaart 3_lastfm.luac
lua debug: Trying Lua playlist script C:Program FilesVideoLANVLCluametaart 3_lastfm.luac
lua debug: skipping script (unmatched scope) C:Program FilesVideoLANVLCluametaart 3_lastfm.luac
lua debug: skipping script (unmatched scope) C:Program FilesVideoLANVLCluametaart 3_lastfm.luac
core debug: no art finder modules matched
core debug: art not found for udp://127.0.0.1:48550
core debug: no art finder modules matched
core debug: art not found for udp://127.0.0.1:48550
core debug: using access module "udp"
core debug: Using block method for AStream*
core debug: starting pre-buffering
qt4 debug: IM: Setting an input
关于为什么会发生这种情况的想法?以及如何解决这个问题?
我在另一个线程中找到了这个问题的答案。
在 flv 文件复用结束时,FFmpeg 会使用持续时间和文件大小值更新标头(位于文件前面(。但是,当您流式传输时,ffmpeg 无法搜索到前面,因此会显示警告。
您可以通过添加标志(-flvflags no_duration_filesize(来禁用此功能,例如:
ffmpeg -re -i SampleM.flv -acodec libmp3lame -ar 44100 -b:a 128k -pix_fmt yuv420p -profile:v baseline -s 426x240 -bufsize 6000k -vb 400k -maxrate 1500k -deinterlace -vcodec libx264 -preset veryfast -g 30 -r 30 -f flv -flvflags no_duration_filesize "rtmp://live-api.facebook.com:80/rtmp/my_key"
资料来源: FFMPEG - 流式传输在几秒钟后停止
- 打开 Vlc 媒体播放器
- 按"Ctrl + N"选择"文件">选项卡,
- 从您的 PC 添加文件,
- 在组合框上选择"流">,
选择- 下一步 在目标设置上选择"RTP/MPEG 传输流">,
- 按添加写入地址 -->"127.0.0.1"端口 --> 48550
- 单击下一步如果要使用任何编解码器,则可以在转码选项页面上添加,如果不单击">下一步">
- 最后点击流