-1

I am trying to use ffmpeg to "flip" gopro videos. I have the "flip" part squared away using either of these options:

-vf hflip,vflip
-vf transpose=1,transpose=1

An example of the full command that I'm using looks like this:

ffmpeg -i inputfile.mp4 -movflags use_metadata_tags -vf hflip,vflip -c:a copy outputfile-rotated.mp4

The problem is the video quality is suffering. How can I rotate the videos and maintain the image and playback quality? ie. bitrate=119 Mb/s, format HEVC, etc

I'm just not sure what options to give ffmpeg.

I know I can set the rotation flag in the metadata, but that wont work for me as not all video players honor the setting. I want the video actually rotated and I understand a re-encode will be required. I've read that ffmpeg might not do HEVC/h265 and that's ok. Even if it re-encodes it as h264, I would be ok with it as long as it maintains the quality.

If anyone can help with the arguments that would retain original quality (as best as possible), it would be appreciated.

mikem
  • 439
  • 2
  • 9
  • https://superuser.com/a/578329/1482432 and specifically https://trac.ffmpeg.org/wiki/Encode/H.264 – Gantendo Aug 15 '23 at 06:41
  • I tried some of the suggestions, but they all yield much lower bitrates and video quality. Are there options to retain bitrate? – mikem Aug 15 '23 at 22:25
  • What if you add the rotation metadata like so: `ffmpeg -i input.mp4 -c copy -metadata:s:v:0 rotate=180 output.mp4` https://superuser.com/a/1792329/1482432 – Gantendo Aug 15 '23 at 22:27
  • The rotation metadata flag will retain the quality, but unfortunately not all players or video editors will honor the flag setting. I need to actually rotate the image. – mikem Aug 15 '23 at 22:30
  • There's no option other than metadata or reencoding that changes quality. Modern players will respect metadata, using some crappy ones shouldn't really be your worry. – Destroy666 Aug 16 '23 at 04:24
  • I want to re-encode it, but I want to retain bitrate and quality (as best as possible) when I do. I'm just having trouble getting the correct ffmpeg arguments to maintain bitrate and quality. – mikem Aug 16 '23 at 04:50
  • 1
    Use capped -crf by adding `-crf 1 -maxrate 119M -bufsize 119M` before `c:a copy`. – Sark Aug 18 '23 at 22:16
  • Sark - I think that was exactly what I was looking for. Thank you! – mikem Aug 24 '23 at 00:48

0 Answers0