Hi,

I'm watching a serial. Those files are made at 3840 x 1604 pixels, and display badly on my old and small Lenovo Yoga laptop connected via HDMI cable to my sitting room TV set (the sound plays well, but the video is jumpy, it can stop for several seconds). I tested several conversions to an "easier on the cpu" files, and one of these worked:

    ffmpeg -t 10:0 -i movie.mkv \
        -vf scale=960:802  -c:v mpeg4 -vtag xvid -qscale:v 3  -c:a copy -c:s copy -c:s copy  \
        3b_movie.mkv

You may notice that the scale is wrong. The original aspect ratio is 2.3940, while this has 1.1970, so when VLC plays it it has to change the displayed aspect ratio at runtime so that it displays correctly. So I corrected the command line:

    ffmpeg -t 10:0 -i movie.mkv \
        -vf scale=-1:802  -c:v mpeg4 -vtag xvid -qscale:v 3  -c:a copy -c:s copy -c:s copy  \
        3c_movie.mkv

which produces a 1920 x 802 as the same aspect ratio as the original 2.3940. However, it displays badly (haltingly) on the laptop!

Why?

(note: TV set is 1920 x 1080)


The files are local to the computer, the disk is M2. The second version is bigger:

  221287201  3b_movie.mkv
  323457154  3c_movie.mkv

The first version plays at about 50% CPU on the two cores, while the second one plays (haltingly) at 100% and 20%, on vlc. And both versions play fine on kodi (40% cpu, both cores). Not so the original, plays haltingly, but different than VLC.

Unrelated problem: only one of the two subtitles streams are copied.


