1

I want to create an .mp4 output. But it doesn't work...

I'm using ffmpeg. My input video is a raw video and I want to have an raw video .mp4 at the end.

My code that i use:

ffmpeg.exe -i input.y4m -c:v rawvideo -vf format=yuv420p output.y4m

Can anyone help me out? :)

Coder95
  • 131
  • 1
  • 9

1 Answers1

2

The correct syntax is: ffmpeg.exe -i input.y4m -pix_fmt yuv420p output.y4m

Test sample:

Build synthetic video y4m file in YUV444 format:

ffmpeg -f lavfi -i testsrc=rate=10:size=160x120 -t 5 -pix_fmt yuv444p input1.y4m

Convert from YUV444 to YUV420:

ffmpeg -i input1.y4m -pix_fmt yuv420p output1.y4m



You can also create AVI raw video:

ffmpeg -i input1.y4m -c:v rawvideo -pix_fmt yuv420p output1.avi

But you can't create raw mp4 video.
Following code: ffmpeg -i input1.y4m -c:v rawvideo -pix_fmt yuv420p output1.mp4 returns error message:

[mp4 @ 00000140d77eb9c0] Could not find tag for codec rawvideo in stream #0, codec not currently supported in container
Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument
Error initializing output stream 0:0 --

There is an error because mp4 container doesn't support raw video format.

Rotem
  • 30,366
  • 4
  • 32
  • 65