Size/Scale issue with "Vimeo" preset ? GHB GUI (good) vs HandbrakeCLI (wrong)

Discussion of the HandBrake command line interface (CLI)
Forum rules
An Activity Log is required for support requests. Please read How-to get an activity log? for details on how and why this should be provided.
Post Reply
kbu6789
Posts: 2
Joined: Fri May 31, 2019 9:16 am

Size/Scale issue with "Vimeo" preset ? GHB GUI (good) vs HandbrakeCLI (wrong)

Post by kbu6789 » Fri May 31, 2019 9:49 am

Hello,

I'm having a problem that's been bothering me for a few days with the "Vimeo Youtube 720p30" preset of HandbrakeCLI : the scale ratio is not kept !

Description of problem or question:

I would like to encode a 1080x1920-mp4 (video was taken "vertically") file created from my Android phone into a smaller size for a wordpress blog. For this case, the "Vimeo Youtube 720p30" preset of the Handbrake-Gui works fine : the video output is 406x720 and the scale ratio is kept. Great !

Image https://i.paste.pics/1f70bc955b4cdcaefe ... bd05b7.png

But if a try to do the same with the HandbrakeCLI, the video dimension becomes1080x720, the scale ratio is broken and the image is distorted !

Image https://i.paste.pics/c5f2de09666c35ac42 ... bf162f.png

Command line is :

Code: Select all

./HandBrakeCLI --preset 'Vimeo YouTube 720p30' -i ../testOri.mp4 -o testOri_YT720p30.mp4
I tried to export Gui preset into a custom HandbrakeCLI preset (+rebuilding), but the issue is still here.

HandBrake version (e.g., 1.0.0):

The last one available on github (but I have the same issue with the version provided in debian 10/buster).

Code: Select all

Handbrake/build$ ./HandBrakeCLI --version

Cannot load libnvidia-encode.so.1
Cannot load libnvidia-encode.so.1
Cannot load libnvidia-encode.so.1
Cannot load libnvidia-encode.so.1
[10:59:50] hb_init: starting libhb thread
[10:59:50] thread 7ff0c1fed700 started ("libhb")
HandBrake 20190527163102-6c4e488-master

HandBrake has exited.
Operating system and version (e.g., Ubuntu 16.04 LTS, macOS 10.13 High Sierra, Windows 10 Creators Update):

Code: Select all

$ cat /etc/debian_version 
10.0

HandBrake Activity Log

Here is the activity log of the HandbrakeCLI :

Code: Select all

Cannot load libnvidia-encode.so.1
Cannot load libnvidia-encode.so.1
Cannot load libnvidia-encode.so.1
Cannot load libnvidia-encode.so.1
[11:11:22] hb_init: starting libhb thread
[11:11:22] thread 7fc9c3e23700 started ("libhb")
HandBrake 20190527163102-6c4e488-master (2019053101) - Linux x86_64 - https://handbrake.fr
4 CPUs detected
Opening ../testOri.mp4...
[11:11:22] CPU: Intel(R) Core(TM) i5-4590 CPU @ 3.30GHz
[11:11:22]  - Intel microarchitecture Haswell
[11:11:22]  - logical processor count: 4
[11:11:22] hb_scan: path=../testOri.mp4, title_index=1
udfread ERROR: ECMA 167 Volume Recognition failed
disc.c:323: failed opening UDF image ../testOri.mp4
disc.c:424: error opening file BDMV/index.bdmv
disc.c:424: error opening file BDMV/BACKUP/index.bdmv
[11:11:22] bd: not a bd - trying as a stream/file instead
libdvdnav: Using dvdnav version 6.0.0
libdvdread:DVDOpenFileUDF:UDFFindFile /VIDEO_TS/VIDEO_TS.IFO failed
libdvdread:DVDOpenFileUDF:UDFFindFile /VIDEO_TS/VIDEO_TS.BUP failed
libdvdread: Can't open file VIDEO_TS.IFO.
libdvdnav: vm: failed to read VIDEO_TS.IFO
[11:11:22] dvd: not a dvd - trying as a stream/file instead
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '../testOri.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: isommp42
    creation_time   : 2019-05-24T14:13:36.000000Z
    location        : +48.3928-004.5313/
    location-eng    : +48.3928-004.5313/
    com.android.version: 8.1.0
    com.android.manufacturer: samsung
    com.android.model: SM-G900F
  Duration: 00:00:12.82, start: 0.000000, bitrate: 17313 kb/s
    Stream #0:0(eng): Video: h264 (Baseline) (avc1 / 0x31637661), yuv420p(tv, bt709), 1920x1080, 16965 kb/s, SAR 1:1 DAR 16:9, 29.96 fps, 30 tbr, 90k tbn, 180k tbc (default)
    Metadata:
      rotate          : 90
      creation_time   : 2019-05-24T14:13:36.000000Z
      handler_name    : VideoHandle
    Side data:
      displaymatrix: rotation of -90.00 degrees
    Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, mono, fltp, 96 kb/s (default)
    Metadata:
      creation_time   : 2019-05-24T14:13:36.000000Z
      handler_name    : SoundHandle
