Answers.Body: <p>The scale filter resets the sample aspect ratio to match the original display aspect ratio. You should add <code>setsar=1</code> after each scale. In any case, videos don't contain pixel count with fractional components, and FFmpeg won't output those.</p>
  
  <p>I'm not sure about DASH but I suppose the validator expects each variant to have the same exact aspect ratio. In your command list, I can see <code>640x290</code> and <code>1280x582</code>, which are not the same aspect. If DASH needs all to be same, the latter should be <code>1280x580</code></p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-07-06T05:20:25.370Z
Answers.LastActivityDate: 2016-07-06T05:20:25.370Z
Answers.UserDisplayName: Gyan
Body: <p>I've created a bunch of variants and a <a href="http://dash.asperademo.com/aspera/media/Sintel/Manifest.mpd" rel="nofollow">DASH manifest</a> for Sintel, which more or less works, but does not pass <a href="http://dashif.org/conformance.html" rel="nofollow">validation</a>. The issue is when I want to scale a video to a specific width, but the height that maintains the aspect ratio is not a whole number - or vice versa. For example, I've tried 640:-1, 640: -2, and 640:290 as the value of "-vf scale=", but either ffmpeg rejects it, or validation fails. How can I transcode to these resolutions?</p>
  
  <p>Error log from conformance site:</p>
  
  <pre><code>### error: moov-1:trak-1:tkhd-1 
  ### Width in TrackHeaderBox is not matching with out of box width information 
  WARNING: Sample description width 2560 not the same as track width 2558.532104
  Warning: Unknown atom found "pasp": video sample descriptions would not normally contain this
  WARNING: unknown mvex atom 'trep'
  WARNING: unknown/unexpected atom 'meta'
  </code></pre>
  
  <p>My ffmpeg and MP4Box commands (OSX):</p>
  
  <pre><code>OUTDIR="sintel-transcoded"
  #VIDOPTS24="-an -c:v libx264 -r 24 -tune animation -force_key_frames expr:gte(t,n_forced*3)"
  VIDOPTS24="-an -c:v libx264 -tune animation -x264opts keyint=72:min-keyint=72:no-scenecut -vsync passthrough"
  
  mkdir -p $OUTDIR
  
  ffmpeg -i $SOURCEDIR/sintel_4k.mov \
  $VIDOPTS24 -vf scale=320:146 -profile:v baseline -level 3.0 -crf 31 -maxrate 170k -bufsize 170k $OUTDIR/sintel_320.mp4 \
  $VIDOPTS24 -vf scale=480:-2 -profile:v baseline -level 3.0 -crf 30 -maxrate 330k -bufsize 330k $OUTDIR/sintel_480.mp4 \
  $VIDOPTS24 -vf scale=640:290 -profile:v baseline -level 3.1 -crf 30 -maxrate 500k -bufsize 500k $OUTDIR/sintel_640.mp4 \
  $VIDOPTS24 -vf scale=640:290 -profile:v baseline -level 3.1 -crf 25 -maxrate 1000k -bufsize 1000k $OUTDIR/sintel_640_hq.mp4 \
  $VIDOPTS24 -vf scale=960:-2 -profile:v main -level 3.1 -crf 19 -maxrate 2800k -bufsize 2800k $OUTDIR/sintel_960.mp4 \
  $VIDOPTS24 -vf scale=1280:582 -profile:v main -level 3.1 -crf 19 -maxrate 4000k -bufsize 4000k $OUTDIR/sintel_1280.mp4 \
  $VIDOPTS24 -vf scale=1920:-2 -profile:v high -level 4.0 -crf 20 -maxrate 6800k -bufsize 6800k $OUTDIR/sintel_1920.mp4 \
  $VIDOPTS24 -vf scale=2560:1162 -profile:v high -level 5.0 -crf 19 -maxrate 12000k -bufsize 12000k $OUTDIR/sintel_2560.mp4 \
  $VIDOPTS24 -profile:v high -level 5.1 -crf 20 -maxrate 20000k -bufsize 20000k $OUTDIR/sintel_3840.mp4 \
  -vn -c:a aac -b:a 64k $OUTDIR/sintel_audio_64k.mp4 \
  -vn -c:a aac -b:a 96k $OUTDIR/sintel_audio_96k.mp4 \
  -vn -c:a aac -b:a 128k $OUTDIR/sintel_audio_128k.mp4
  
  cd $OUTDIR
  
  MP4Box -dash-strict 3000 -rap -frag-rap -profile dashavc264:live -bs-switching no -out Manifest.mpd \
  sintel_3840.mp4:bandwidth=20000000 \
  sintel_2560.mp4:bandwidth=12000000 \
  sintel_1920.mp4:bandwidth=6800000 \
  sintel_1280.mp4:bandwidth=4000000 \
  sintel_960.mp4:bandwidth=2800000 \
  sintel_640_hq.mp4:bandwidth=1000000 \
  sintel_640.mp4:bandwidth=500000 \
  sintel_480.mp4:bandwidth=330000 \
  sintel_320.mp4:bandwidth=170000 \
  sintel_audio_128k.mp4 \
  sintel_audio_96k.mp4 \
  sintel_audio_64k.mp4
  
  mkdir dist
  mv *dash* Manifest.mpd dist
  </code></pre>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2018-01-27T20:09:01.670Z
