I've several old VOB's (self-recorded DVD's) with 21:9 content that is embedded in 16:9 videos…

Width                                    : 720 pixels
Height                                   : 576 pixels
Display aspect ratio                     : 16:9

Sample screenshot

I want to crop the 21:9 part from it and re-encode everything.

cat *.VOB | ffmpeg -i - -vcodec mpeg2video -q:v 0 -q:a 0 -flags +ilme+ildct -alternate_scan 1 -top 1 -vf crop=720:432:0:72 -aspect 21:9 -s 720x432 test.mpg

This works (nearly) as expected, but the video is displayed with 2.21:1 or similar strange aspect ratios in VLC or Kodi. Any ideas what's wrong with my ffmpeg arguments?

Input #0, mpeg, from 'pipe:':
  Duration: N/A, start: 0.118367, bitrate: N/A
    Stream #0:0[0x1bf]: Data: dvd_nav_packet
    Stream #0:1[0x1e0]: Video: mpeg2video (Main), yuv420p(tv, bt470bg), 720x576 [SAR 64:45 DAR 16:9], max. 9400 kb/s, 25 fps, 25 tbr, 90k tbn, 50 tbc
    Stream #0:2[0x80]: Audio: ac3, 48000 Hz, stereo, fltp, 256 kb/s
[mpeg @ 0x1d25880] VBV buffer size not set, using default size of 130KB

Output #0, mpeg, to 'test.mpg':
  Metadata:
    encoder         : Lavf56.40.101
    Stream #0:0: Video: mpeg2video, yuv420p, 720x432 [SAR 7:5 DAR 7:3], q=2-31, 200 kb/s, 25 fps, 90k tbn, 25 tbc
    Metadata:
      encoder         : Lavc56.60.100 mpeg2video
    Stream #0:1: Audio: mp2, 48000 Hz, stereo, s16, 384 kb/s
    Metadata:
      encoder         : Lavc56.60.100 mp2

Stream mapping:
  Stream #0:1 -> #0:0 (mpeg2video (native) -> mpeg2video (native))
  Stream #0:2 -> #0:1 (ac3 (native) -> mp2 (native))

Best to make it a square-pixel stream:

... -vf crop=720:432:0:72,scale=iw*sar:ih,setsar=1 test.mpg
  • That works, but sadly the video now looks worse when upscaling from 720 to 1024 pixel. That's the reason why I want the unmodified frame size of 720×432. And other ideas? – killerbees19 Jul 20 '17 at 21:07
  • Are you scaling the output created using the filters above? You shouldn't be. On digital players, players have to scale videos when they encounter a non-unit aspect ratio. Usually, they'll use a bilinear algorithm. ffmpeg's scaler uses bicubic (by default) so it's strange that this looks worse. Although your ffmpeg readout doesn't show it, your source may be interlaced, in which case, for scale, use scale=iw*sar:ih:interl=1. If you want to skip the scale, then drop setsar as well, and insert setdar=21/9 after the crop. – Gyan Jul 21 '17 at 5:32

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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