Original video info:

    General
    Unique ID                                : 271279799347578328510273573056556095920 (0xCC1696C14DD847778B2137B3485CD9B0)
    Complete name                            : movie.mkv
    Format                                   : Matroska
    Format version                           : Version 4
    File size                                : 1.75 GiB
    Duration                                 : 54 min 17 s
    Overall bit rate                         : 4 608 kb/s
    Frame rate                               : 23.976 FPS
    Encoded date                             : 2022-05-15 21:04:13 UTC
    Writing application                      : mkvmerge v67.0.0 ('Under Stars') 64-bit     Writing library                          : libebml v1.4.2 + libmatroska v1.6.4

    Video
    ID                                       : 1
    Format                                   : HEVC
    Format/Info                              : High Efficiency Video Coding
    Format profile                           : Main 10@L5@Main
    Codec ID                                 : V_MPEGH/ISO/HEVC
    Duration                                 : 54 min 17 s
    Bit rate                                 : 3 966 kb/s
    Width                                    : 3 840 pixels
    Height                                   : 1 604 pixels
    Display aspect ratio                     : 2.39:1
    Frame rate mode                          : Constant
    Frame rate                               : 23.976 (24000/1001) FPS
    Color space                              : YUV
    Chroma subsampling                       : 4:2:0
    Bit depth                                : 10 bits
    Bits/(Pixel*Frame)                       : 0.027
    Stream size                              : 1.50 GiB (86%)
    Writing library                          : x265 3.5+12+14-106329cbd:[Windows][GCC 10.3.0][64 bit] 10bit     Encoding settings                        : cpuid=1111039 / frame-threads=2 / numa-pools=4 / wpp / no-pmode / no-pme / no-psnr / ssim / log-level=2 / input-csp=1 / input-res=3840x1604 / interlace=0 / total-     frames=78104 / level-idc=0 / high-tier=1 / uhd-bd=0 / ref=3 / no-allow-non-conformance / no-repeat-headers / annexb / no-aud / no-eob / no-eos / no-hrd / info / hash=0 / no-temporal-layers / open-gop / min     -keyint=23 / keyint=250 / gop-lookahead=0 / bframes=8 / b-adapt=2 / b-pyramid / bframe-bias=0 / rc-lookahead=80 / lookahead-slices=8 / scenecut=40 / no-hist-scenecut / radl=0 / no-splice / no-intra-refresh      / ctu=64 / min-cu-size=8 / no-rect / no-amp / max-tu-size=32 / tu-inter-depth=1 / tu-intra-depth=1 / limit-tu=0 / rdoq-level=0 / dynamic-rd=0.00 / no-ssim-rd / signhide / no-tskip / nr-intra=0 / nr-inter=     0 / no-constrained-intra / no-strong-intra-smoothing / max-merge=5 / limit-refs=3 / no-limit-modes / me=3 / subme=5 / merange=57 / temporal-mvp / no-frame-dup / no-hme / weightp / no-weightb / no-analyze-s     rc-pics / deblock=0:0 / sao / no-sao-non-deblock / rd=3 / selective-sao=4 / early-skip / no-rskip / no-fast-intra / no-tskip-fast / no-cu-lossless / b-intra / no-splitrd-skip / rdpenalty=0 / psy-rd=2.00 /     psy-rdoq=0.00 / no-rd-refine / no-lossless / cbqpoffs=0 / crqpoffs=0 / rc=crf / crf=20.0 / qcomp=0.60 / qpstep=4 / stats-write=0 / stats-read=0 / ipratio=1.40 / pbratio=1.30 / aq-mode=3 / aq-strength=1.00     / cutree / zone-count=0 / no-strict-cbr / qg-size=32 / no-rc-grain / qpmax=69 / qpmin=0 / no-const-vbv / sar=0 / overscan=0 / videoformat=5 / range=0 / colorprim=1 / transfer=1 / colormatrix=1 / chromaloc=     0 / display-window=0 / cll=0,0 / min-luma=0 / max-luma=1023 / log2-max-poc-lsb=8 / vui-timing-info / vui-hrd-info / slices=1 / no-opt-qp-pps / no-opt-ref-list-length-pps / no-multi-pass-opt-rps / scenecut-     bias=0.05 / hist-threshold=0.03 / no-opt-cu-delta-qp / no-aq-motion / no-hdr10 / no-hdr10-opt / no-dhdr10-opt / no-idr-recovery-sei / analysis-reuse-level=0 / analysis-save-reuse-level=0 / analysis-load-re     use-level=0 / scale-factor=0 / refine-intra=0 / refine-inter=0 / refine-mv=1 / refine-ctu-distortion=0 / no-limit-sao / ctu-info=0 / no-lowpass-dct / refine-analysis-type=0 / copy-pic=1 / max-ausize-factor     =1.0 / no-dynamic-refine / no-single-sei / no-hevc-aq / no-svt / no-field / qp-adaptation-range=1.00 / scenecut-aware-qp=0 / conformance-window-right-offset=0 / conformance-window-bottom-offset=0 / decoder
    -max-rate=0 / no-vbv-live-multi-pass
    Default                                  : Yes
    Forced                                   : No
    Color range                              : Limited
    Color primaries                          : BT.709
    Transfer characteristics                 : BT.709
    Matrix coefficients                      : BT.709

    Audio
    ID                                       : 2
    Format                                   : E-AC-3
    Format/Info                              : Enhanced AC-3
    Commercial name                          : Dolby Digital Plus
    Codec ID                                 : A_EAC3
    Duration                                 : 54 min 17 s
    Bit rate mode                            : Constant
    Bit rate                                 : 640 kb/s
    Channel(s)                               : 6 channels
    Channel layout                           : L R C LFE Ls Rs
    Sampling rate                            : 48.0 kHz
    Frame rate                               : 31.250 FPS (1536 SPF)
    Compression mode                         : Lossy
    Stream size                              : 249 MiB (14%)
    Language                                 : English
    Service kind                             : Complete Main
    Default                                  : No
    Forced                                   : No

    Text #1
    ID                                       : 3
    Format                                   : UTF-8
    Codec ID                                 : S_TEXT/UTF8
    Codec ID/Info                            : UTF-8 Plain Text
    Duration                                 : 52 min 31 s
    Bit rate                                 : 79 b/s
    Frame rate                               : 0.311 FPS
    Count of elements                        : 980
    Stream size                              : 30.6 KiB (0%)
    Language                                 : English (US)
    Default                                  : No
    Forced                                   : No

    Text #2
    ID                                       : 4
    Format                                   : UTF-8
    Codec ID                                 : S_TEXT/UTF8
    Codec ID/Info                            : UTF-8 Plain Text
    Duration                                 : 52 min 40 s
    Bit rate                                 : 84 b/s
    Frame rate                               : 0.329 FPS
    Count of elements                        : 1041
    Stream size                              : 32.7 KiB (0%)
    Title                                    : SDH
    Language                                 : English (US)
    Default                                  : No
    Forced                                   : No