[11:11:22] scan: decoding previews for title 1
[11:11:22] scan: audio 0x1: aac, rate=48000Hz, bitrate=96100 English (AAC LC) (1.0 ch) (96 kbps)

Scanning title 1 of 1, preview 6, 60.00 %[11:11:22] scan: 10 previews, 1080x1920, 29.965 fps, autocrop = 0/0/0/0, aspect 1:1.78, PAR 1:1
[11:11:22] libhb: scan thread found 1 valid title(s)
+ Using preset: Vimeo YouTube 720p30
+ title 1:
  + stream: ../testOri.mp4
  + duration: 00:00:12
  + size: 1080x1920, pixel aspect: 1/1, display aspect: 0.56, 29.965 fps
  + autocrop: 0/0/0/0
  + chapters:
    + 1: cells 0->0, 0 blocks, duration 00:00:12
  + audio tracks:
    + 1, English (AAC LC) (1.0 ch) (96 kbps) (iso639-2: eng)
  + subtitle tracks:
[11:11:22] 1 job(s) to process
[11:11:22] json job:
{
    "Audio": {
        "AudioList": [
            {
                "Bitrate": 256,
                "CompressionLevel": -1.0,
                "DRC": 0.0,
                "DitherMethod": "auto",
                "Encoder": "av_aac",
                "Gain": 0.0,
                "Mixdown": "mono",
                "NormalizeMixLevel": false,
                "PresetEncoder": "av_aac",
                "Quality": -3.0,
                "Samplerate": 48000,
                "Track": 0
            }
        ],
        "CopyMask": [
            "copy:aac"
        ],
        "FallbackEncoder": "av_aac"
    },
    "Destination": {
        "AlignAVStart": true,
        "ChapterList": [
            {
                "Name": ""
            }
        ],
        "ChapterMarkers": false,
        "File": "testOri_YT720p30.mp4",
        "InlineParameterSets": false,
        "Mp4Options": {
            "IpodAtom": false,
            "Mp4Optimize": true
        },
        "Mux": "m4v"
    },
    "Filters": {
        "FilterList": [
            {
                "ID": 3,
                "Settings": {
                    "block-height": "16",
                    "block-thresh": "40",
                    "block-width": "16",
                    "filter-mode": "2",
                    "mode": "3",
                    "motion-thresh": "1",
                    "spatial-metric": "2",
                    "spatial-thresh": "1"
                }
            },
            {
                "ID": 4,
                "Settings": {
                    "mode": "7"
                }
            },
            {
                "ID": 6,
                "Settings": {
                    "mode": 2,
                    "rate": "27000000/900000"
                }
            },
            {
                "ID": 12,
                "Settings": {
                    "crop-bottom": 0,
                    "crop-left": 0,
                    "crop-right": 0,
                    "crop-top": 0,
                    "height": 720,
                    "width": 1080
                }
            }
        ]
    },
    "Metadata": {},
    "PAR": {
        "Den": 1,
        "Num": 1
    },
    "SequenceID": 0,
    "Source": {
        "Angle": 0,
        "Path": "../testOri.mp4",
        "Range": {
            "End": 1,
            "Start": 1,
            "Type": "chapter"
        },
        "Title": 1
    },
    "Subtitle": {
        "Search": {
            "Burn": true,
            "Default": false,
            "Enable": false,
            "Forced": false
        },
        "SubtitleList": []
    },
    "Video": {
        "ColorFormat": 0,
        "ColorMatrix": 1,
        "ColorPrimaries": 1,
        "ColorRange": 1,
        "ColorTransfer": 1,
        "Encoder": "x264",
        "Level": "3.2",
        "Options": "keyint=30:min-keyint=15:ref=1:bframes=2:b-pyramid=none",
        "Preset": "medium",
        "Profile": "high",
        "QSV": {
            "AsyncDepth": 4,
            "Decode": false
        },
        "Quality": 22.0,
        "Tune": "",
        "Turbo": false,
        "TwoPass": false
    }
}
[11:11:22] starting job
[11:11:22] job configuration:
[11:11:22]  * source
[11:11:22]    + ../testOri.mp4
[11:11:22]    + title 1, chapter(s) 1 to 1
[11:11:22]    + container: mov,mp4,m4a,3gp,3g2,mj2
[11:11:22]    + data rate: 17313 kbps
[11:11:22]  * destination
[11:11:22]    + testOri_YT720p30.mp4
[11:11:22]    + container: MPEG-4 (libavformat)
[11:11:22]      + optimized for HTTP streaming (fast start)
[11:11:22]      + align initial A/V stream timestamps
[11:11:22]  * video track
[11:11:22]    + decoder: h264
[11:11:22]      + bitrate 16965 kbps
[11:11:22]    + filters
[11:11:22]      + Comb Detect (mode=3:spatial-metric=2:motion-thresh=1:spatial-thresh=1:filter-mode=2:block-thresh=40:block-width=16:block-height=16)
[11:11:22]      + Decomb (mode=39)
[11:11:22]      + Framerate Shaper (mode=2:rate=27000000/900000)
[11:11:22]        + frame rate: 29.965 fps -> peak rate limited to 30.000 fps
[11:11:22]      + Crop and Scale (width=1080:height=720:crop-top=0:crop-bottom=0:crop-left=0:crop-right=0)
[11:11:22]        + source: 1080 * 1920, crop (0/0/0/0): 1080 * 1920, scale: 1080 * 720
[11:11:22]    + Output geometry
[11:11:22]      + storage dimensions: 1080 x 720
[11:11:22]      + pixel aspect ratio: 1 : 1
[11:11:22]      + display dimensions: 1080 x 720
[11:11:22]    + encoder: H.264 (libx264)
[11:11:22]      + preset:  medium
[11:11:22]      + options: keyint=30:min-keyint=15:ref=1:bframes=2:b-pyramid=none
[11:11:22]      + profile: high
[11:11:22]      + level:   3.2
[11:11:22]      + quality: 22.00 (RF)
[11:11:22]      + color profile: 1-1-1
[11:11:22]  * audio track 1
[11:11:22]    + decoder: English (AAC LC) (1.0 ch) (96 kbps) (track 1, id 0x1)
[11:11:22]      + bitrate: 96 kbps, samplerate: 48000 Hz
[11:11:22]    + mixdown: Mono
[11:11:22]    + dither: triangular
[11:11:22]    + encoder: AAC (libavcodec)
[11:11:22]      + bitrate: 256 kbps, samplerate: 48000 Hz
[11:11:22] sync: expecting 383 video frames
[11:11:22] encx264: min-keyint: 15, keyint: 30
[11:11:22] encx264: encoding at constant RF 22.000000
[11:11:22] encx264: unparsed options: keyint=30:keyint-min=15:ref=1:bframes=2:b-pyramid=none:level=3.2:vbv-bufsize=25000:vbv-maxrate=25000
x264 [info]: using SAR=1/1
x264 [info]: using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
x264 [info]: profile Progressive High, level 3.2, 4:2:0, 8-bit
[11:11:22] sync: first pts video is 0
[11:11:22] sync: Chapter 1 at frame 1 time 0
[11:11:22] sync: first pts audio 0x1 is 0

