1

I am trying to encode my YUV420 Raw format file into mp4. Here is the ffmpeg command

ffmpeg -f s16le -ar 44100 -ac 1 -i "0.a" -f rawvideo -pix_fmt yuv420p -s 480x480 -r 30 -i "0.v" -vcodec libx264 -profile:v baseline -preset ultrafast -qp 0 -b:v 1024k -g 30 -acodec libfdk_aac -ar 44100 -ac 1 -b:a 64k -f mp4 -movflags faststart "1438947231095.mp4"

If i remove qp = 0; it works however the quality is very low not sure why. If i put qp = 0 it doesn't work, What is wrong?

Getting this error

Error while opening encoder for output stream #0:0 - maybe incorrect parameters
Muhammad Umar
  • 11,391
  • 21
  • 91
  • 193

1 Answers1

2

The baseline profile doesn't support lossless H.264. You must use the High 4:4:4 Predictive profile instead:

-profile:v high444

aergistal
  • 29,947
  • 5
  • 70
  • 92
  • What is the way to minimize the loss from above – Muhammad Umar Aug 07 '15 at 13:43
  • Use a low `-crf.` The ffmpeg guide lists 18 as visually lossless, but in your case you can try to go lower. – aergistal Aug 07 '15 at 13:48
  • i have tried same but the quality is still low. I am using Vitamio to record YUV it may be YUV problem that it is recording in low quality, however if i run that YUV in normal YUV player all i see is rainbow with blurry images. any help there? – Muhammad Umar Aug 07 '15 at 13:52
  • 1
    I think you should post another question, maybe add a small sample file. – aergistal Aug 07 '15 at 13:55