videoffmpeg

Remove flicker, crop and upscale in ffmpeg


I spent one full day on ffmpeg line commands by searching a lot on google but could not achieve what I wanted to and therefore I came here to seek some advice. I have a video testinput.mpg which I believe is a mpeg-2 video. It is of 720x576 dimensions having 25 fps and a total bitrate of 4224 kbps

First problem is that the exported footage is flickering which I wasn't able to remove using ffmpeg with lots of commands I tried like adjusting brightness, contrast, hue, saturation and all.

Second problem was to extract the center portion which I was able to do it with the crop feature using following command.

ffmpeg -i testinput.mpg -filter:v "crop=468:374" testoutput.mpg

But after cropping I observed that that bitrate fell from 4224 kbps to 761 kbps and I assume this has reduced the quality of video.

What I want to achieve is:

  1. Crop the video properly keeping the same quality (acodec copy vcodec copy) -> ffmpeg did not allow me to do both the things together (cropping and having same codec)
  2. Remove the flicker from video and upscale it to 4K or HD quality so that it looks nice on big televison (preferably 4K)

I request some help on how to achieve the desired result. Can someone shed some light on it?

Here are 10 seconds sample videos on google drive that I am working on

testinput.mpg

testoutput.mpg

Thanks


Solution

  • Try de-interlacing with the yadif filter. Command for uploading to YouTube:

    ffmpeg -i input.mpg -filter:v "yadif,crop=468:374" -c:v libx265 -crf 23 -c:a copy output.mkv