【问题标题】:ffmpeg Could not write header for output file #0ffmpeg 无法为输出文件 #0 写入头文件
【发布时间】:2015-03-11 12:50:05
【问题描述】:

线

ffmpeg -f h264 -i pipe111.fifo -c:v copy -f mp4 -

给出错误:

Input #0, h264, from 'pipe111.fifo':
Duration: N/A, bitrate: N/A
Stream #0:0: Video: h264 (Constrained Baseline), yuv420p, 480x270, 6 fps, 6 tbr, 1200k tbn, 12 tbc
[mp4 @ 0x1562130] muxer does not support non seekable output
Output #0, mp4, to 'pipe:':
Metadata:
encoder         : Lavf56.9.100
Stream #0:0: Video: h264 ([33][0][0][0] / 0x0021), yuv420p, 480x270, q=2-31, 6 fps, 1200k tbn, 1200k tbc
Stream #0:0 -> #0:0 (copy)
Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument

但是

ffmpeg -f h264 -i pipe111.fifo -c:v copy -f mp4 /some/file/in/fs.mp4

工作正常。为什么?没有错误。

【问题讨论】:

  • 请解释为什么要通过管道输出ffmpeg。由于控制台输出状态为muxer does not support non seekable output,因此请使用-f mp4 以外的其他内容。我怀疑第二个命令是否真的有效。我预计会出现错误:At least one output file must be specified.
  • @LordNeckbeard 我已经更新了问题。
  • @LordNeckbeard 应用程序捕获输出并将其管理到应用程序的其他部分。无论如何,我已经找到了这个“错误”的解释。通常,这不是错误,这是一个功能:) 这里superuser.com/questions/760056/…

标签: ffmpeg rtmp


【解决方案1】:

由于这个问题仍然很受欢迎,我想从这里写一个快速的答案https://superuser.com/questions/760056/receiving-ffmpeg-error-22-when-piping-data-to-stdout

mp4 容器需要能够在文件中查找。管道是一条流,不可能在其中寻找。尝试使用 ts 或 flv 之类的流式容器。

【讨论】:

    猜你喜欢
    • 2021-07-16
    • 1970-01-01
    • 2022-07-27
    • 2021-11-21
    • 2019-09-29
    • 2020-08-17
    • 2014-12-20
    • 2015-06-23
    • 1970-01-01
    相关资源
    最近更新 更多