VideoHelp Forum




+ Reply to Thread
Results 1 to 10 of 10
  1. Member
    Join Date
    May 2025
    Location
    Nova Scotia, Canada
    Search Comp PM
    I seem to have poisoned the aspect ratio of a video I converted from UHD.

    The video was a UHD rip, so 16:9 DAR. I stripped the letterbox and downsampled to 1920x800 with:

    Code:
    ffmpeg -analyzeduration 1000000000 -probesize 100G -loglevel warning -stats -hwaccel cuda \
      -hwaccel_output_format cuda -y -i "UHDSOURCE.mkv" -map 0:v? -c:v hevc_nvenc \
      -preset p7 -2pass true -multipass fullres -rc vbr -rc-lookahead 55 -b:v 1000k -minrate 0 -maxrate 3000k \
      -bufsize 120000k -vf crop=3840:1600:0:280,scale_cuda=1920:800 -metadata title="HDDEST" \
      -map 0:a:2 -c:a:0 aac -b:a:0 160k -map 0:a:4 -c:a:1 aac -b:a:1 96k \
      -map 0:s? -c:s copy -map_metadata 0 "HDDEST.mkv"
    This correctly cropped, but when the scale_cuda filter got at it, it decided to change the SAR to stretch the resultant video back to 16:9. My Roku will now not display it correctly. The SAR/DAR show as pretty odd when I ffprobe it:

    Code:
    Stream #0:0(eng): Video: hevc (Main 10), yuv420p10le(tv, bt2020nc/bt2020/smpte2084), 1920x800 [SAR 20:27 DAR 16:9], SAR 27:20 DAR 81:25, 23.98 fps, 23.98 tbr, 1k tbn (default)
    I tried to correct with ffmpeg (-aspect 12:5), mkvtoolnix, and mp4box (par=12:5). The results with all of them is the same, where the stream shows as having two different aspect ratios:

    Code:
    Stream #0:0[0x1](eng): Video: hevc (Main 10) (hev1 / 0x31766568), yuv420p10le(tv, bt2020nc/bt2020/smpte2084), 1920x800 [SAR 20:27 DAR 16:9], 1072 kb/s, SAR 1:1 DAR 12:5, 23.98 fps, 23.98 tbr, 16k tbn, Start 0.021000 (default)
    I have no idea why the aspect ratio is shown twice. Once in square brackets, which I can't change for love nor money, and once outside square brackets. No matter what I do, the values shown in square brackets remain the same.

    Unfortunately, I knocked my burner with the UHD disc off my desk and damaged the disc so can't re-encode this. Even if I could, though, I'd like to understand what's going on here. There must be a way to change this metadata without reencoding.
    Quote Quote  
  2. Have you tried clever-FFmpeg-GUI
    you can post your questions in the support thread here: Support Forum

    Originally Posted by VA1DER View Post
    I have no idea why the aspect ratio is shown twice. Once in square brackets, and once outside square brackets.
    No matter what I do, the values shown in square brackets remain the same.
    Quote Quote  
  3. Use clever Ffmpeg-GUI.
    Load your mkv, click main page, click various, click change DAR.
    insert 2.39 as new DAR, click change DAR.
    Done.
    No reencode occours.
    Quote Quote  
  4. Member
    Join Date
    May 2025
    Location
    Nova Scotia, Canada
    Search Comp PM
    If the GUI can do it, it has to be possible from the ffmpeg command line.

    I already tried:
    Code:
    ffmpeg -i a.mkv -aspect 12:5 -c copy a2.mkv
    and...
    Code:
    ffmpeg -i a2.mkv -c copy -metadata:s:v:0 display_aspect_ratio=12:5 a2a.mp4
    I suspect the latter is what the above command in the gui is doing when you change the DAR.
    Even after these, ffprobe still shows:
    Code:
    Stream #0:0[0x1](eng): Video: hevc (Main 10) (hev1 / 0x31766568), yuv420p10le(tv, bt2020nc/bt2020/smpte2084), 1920x800 [SAR 20:27 DAR 16:9], 1072 kb/s, SAR 1:1 DAR 12:5, 23.98 fps, 23.98 tbr, 16k tbn, Start 0.021000 (default)
    Note the "[SAR 20:27 DAR 16:9]" and the "SAR 1:1 DAR 12:5" both shown for the same stream. I can'pt get ffmpeg to change both.
    Quote Quote  
  5. Use in the ffmpeg commandline the filter
    -vf setsar=1/1, setdar=12/5, ......
    Quote Quote  
  6. Member
    Join Date
    May 2025
    Location
    Nova Scotia, Canada
    Search Comp PM
    In ffmpeg the HEVC (or H.264) stream can have the aspect ratio set independent of the container.

    Using -aspect sets the container's aspect ratio. Using -vf setsar would work on the stream but imposes a re-encode and I was really trying to avoid that.

    I was finally able to do it without a re-encode by using a bitstream filter:

    Code:
    ffmpeg -i faulty.mkv -map 0:v:0 -c:v:0 copy -aspect 12:5  -bsf:v:0 hevc_metadata=sample_aspect_ratio=1 -map 0:a:0 -c:a:0 copy corrected.mkv
    Quote Quote  
  7. Originally Posted by VA1DER View Post
    In ffmpeg the HEVC (or H.264) stream can have the aspect ratio set independent of the container.

    Using -aspect sets the container's aspect ratio. Using -vf setsar would work on the stream but imposes a re-encode and I was really trying to avoid that.

    I was finally able to do it without a re-encode by using a bitstream filter:

    Code:
    ffmpeg -i faulty.mkv -map 0:v:0 -c:v:0 copy -aspect 12:5  -bsf:v:0 hevc_metadata=sample_aspect_ratio=1 -map 0:a:0 -c:a:0 copy corrected.mkv
    ...and it's still wrong, because the movie has a DAR of 2.39 and not 2.4...
    Quote Quote  
  8. Member
    Join Date
    May 2025
    Location
    Nova Scotia, Canada
    Search Comp PM
    Originally Posted by ProWo View Post
    a DAR of 2.39 and not 2.4...
    It ended up as 1920x800, 2.4:1.
    Quote Quote  
  9. Originally Posted by ProWo View Post
    ...and it's still wrong, because the movie has a DAR of 2.39 and not 2.4...
    Not really. He cropped like 3840:1600 = 2.40:1 and resized to 1920:800 = 2.40:1. Even though the movie AR might in fact be 2.39:1 he has to set the DAR as 2.4:1 because of the way how he cropped and the pixel aspect ratio of the source is 1:1 square pixels.
    Anyway, splitting hairs
    Quote Quote  
  10. Originally Posted by Sharc View Post
    Originally Posted by ProWo View Post
    ...and it's still wrong, because the movie has a DAR of 2.39 and not 2.4...
    Not really. He cropped like 3840:1600 = 2.40:1 and resized to 1920:800 = 2.40:1. Even though the movie AR might in fact be 2.39:1 he has to set the DAR as 2.4:1 because of the way how he cropped and the pixel aspect ratio of the source is 1:1 square pixels.
    Anyway, splitting hairs
    The correct source AR can be applied, even with 1920x800, as you can see here:
    Image
    [Attachment 87011 - Click to enlarge]
    Quote Quote  



Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!