FFmpeg conversion FROM UYVY422 TO YUV420P

2019-04-30 06:37发布

问题:

I have raw video in UYVY422 format and I want to convert it YUV420p. I'am executing that command()

ffmpeg -y -r 25.0 -f rawvideo -s 1920x1080 -pix_fmt uyvy422 -i input.avi -pix_fmt yuv420p -f avi -r 25 -s 1920x1080 output.avi 

and my output video seems to float(right side of video start to be present at left edge and it is moving from left to right)

Has anyone got any idea about what I am doing wrong? I was trying to set output video to raw format, but it didnt work...\

回答1:

ffmpeg -y -r 25.0 -f rawvideo -s 1920x1080 -pix_fmt uyvy422 -i input.avi -pix_fmt yuv420p -f avi -r 25 -s 1920x1080 output.avi

The problem here is that the source is an AVI file. It may contain raw YUV frames, but it's not a raw YUV file, it still has AVI headers etc. around it. You're telling it to parse it as a raw YUV file, which is why you're seeing the rolling frames.

I'd just remove all the options before the -i, and then it should work correctly:

ffmpeg -i input.avi -pix_fmt yuv420p -c:v rawvideo -an -s 1920x1080 -y output.avi


回答2:

With ffmpeg I think you need to tell it to do a straight copy otherwise it will try encoding the output. Try adding the '-vcodec copy' option:

ffmpeg -y -r 25.0 -f rawvideo -s 1920x1080 -pix_fmt uyvy422 -i input.avi -vcodec copy -pix_fmt yuv420p -f avi -r 25 -s 1920x1080 output.avi



回答3:

I just did a conversion from yuv420p to yuv444p. I am not 100% sure this will work in your case but it might. Worth a go:

the command line in windows:

ffmpeg.exe -y -pix_fmt yuv420p -s 1920x1080 -r 30 -i ldr_420.yuv -f rawvideo -pix_fmt yuv444p -s 1920x1080 -r 30 ldr_444.yuv

the command line in Linux: $./ffmpeg -y -pix_fmt yuv420p -s 1920x1080 -r 30 -i ldr_420.yuv -f rawvideo -pix_fmt yuv444p -s 1920x1080 -r 30 ldr_444.yuv

In your case please replace the input and output -pix_fmt to the desired formats.