Ffmpeg Failed to write header for output file # 0

Line

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

gives an error:

 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 

But

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

works correctly. What for? NO ERROR.

+5
source share
1 answer

In this regard, the question is still popular, I want to write a quick answer from here https://superuser.com/questions/760056/receiving-ffmpeg-error-22-when-piping-data-to-stdout

The mp4 container requires the ability to search inside a file. A pipe is a stream, and it is impossible to search inside. Try using a streaming container like ts or flv.

0
source

Source: https://habr.com/ru/post/1210991/


All Articles