【问题标题】:FFMPEG streaming error: Failed to update header with correct filesize and durationFFMPEG 流错误:无法使用正确的文件大小和持续时间更新标头
【发布时间】:2017-12-26 12:24:34
【问题描述】:

我正在尝试将 mp4 流式传输到本地计算机上 IP 地址为 127.0.0.1:48550 的 vlc 播放器,但遇到此错误。

Failed to update header with correct duration.
Failed to update header with correct filesize.

我在 Mac 上进行流式传输时没有遇到此问题,但在使用 Windows pc 时遇到了这个问题。

在我的 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:\Users\Oculus\AppData\Local\Temp'
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:\Users\Oculus\AppData\Roaming\vlc\lua\meta\fetcher
lua debug: Trying Lua scripts in C:\Program Files\VideoLAN\VLC\lua\meta\fetcher
lua debug: Trying Lua scripts in C:\Users\Oculus\AppData\Roaming\vlc\lua\meta\fetcher
lua debug: Trying Lua scripts in C:\Program Files\VideoLAN\VLC\lua\meta\fetcher
lua debug: Trying Lua playlist script C:\Program Files\VideoLAN\VLC\lua\meta\fetcher\tvrage.luac
lua debug: Trying Lua playlist script C:\Program Files\VideoLAN\VLC\lua\meta\fetcher\tvrage.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 Files\VideoLAN\VLC\lua\meta\fetcher\tvrage.luac
lua debug: skipping script (unmatched scope) C:\Program Files\VideoLAN\VLC\lua\meta\fetcher\tvrage.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:\Users\Oculus\AppData\Roaming\vlc\lua\meta\art
lua debug: Trying Lua scripts in C:\Users\Oculus\AppData\Roaming\vlc\lua\meta\art
lua debug: Trying Lua scripts in C:\Program Files\VideoLAN\VLC\lua\meta\art
lua debug: Trying Lua scripts in C:\Program Files\VideoLAN\VLC\lua\meta\art
lua debug: Trying Lua playlist script C:\Program Files\VideoLAN\VLC\lua\meta\art\00_musicbrainz.luac
lua debug: Trying Lua playlist script C:\Program Files\VideoLAN\VLC\lua\meta\art\00_musicbrainz.luac
lua debug: skipping script (unmatched scope) C:\Program Files\VideoLAN\VLC\lua\meta\art\00_musicbrainz.luac
lua debug: skipping script (unmatched scope) C:\Program Files\VideoLAN\VLC\lua\meta\art\00_musicbrainz.luac
lua debug: Trying Lua playlist script C:\Program Files\VideoLAN\VLC\lua\meta\art\01_googleimage.luac
lua debug: Trying Lua playlist script C:\Program Files\VideoLAN\VLC\lua\meta\art\01_googleimage.luac
lua debug: skipping script (unmatched scope) C:\Program Files\VideoLAN\VLC\lua\meta\art\01_googleimage.luac
lua debug: skipping script (unmatched scope) C:\Program Files\VideoLAN\VLC\lua\meta\art\01_googleimage.luac
lua debug: Trying Lua playlist script C:\Program Files\VideoLAN\VLC\lua\meta\art\02_frenchtv.luac
lua debug: Trying Lua playlist script C:\Program Files\VideoLAN\VLC\lua\meta\art\02_frenchtv.luac
lua debug: skipping script (unmatched scope) C:\Program Files\VideoLAN\VLC\lua\meta\art\02_frenchtv.luac
lua debug: skipping script (unmatched scope) C:\Program Files\VideoLAN\VLC\lua\meta\art\02_frenchtv.luac
lua debug: Trying Lua playlist script C:\Program Files\VideoLAN\VLC\lua\meta\art\03_lastfm.luac
lua debug: Trying Lua playlist script C:\Program Files\VideoLAN\VLC\lua\meta\art\03_lastfm.luac
lua debug: skipping script (unmatched scope) C:\Program Files\VideoLAN\VLC\lua\meta\art\03_lastfm.luac
lua debug: skipping script (unmatched scope) C:\Program Files\VideoLAN\VLC\lua\meta\art\03_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

思考为什么会发生这种情况?以及如何解决这个问题?

【问题讨论】:

  • 请分享调试日志。 (Vlc 媒体播放器 --> 工具 --> 消息,选择 Debug(2) 回车。然后再次启动您的流打开工具,消息共享结果。
  • 在问题中添加了 VLC 日志,感谢@SalihKaragöz!
  • 你的设置有误。

标签: ffmpeg streaming vlc


【解决方案1】:

我在另一个帖子中找到了这个问题的答案。

在混合 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- Streaming Stops after few seconds

【讨论】:

    【解决方案2】:
    1. 打开 Vlc 媒体播放器
    2. “Ctrl + N”选择“文件”选项卡,
    3. 从您的 PC 添加文件,
    4. 在 Combobox 上选择 “Stream”
    5. 选择下一步 在目标设置中选择“RTP/MPEG 传输流”
    6. 按添加写入地址-->“127.0.0.1”端口-->48550
    7. 点击下一步如果您想要任何编解码器,您可以在转码选项页面上添加,如果不点击“下一步
    8. 最后点击串流

    【讨论】:

    • 对,但是我想通过命令提示符运行 ffmpeg 来完成上述所有操作。有关我用来通过 ffmpeg 将视频流式传输到 vlc 播放器的命令行说明,请参阅 [https://stackoverflow.com/questions/45141199/…。 VLC 将简单地充当“接收”流的播放器。在这种情况下我的 VLC 设置是否错误?目前我正在 VLC 中打开一个网络流来播放文件。 @SalihKaragoz
    • 我理解“你想用 VLC 媒体播放器制作流媒体”。在这种情况下,“打开或获取流”的设置为 true。 @BrindhaKanniah
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2016-12-08
    • 2020-05-18
    • 1970-01-01
    • 2012-12-31
    • 2021-11-23
    • 1970-01-01
    • 2020-10-02
    相关资源
    最近更新 更多