First conversion:

    General
    Unique ID                                : 65254525213269111854603213254625185810 (0x3117907D45A8EECD2B12881EB9B5D012)
    Complete name                            : 3b_movie.mkv
    Format                                   : Matroska
    Format version                           : Version 4
    File size                                : 211 MiB
    Duration                                 : 10 min 0 s
    Overall bit rate                         : 2 950 kb/s
    Frame rate                               : 130.170 FPS
    Writing application                      : Lavf57.83.100
    Writing library                          : Lavf57.83.100
    ErrorDetectionType                       : Per level 1

    Video
    ID                                       : 1
    Format                                   : MPEG-4 Visual
    Format profile                           : Simple@L1
    Format settings, BVOP                    : No
    Format settings, QPel                    : No
    Format settings, GMC                     : No warppoints
    Format settings, Matrix                  : Default (H.263)
    Codec ID                                 : V_MPEG4/ISO/ASP
    Codec ID/Info                            : Advanced Simple Profile
    Duration                                 : 10 min 0 s
    Bit rate                                 : 3 966 kb/s
    Width                                    : 960 pixels
    Height                                   : 802 pixels
    Display aspect ratio                     : 2.39:1
    Frame rate mode                          : Variable
    Frame rate                               : 130.170 FPS
    Color space                              : YUV
    Chroma subsampling                       : 4:2:0
    Bit depth                                : 8 bits
    Scan type                                : Progressive
    Compression mode                         : Lossy
    Bits/(Pixel*Frame)                       : 0.040
    Stream size                              : 1.50 GiB
    Writing library                          : Lavc57.107.100
    Default                                  : Yes
    Forced                                   : No

    Audio
    ID                                       : 2
    Format                                   : E-AC-3
    Format/Info                              : Enhanced AC-3
    Commercial name                          : Dolby Digital Plus
    Codec ID                                 : A_EAC3
    Duration                                 : 10 min 0 s
    Bit rate mode                            : Constant
    Bit rate                                 : 640 kb/s
    Channel(s)                               : 6 channels
    Channel layout                           : L R C LFE Ls Rs
    Sampling rate                            : 48.0 kHz
    Frame rate                               : 31.250 FPS (1536 SPF)
    Bit depth                                : 32 bits
    Compression mode                         : Lossy
    Stream size                              : 249 MiB
    Language                                 : English
    Service kind                             : Complete Main
    Default                                  : No
    Forced                                   : No

    Text
    Text
    ID                                       : 3
    Format                                   : UTF-8
    Codec ID                                 : S_TEXT/UTF8
    Codec ID/Info                            : UTF-8 Plain Text
    Duration                                 : 9 min 59 s
    Bit rate                                 : 79 b/s
    Frame rate                               : 1.634 FPS
    Count of elements                        : 980
    Stream size                              : 30.6 KiB (0%)
    Language                                 : English
    Default                                  : No
    Forced                                   : No