Encoding: task 1 of 1, 1.83 %
Encoding: task 1 of 1, 9.92 %
Encoding: task 1 of 1, 16.19 %
Encoding: task 1 of 1, 20.37 %
Encoding: task 1 of 1, 30.29 %
Encoding: task 1 of 1, 30.29 %
Encoding: task 1 of 1, 32.90 %
Encoding: task 1 of 1, 38.90 %
Encoding: task 1 of 1, 39.43 %
Encoding: task 1 of 1, 47.26 %
Encoding: task 1 of 1, 47.26 %
Encoding: task 1 of 1, 54.05 %
Encoding: task 1 of 1, 54.05 %
Encoding: task 1 of 1, 55.61 %
Encoding: task 1 of 1, 62.40 % (59.10 fps, avg 59.10 fps, ETA 00h00m03s)
Encoding: task 1 of 1, 62.40 % (59.10 fps, avg 59.10 fps, ETA 00h00m03s)
Encoding: task 1 of 1, 69.97 % (43.18 fps, avg 50.02 fps, ETA 00h00m02s)
Encoding: task 1 of 1, 71.54 % (43.18 fps, avg 50.02 fps, ETA 00h00m02s)
Encoding: task 1 of 1, 77.81 % (43.18 fps, avg 50.02 fps, ETA 00h00m02s)
Encoding: task 1 of 1, 77.81 % (43.18 fps, avg 50.02 fps, ETA 00h00m02s)
Encoding: task 1 of 1, 80.42 % (40.82 fps, avg 49.22 fps, ETA 00h00m01s)[11:11:29] reader: done. 1 scr changes

