1

I have an AVI file input.avi encoded in HQ which has yuv422 format according to ffprobe.

Now, if I run the following command

ffmpeg -i input.avi -c:v libx264 -crf 0 -pix_fmt yuv420p out.mp4

Will the out.mp4 be lossless compared with input.avi? or it will be 'lossless' except half of the U and V information is lost?

5
  • 1
    No. Yes. You pretty much answered your own question in the last line.
    – stib
    May 31, 2017 at 1:28
  • 1
    BTW you can encode h.264 in yuv422, but not all players will play it
    – stib
    May 31, 2017 at 1:29
  • @stib Thanks! I want to calculate the PSNR and SSIM between input.avi and an encoded mp4 file. But the yuv format is different, so I am encoding the input.avi to 'lossless' yuv420p mp4, then calculate the PSNR and SSIM.
    – shintaroid
    May 31, 2017 at 1:37
  • 1
    Just look at the SSIM score for the luma plane. U and V are not relevant in this case. Or you could downsample the AVI to 4:2:0 before passing it to the quality compare filters i.e. [1]format=yuv420p[a];[0][a]psnr..
    – Gyan
    May 31, 2017 at 4:55
  • @Mulvya Thanks! Would you please give a full command sample? I am new to ffmpeg, I am not sure how to add [1]format=yuv420p[a];[0][a]psnr.. to my command
    – shintaroid
    May 31, 2017 at 7:14

1 Answer 1

1

To directly compare the YUV422P AVI and YUV420P MP4,

ffmpeg -i input.avi -i out.mp4
   -filter_complex
      "[0]format=yuv420p,split[avi-p][avi-s];
       [1][avi-p]psnr;[1][avi-s]ssim" -f null -
1
  • It gives an average value on the terminal, how can we output a log file with values of each frame? I tried -lavfi psnr="stats_file=psnr.log" but no luck.
    – shintaroid
    Jun 1, 2017 at 2:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.