Second conversion:

    General
    Unique ID                                : 177092085256568951320051960005036432120 (0x853AB1EAED75B4D16EC1208D24195AF8)
    Complete name                            : 3c_movie.mkv
    Format                                   : Matroska
    Format version                           : Version 4
    File size                                : 308 MiB
    Duration                                 : 10 min 0 s
    Overall bit rate                         : 4 313 kb/s
    Frame rate                               : 130.170 FPS
    Writing application                      : Lavf57.83.100
    Writing library                          : Lavf57.83.100
    ErrorDetectionType                       : Per level 1

    Video
    ID                                       : 1
    Format                                   : MPEG-4 Visual
    Format profile                           : Simple@L1
    Format settings, BVOP                    : No
    Format settings, QPel                    : No
    Format settings, GMC                     : No warppoints
    Format settings, Matrix                  : Default (H.263)
    Codec ID                                 : V_MPEG4/ISO/ASP
    Codec ID/Info                            : Advanced Simple Profile
    Duration                                 : 10 min 0 s
    Bit rate                                 : 3 966 kb/s
    Width                                    : 1 920 pixels
    Height                                   : 802 pixels
    Display aspect ratio                     : 2.39:1
    Frame rate mode                          : Variable
    Frame rate                               : 130.170 FPS
    Color space                              : YUV
    Chroma subsampling                       : 4:2:0
    Bit depth                                : 8 bits
    Scan type                                : Progressive
    Compression mode                         : Lossy
    Bits/(Pixel*Frame)                       : 0.020
    Stream size                              : 1.50 GiB
    Writing library                          : Lavc57.107.100
    Default                                  : Yes
    Forced                                   : No

    Audio
    ID                                       : 2
    Format                                   : E-AC-3
    Format/Info                              : Enhanced AC-3
    Commercial name                          : Dolby Digital Plus
    Codec ID                                 : A_EAC3
    Duration                                 : 10 min 0 s
    Bit rate mode                            : Constant
    Bit rate                                 : 640 kb/s
    Channel(s)                               : 6 channels
    Channel layout                           : L R C LFE Ls Rs
    Sampling rate                            : 48.0 kHz
    Frame rate                               : 31.250 FPS (1536 SPF)
    Bit depth                                : 32 bits
    Compression mode                         : Lossy
    Stream size                              : 249 MiB (81%)
    Language                                 : English
    Service kind                             : Complete Main
    Default                                  : No
    Forced                                   : No

    Text
    ID                                       : 3
    Format                                   : UTF-8
    Codec ID                                 : S_TEXT/UTF8
    Codec ID/Info                            : UTF-8 Plain Text
    Duration                                 : 9 min 59 s
    Bit rate                                 : 79 b/s
    Frame rate                               : 1.634 FPS
    Count of elements                        : 980
    Stream size                              : 30.6 KiB (0%)
    Language                                 : English
    Default                                  : No
    Forced                                   : No

