Answers.Body: <p>Best to make it a square-pixel stream:</p>
  
  <pre><code>... -vf crop=720:432:0:72,scale=iw*sar:ih,setsar=1 test.mpg
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-07-20T21:07:13.427Z
Answers.Text: 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?
Answers.UserDisplayName: killerbees19
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-07-21T05:32:19.760Z
Answers.Text: 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.
Answers.UserDisplayName: Gyan
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-07-20T17:54:39.463Z
Answers.LastActivityDate: 2017-07-20T17:54:39.463Z
Answers.UserDisplayName: Gyan
Body: <p>I've several old VOB's (self-recorded DVD's) with 21:9 content that is embedded in 16:9 videos…</p>
  
  <pre><code>Width                                    : 720 pixels
  Height                                   : 576 pixels
  Display aspect ratio                     : 16:9
  </code></pre>
  
  <p><a href="https://i.sstatic.net/Ngwrl.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/Ngwrl.png" alt="Sample screenshot"></a></p>
  
  <p>I want to crop the 21:9 part from it and re-encode everything.</p>
  
  <p><code>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</code></p>
  
  <p>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?</p>
  
  <pre><code>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 -&gt; #0:0 (mpeg2video (native) -&gt; mpeg2video (native))
    Stream #0:2 -&gt; #0:1 (ac3 (native) -&gt; mp2 (native))
  </code></pre>
  
Tags: <ffmpeg>
Title: ffmpeg: Crop 21:9 out of 16:9 video
UserDisplayName: killerbees19
ThreadText: # ffmpeg: Crop 21:9 out of 16:9 video
  
  (Asked by: username_0 on 2017-07-20)
  
  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](https://i.sstatic.net/Ngwrl.png)](https://i.sstatic.net/Ngwrl.png)
  
  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))
  
  ```
  
  **Tags:** ffmpeg
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2017-07-20. Score: 0
  
  Best to make it a square-pixel stream:
  
  ```
  ... -vf crop=720:432:0:72,scale=iw*sar:ih,setsar=1 test.mpg
  
  ```
  
  > **Comments:**
  > **username_0**: 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?  
  > **username_1**: 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.  
  
  ---
  
  