I'm trying to convert stream into mp4 file using ffmpeg
ffmpeg -i pipe:0 -c:v libx264 -crf 20 -an -s 800x600 -q:v 31 output.mp4
Output:
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x55e63529aec0] Could not find codec parameters for stream 0 (Video: h264 (avc1 / 0x31637661), none, 1280x720, 3001 kb/s): unspecified pixel format
Consider increasing the value for the 'analyzeduration' and 'probesize' options
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'pipe:0':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf58.45.100 Duration: 00:03:03.15, start: 0.000000, bitrate: N/A
Stream #0:0(und): Video: h264 (avc1 / 0x31637661), none, 1280x720, 3001 kb/s, SAR 1:1 DAR 16:9, 23.98 fps, 23.98 tbr, 24k tbn, 48k tbc (default)
Metadata:
handler_name : VideoHandler
Stream #0:1(eng): Audio: aac (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 128 kb/s (default)
Metadata:
handler_name : Stereo
Stream mapping:
Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
[mov,mp4,m4a,3gp,3g2,mj2 @0x55e63529aec0] stream 0, offset 0x30: partial file pipe:0: Invalid data found when processing input
Cannot determine format of input stream 0:0 after EOF Error marking filters as finished
Conversion failed!
What I've tried:
to increase analyzeduration and probesize values in the command
ffmpeg -analyzeduration 100M -probesize 100M -i pipe:0 -c:v libx264 -crf 20 -an -s 800x600 -q:v 31 output.mp4
but I still have the same error.
Update:
ffmpeg -f mp4 -i pipe:0 -c:v libx264 -f mp4 output.mp4
this command with formmating stream as mp4 actually works with smaller files. I still have issues with bigger files. I'm suspecting on dockerfile with specfic ffmpeg package
You have to tell FFmpeg what codec format (and/or settings) that your pipe data is using.
You didn't say what format your "stream" is using so here's some general tips:
-f to specify a format.-pix_fmt to specify a YUV picture format (like 4:2:0)For example if your stream to convert is in H.264 format (you won't need pix_fmt here):
ffmpeg -f h264 -i - -c:v copy -f mp4 output.mp4
or can try as (where you don't need -f for MP4 output :
ffmpeg -f h264 -i pipe:0 -c:v copy output.mp4
If your stream is raw RGB pixel data:
(maybe you're generating a video by code / bitmap data at 30 FPS with -r 30).
ffmpeg -f rawvideo -pix_fmt argb -s 800x600 -r 30 -i pipe:0 -c:v libx264 -crf 20 -an -q:v 31 output.mp4
Hope it helps. Ask anything if you get a specific error.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With