CPU info of laptop:

    Legolas:~ # inxi -C -GSaz --za --vs
    inxi 3.3.38-00 (2025-04-06)
    System:
      Kernel: 6.4.0-150600.23.60-default arch: x86_64 bits: 64 compiler: gcc
        v: 7.5.0 clocksource: tsc avail: acpi_pm
        parameters: BOOT_IMAGE=/boot/vmlinuz-6.4.0-150600.23.60-default
        root=UUID=<filter> resume=/dev/disk/by-label/Swap splash=verbose showopts
      Desktop: Xfce v: 4.20.1 tk: Gtk v: 3.24.43 wm: xfwm4 v: 4.20.0
        with: xfce4-panel tools: xfce4-screensaver dm: GDM v: 45.0.1
        Distro: openSUSE Leap 15.6
    CPU:
      Info: model: Intel Celeron N3060 socket: CHV bits: 64 type: MCP
        arch: Airmont level: v2 built: 2015-17 process: Intel 14nm family: 6
        model-id: 0x4C (76) stepping: 4 microcode: 0x411
      Topology: cpus: 1x dies: 1 clusters: 2 cores: 2 smt: <unsupported> cache:         L1: 112 KiB desc: d-2x24 KiB; i-2x32 KiB L2: 2 MiB desc: 2x1024 KiB       Speed (MHz): avg: 480 min/max: 480/2480 base/boost: 1600/1660 scaling:         driver: intel_pstate governor: powersave volts: 4.0 V ext-clock: 83 MHz
        cores: 1: 480 2: 480 bogomips: 6400
      Flags: ht lm nx pae sse sse2 sse3 sse4_1 sse4_2 ssse3
      Vulnerabilities: <filter>
    Graphics:
      Device-1: Intel Atom/Celeron/Pentium Processor x5-E8000/J3xxx/N3xxx
        Integrated Graphics vendor: Lenovo driver: i915 v: kernel arch: Gen-8         process: Intel 14nm built: 2014-15 ports: active: HDMI-A-1 off: eDP-1
        empty: DP-1,DP-2,HDMI-A-2 bus-ID: 00:02.0 chip-ID: 8086:22b1
        class-ID: 0300
      Device-2: Bison Lenovo EasyCamera driver: uvcvideo type: USB rev: 2.0         speed: 480 Mb/s lanes: 1 mode: 2.0 bus-ID: 1-5:3 chip-ID: 5986:0673
        class-ID: 0e02 serial: <filter>
      Display: server: X.Org v: 1.21.1.11 with: Xwayland v: 24.1.1
        compositor: xfwm4 v: 4.20.0 driver: X: loaded: modesetting
        unloaded: fbdev,vesa alternate: intel dri: crocus gpu: i915
        display-ID: localhost:10.0 screens: 1
      Screen-1: 0 s-res: 1920x1080 s-dpi: 96 s-size: 509x286mm (20.04x11.26")
        s-diag: 584mm (22.99")
      Monitor-1: DVI-D-0 res: mode: 1920x1080 hz: 60 scale: 100% (1) dpi: 92
        size: 531x298mm (20.91x11.73") diag: 609mm (23.97") modes: N/A
      API: OpenGL v: 4.5 vendor: mesa v: 23.3.4 glx-v: 1.4 es-v: 3.2
        direct-render: yes renderer: llvmpipe (LLVM 17.0.6 128 bits)
        device-ID: ffffffff:ffffffff memory: 3.65 GiB unified: yes
      API: Vulkan v: 1.3.275 layers: 1 device: 0 type: integrated-gpu name: Intel         HD Graphics 400 (BSW) driver: mesa intel v: 23.3.4 device-ID: 8086:22b1
        surfaces: xcb,xlib
      API: EGL Message: EGL data requires eglinfo. Check --recommends.
      Info: Tools: api: glxinfo,vulkaninfo de: xfce4-display-settings
        x11: xdpyinfo, xprop, xrandr
    Legolas:~ #



vlc output of first file:

    cer@Legolas:~/Videos> cat 3b
    [000055f0bfe99540] main libvlc: Running vlc with the default interface. Use 'cvlc' to use vlc without interface.     [000055f0bff56310] main audio output error: too low audio sample frequency (0)
    [00007f4d48c3d780] main decoder error: failed to create audio output
    [000055f0bff56310] vlcpulse audio output error: digital pass-through stream connection failure: Not supported
    [000055f0bff56310] main audio output error: module not functional
    [00007f4d48c3d780] main decoder error: failed to create audio output
    [00007f4d800033b0] gl gl: Initialized libplacebo v5.264.1 (API v264)
    libva info: VA-API version 1.20.0
    libva info: Trying to open /usr/lib64/dri/iHD_drv_video.so
    libva info: va_openDriver() returns -1
    libva info: Trying to open /usr/lib64/dri/i965_drv_video.so
    libva info: Found init function __vaDriverInit_1_13
    libva info: va_openDriver() returns 0
    [00007f4d3c00f1f0] vaapi generic error: profile(3) is not supported
    [00007f4d800033b0] gl gl: Initialized libplacebo v5.264.1 (API v264)
    libva info: VA-API version 1.20.0
    libva info: Trying to open /usr/lib64/dri/iHD_drv_video.so
    libva info: va_openDriver() returns -1
    libva info: Trying to open /usr/lib64/dri/i965_drv_video.so
    libva info: Found init function __vaDriverInit_1_13
    libva info: va_openDriver() returns 0
    [00007f4d48c186e0] avcodec decoder: Using OpenGL/VAAPI backend for VDPAU for hardware decoding     [00007f4d48c186e0] avcodec decoder error: existing hardware acceleration cannot be reused
    [00007f4d800033b0] gl gl: Initialized libplacebo v5.264.1 (API v264)
    libva info: VA-API version 1.20.0
    libva info: Trying to open /usr/lib64/dri/iHD_drv_video.so
    libva info: va_openDriver() returns -1
    libva info: Trying to open /usr/lib64/dri/i965_drv_video.so
    libva info: Found init function __vaDriverInit_1_13
    libva info: va_openDriver() returns 0
    [00007f4d3c1203c0] vaapi generic error: profile(3) is not supported
    [00007f4d800033b0] gl gl: Initialized libplacebo v5.264.1 (API v264)
    cer@Legolas:~/Videos>

vlc output of second file:

    cer@Legolas:~/Videos> cat 3c
    [000055edc8394540] main libvlc: Running vlc with the default interface. Use 'cvlc' to use vlc without interface.     [000055edc8451310] main audio output error: too low audio sample frequency (0)
    [00007fd330c3f8c0] main decoder error: failed to create audio output
    [000055edc8451310] vlcpulse audio output error: digital pass-through stream connection failure: Not supported
    [000055edc8451310] main audio output error: module not functional
    [00007fd330c3f8c0] main decoder error: failed to create audio output
    [00007fd3780033b0] gl gl: Initialized libplacebo v5.264.1 (API v264)
    libva info: VA-API version 1.20.0
    libva info: Trying to open /usr/lib64/dri/iHD_drv_video.so
    libva info: va_openDriver() returns -1
    libva info: Trying to open /usr/lib64/dri/i965_drv_video.so
    libva info: Found init function __vaDriverInit_1_13
    libva info: va_openDriver() returns 0
    [00007fd33c03b280] vaapi generic error: profile(3) is not supported
    [00007fd3780033b0] gl gl: Initialized libplacebo v5.264.1 (API v264)
    libva info: VA-API version 1.20.0
    libva info: Trying to open /usr/lib64/dri/iHD_drv_video.so
    libva info: va_openDriver() returns -1
    libva info: Trying to open /usr/lib64/dri/i965_drv_video.so
    libva info: Found init function __vaDriverInit_1_13
    libva info: va_openDriver() returns 0
    [00007fd330c17fe0] avcodec decoder: Using OpenGL/VAAPI backend for VDPAU for hardware decoding     [00007fd330c17fe0] avcodec decoder error: existing hardware acceleration cannot be reused
    [00007fd3780033b0] gl gl: Initialized libplacebo v5.264.1 (API v264)
    libva info: VA-API version 1.20.0
    libva info: Trying to open /usr/lib64/dri/iHD_drv_video.so
    libva info: va_openDriver() returns -1
    libva info: Trying to open /usr/lib64/dri/i965_drv_video.so
    libva info: Found init function __vaDriverInit_1_13
    libva info: va_openDriver() returns 0
    [00007fd33c127330] vaapi generic error: profile(3) is not supported
    [00007fd3780033b0] gl gl: Initialized libplacebo v5.264.1 (API v264)
    cer@Legolas:~/Videos>

Both the original video codec (HEVC) as the codec you choose for transcoding (mpeg4) are unsupported by your hardware. And because your hardware is not very powerful, you have bad performance. At least choose a codec that has hardware support and on your hardware, the only valid choice is H264 which is the only codec having hardware support for both encoding and decoding on your hardware. So you might get a (much) more performant playback if you encode with libx264 instead of mpeg4 and probably also better quality of the encoded video
_______________________________________________
ffmpeg-user mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to