Encoding: task 1 of 1, 85.38 % (40.82 fps, avg 49.22 fps, ETA 00h00m01s)
Encoding: task 1 of 1, 85.38 % (40.82 fps, avg 49.22 fps, ETA 00h00m01s)
Encoding: task 1 of 1, 88.77 % (40.82 fps, avg 49.22 fps, ETA 00h00m01s)
Encoding: task 1 of 1, 89.56 % (36.26 fps, avg 47.09 fps, ETA 00h00m00s)
Encoding: task 1 of 1, 89.56 % (36.26 fps, avg 47.09 fps, ETA 00h00m00s)
Encoding: task 1 of 1, 89.56 % (36.26 fps, avg 47.09 fps, ETA 00h00m00s)
Encoding: task 1 of 1, 89.56 % (36.26 fps, avg 47.09 fps, ETA 00h00m00s)
Encoding: task 1 of 1, 89.56 % (36.26 fps, avg 47.09 fps, ETA 00h00m00s)
Encoding: task 1 of 1, 89.56 % (36.26 fps, avg 47.09 fps, ETA 00h00m00s)[11:11:31] work: average encoding speed for job is 47.092941 fps

Encoding: task 1 of 1, 89.56 % (36.26 fps, avg 47.09 fps, ETA 00h00m00s)[11:11:32] comb detect: heavy 39 | light 123 | uncombed 222 | total 384
[11:11:32] decomb: deinterlaced 39 | blended 123 | unfiltered 222 | total 384
[11:11:32] vfr: 384 frames output, 0 dropped and 0 duped for CFR/PFR
[11:11:32] vfr: lost time: 0 (0 frames)
[11:11:32] vfr: gained time: 0 (0 frames) (0 not accounted for)
[11:11:32] aac-decoder done: 599 frames, 0 decoder errors
[11:11:32] h264-decoder done: 384 frames, 0 decoder errors
[11:11:32] sync: got 384 frames, 383 expected
[11:11:32] sync: framerate min 19.702 fps, max 30.293 fps, avg 29.939 fps
x264 [info]: frame I:27    Avg QP:20.41  size: 17399
x264 [info]: frame P:261   Avg QP:23.25  size:  9783
x264 [info]: frame B:96    Avg QP:23.82  size:  4000
x264 [info]: consecutive B-frames: 60.9%  6.2% 32.8%
x264 [info]: mb I  I16..4: 21.0% 71.7%  7.3%
x264 [info]: mb P  I16..4: 16.2% 33.7%  1.7%  P16..4: 27.7%  4.9%  1.8%  0.0%  0.0%    skip:14.1%
x264 [info]: mb B  I16..4:  0.4%  0.7%  0.1%  B16..8: 37.7%  2.0%  0.2%  direct: 3.3%  skip:55.6%  L0:42.0% L1:56.9% BI: 1.1%
x264 [info]: 8x8 transform intra:66.4% inter:88.6%
x264 [info]: coded y,uvDC,uvAC intra: 38.2% 48.9% 5.4% inter: 19.7% 33.2% 0.0%
x264 [info]: i16 v,h,dc,p: 12% 49%  5% 34%
x264 [info]: i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 20% 37% 20%  2%  4%  6%  6%  2%  4%
x264 [info]: i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 21% 47% 10%  3%  4%  6%  5%  1%  3%
x264 [info]: i8c dc,h,v,p: 53% 34% 10%  4%
x264 [info]: Weighted P-Frames: Y:4.6% UV:1.9%
x264 [info]: kb/s:2124.92
[11:11:32] mux: track 0, 384 frames, 3406457 bytes, 2121.02 kbps, fifo 512
[11:11:32] mux: track 1, 600 frames, 388925 bytes, 242.16 kbps, fifo 1024
[11:11:32] libhb: work result = 0

Encode done!
HandBrake has exited.
Here is the activity log of the Handbrake GTK GUI

Code: Select all

https://pastebin.com/FDY4rAfJ
Has anyone ever had the problem and could enlight me ? Feel free to ask if you need more information.

Have a nice day
Thank you

EDIT 31/05/19 15:23 => Adding command line

User avatar
JohnAStebbins
HandBrake Team
Posts: 5420
Joined: Sat Feb 09, 2008 7:21 pm

Re: Size/Scale issue with "Vimeo" preset ? GHB GUI (good) vs HandbrakeCLI (wrong)

Post by JohnAStebbins » Fri May 31, 2019 3:09 pm

I'm surprised that's not been caught previously. There is a flag in the preset that tells HandBrake to keep the display aspect ratio of the source. The CLI is ignoring that flag :oops:

Should be fixed in the next nightly build
https://github.com/HandBrake/HandBrake/ ... 84beee47af

kbu6789
Posts: 2
Joined: Fri May 31, 2019 9:16 am

Re: Size/Scale issue with "Vimeo" preset ? GHB GUI (good) vs HandbrakeCLI (wrong)

Post by kbu6789 » Fri May 31, 2019 9:06 pm

Oh ! I didn't expect it to be a bug ! Thank you for the commit, I will try again tomorrow.

Thank you for your answer.

Post Reply