Comments.Text: Using "-vf scale=1920:-1" (auto 'y') or "-vf scale=1920:-8" (evenly divisible by 8) ought to work. Are you using the newest ffmpeg?  -- There are online Stream Validators like: https://viblast.com/stream-validator/ . Try a different resizer within ffmpeg.
Comments.UserDisplayName: Rob
Tags: <ffmpeg><encoding><mp4><transcoding><mpeg>
Title: How to create MPEG-DASH variants at resolutions where one dimension is not a whole number in pixels?
UserDisplayName: Peter Tseng
ThreadText: # How to create MPEG-DASH variants at resolutions where one dimension is not a whole number in pixels?
  
  (Asked by: username_0 on 2016-07-06)
  
  I've created a bunch of variants and a [DASH manifest](http://dash.asperademo.com/aspera/media/Sintel/Manifest.mpd) for Sintel, which more or less works, but does not pass [validation](http://dashif.org/conformance.html). The issue is when I want to scale a video to a specific width, but the height that maintains the aspect ratio is not a whole number - or vice versa. For example, I've tried 640:-1, 640: -2, and 640:290 as the value of "-vf scale=", but either ffmpeg rejects it, or validation fails. How can I transcode to these resolutions?
  
  Error log from conformance site:
  
  ```
  ### error: moov-1:trak-1:tkhd-1 
  ### Width in TrackHeaderBox is not matching with out of box width information 
  WARNING: Sample description width 2560 not the same as track width 2558.532104
  Warning: Unknown atom found "pasp": video sample descriptions would not normally contain this
  WARNING: unknown mvex atom 'trep'
  WARNING: unknown/unexpected atom 'meta'
  
  ```
  
  My ffmpeg and MP4Box commands (OSX):
  
  ```
  OUTDIR="sintel-transcoded"
  #VIDOPTS24="-an -c:v libx264 -r 24 -tune animation -force_key_frames expr:gte(t,n_forced*3)"
  VIDOPTS24="-an -c:v libx264 -tune animation -x264opts keyint=72:min-keyint=72:no-scenecut -vsync passthrough"
  
  mkdir -p $OUTDIR
  
  ffmpeg -i $SOURCEDIR/sintel_4k.mov \
  $VIDOPTS24 -vf scale=320:146 -profile:v baseline -level 3.0 -crf 31 -maxrate 170k -bufsize 170k $OUTDIR/sintel_320.mp4 \
  $VIDOPTS24 -vf scale=480:-2 -profile:v baseline -level 3.0 -crf 30 -maxrate 330k -bufsize 330k $OUTDIR/sintel_480.mp4 \
  $VIDOPTS24 -vf scale=640:290 -profile:v baseline -level 3.1 -crf 30 -maxrate 500k -bufsize 500k $OUTDIR/sintel_640.mp4 \
  $VIDOPTS24 -vf scale=640:290 -profile:v baseline -level 3.1 -crf 25 -maxrate 1000k -bufsize 1000k $OUTDIR/sintel_640_hq.mp4 \
  $VIDOPTS24 -vf scale=960:-2 -profile:v main -level 3.1 -crf 19 -maxrate 2800k -bufsize 2800k $OUTDIR/sintel_960.mp4 \
  $VIDOPTS24 -vf scale=1280:582 -profile:v main -level 3.1 -crf 19 -maxrate 4000k -bufsize 4000k $OUTDIR/sintel_1280.mp4 \
  $VIDOPTS24 -vf scale=1920:-2 -profile:v high -level 4.0 -crf 20 -maxrate 6800k -bufsize 6800k $OUTDIR/sintel_1920.mp4 \
  $VIDOPTS24 -vf scale=2560:1162 -profile:v high -level 5.0 -crf 19 -maxrate 12000k -bufsize 12000k $OUTDIR/sintel_2560.mp4 \
  $VIDOPTS24 -profile:v high -level 5.1 -crf 20 -maxrate 20000k -bufsize 20000k $OUTDIR/sintel_3840.mp4 \
  -vn -c:a aac -b:a 64k $OUTDIR/sintel_audio_64k.mp4 \
  -vn -c:a aac -b:a 96k $OUTDIR/sintel_audio_96k.mp4 \
  -vn -c:a aac -b:a 128k $OUTDIR/sintel_audio_128k.mp4
  
  cd $OUTDIR
  
  MP4Box -dash-strict 3000 -rap -frag-rap -profile dashavc264:live -bs-switching no -out Manifest.mpd \
  sintel_3840.mp4:bandwidth=20000000 \
  sintel_2560.mp4:bandwidth=12000000 \
  sintel_1920.mp4:bandwidth=6800000 \
  sintel_1280.mp4:bandwidth=4000000 \
  sintel_960.mp4:bandwidth=2800000 \
  sintel_640_hq.mp4:bandwidth=1000000 \
  sintel_640.mp4:bandwidth=500000 \
  sintel_480.mp4:bandwidth=330000 \
  sintel_320.mp4:bandwidth=170000 \
  sintel_audio_128k.mp4 \
  sintel_audio_96k.mp4 \
  sintel_audio_64k.mp4
  
  mkdir dist
  mv *dash* Manifest.mpd dist
  
  ```
  
  **Tags:** ffmpeg, encoding, mp4, transcoding, mpeg
  
  > **Comments:**
  > **username_1**: Using "-vf scale=1920:-1" (auto 'y') or "-vf scale=1920:-8" (evenly divisible by 8) ought to work. Are you using the newest ffmpeg?  -- There are online Stream Validators like: https://viblast.com/stream-validator/ . Try a different resizer within ffmpeg.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_2 on 2016-07-06. Score: 1
  
  The scale filter resets the sample aspect ratio to match the original display aspect ratio. You should add `setsar=1` after each scale. In any case, videos don't contain pixel count with fractional components, and FFmpeg won't output those.
  
  I'm not sure about DASH but I suppose the validator expects each variant to have the same exact aspect ratio. In your command list, I can see `640x290` and `1280x582`, which are not the same aspect. If DASH needs all to be same, the latter should be `1280x580`
  
  
  ---
  
  