[FFmpeg-user] Video stretched wide

Steve Zemlicka stevezemlicka at gmail.com
Fri Feb 24 16:47:39 EET 2023


I am transcoding some videos from a mpeg2 MKV extracted from a DVD using
makemkv to x264/x265.  I noticed the transcoded videos seemed stretched
wide (using multiple players) as compared to the original MKV.  It's very
slight but especially noticeable when looking at the black bars.  Though I
first noticed this with the hevc_nvenc encoder, I've also verified it is
consistent even with the libx264 with the following minimal command:
ffmpeg -i input_test.mkv -c:v libx264 -crf 0 -c:a copy output_test.mp4

Mediainfo indicates the resolution and aspect ratio are identical between
the two.  Both are 720x480 (3:2).  Normally I'd look at the player being
the culprit but I did a test this morning using Handbrake and the output
from this does not have the issue.  I suspect I'm doing something wrong but
I can't seem to figure it out.  I tried looking this up but most results
seemed to stem from resizing, cropping, etc. and I'm not doing any of that
(at least not intentionally).  Not sure if attachments will come through
but I'm attaching screenshots to this message.  Any thoughts or suggestions?

I am on ffmpeg version n5.1.2

The terminal output is as follows:
[szemlicka at xps finals]$ ffmpeg -i input_test.mkv -c:v libx264 -crf 0 -c:a
copy output_test.mp4
ffmpeg version n5.1.2 Copyright (c) 2000-2022 the FFmpeg developers
  built with gcc 12.2.0 (GCC)
  configuration: --prefix=/usr --disable-debug --disable-static
--disable-stripping --enable-amf --enable-avisynth --enable-cuda-llvm
--enable-lto --enable-fontconfig --enable-gmp --enable-gnutls --enable-gpl
--enable-ladspa --enable-libaom --enable-libass --enable-libbluray
--enable-libbs2b --enable-libdav1d --enable-libdrm --enable-libfreetype
--enable-libfribidi --enable-libgsm --enable-libiec61883 --enable-libjack
--enable-libmfx --enable-libmodplug --enable-libmp3lame
--enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libopenjpeg
--enable-libopus --enable-libpulse --enable-librav1e --enable-librsvg
--enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh
--enable-libsvtav1 --enable-libtheora --enable-libv4l2 --enable-libvidstab
--enable-libvmaf --enable-libvorbis --enable-libvpx --enable-libwebp
--enable-libx264 --enable-libx265 --enable-libxcb --enable-libxml2
--enable-libxvid --enable-libzimg --enable-nvdec --enable-nvenc
--enable-opencl --enable-opengl --enable-shared --enable-version3
--enable-vulkan
  libavutil      57. 28.100 / 57. 28.100
  libavcodec     59. 37.100 / 59. 37.100
  libavformat    59. 27.100 / 59. 27.100
  libavdevice    59.  7.100 / 59.  7.100
  libavfilter     8. 44.100 /  8. 44.100
  libswscale      6.  7.100 /  6.  7.100
  libswresample   4.  7.100 /  4.  7.100
  libpostproc    56.  6.100 / 56.  6.100
Input #0, matroska,webm, from 'input_test.mkv':
  Metadata:
    ENCODER         : Lavf58.76.100
  Duration: 00:01:29.04, start: 0.051000, bitrate: 5965 kb/s
  Stream #0:0: Video: mpeg2video (Main), yuv420p(tv, smpte170m,
progressive), 720x480 [SAR 8:9 DAR 4:3], SAR 1:1 DAR 3:2, 29.97 fps, 29.97
tbr, 1k tbn (default)
    Metadata:
      DURATION        : 00:01:28.939000000
    Side data:
      cpb: bitrate max/min/avg: 9800000/0/0 buffer size: 1835008 vbv_delay:
N/A
  Stream #0:1(eng): Audio: ac3, 48000 Hz, 5.1(side), fltp, 448 kb/s
(default)
    Metadata:
      DURATION        : 00:01:29.043000000
  Stream #0:2(eng): Audio: ac3, 48000 Hz, stereo, fltp, 192 kb/s
    Metadata:
      DURATION        : 00:01:29.043000000
Stream mapping:
  Stream #0:0 -> #0:0 (mpeg2video (native) -> h264 (libx264))
  Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
[libx264 @ 0x55a167189c80] using SAR=1/1
[libx264 @ 0x55a167189c80] using cpu capabilities: MMX2 SSE2Fast SSSE3
SSE4.2 AVX FMA3 BMI2 AVX2 AVX512
[libx264 @ 0x55a167189c80] profile High 4:4:4 Predictive, level 3.0, 4:2:0,
8-bit
[libx264 @ 0x55a167189c80] 264 - core 164 r3095 baee400 - H.264/MPEG-4 AVC
codec - Copyleft 2003-2022 - http://www.videolan.org/x264.html - options:
cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=0
mixed_ref=1 me_range=16 chroma_me=1 trellis=0 8x8dct=1 cqm=0 deadzone=21,11
fast_pskip=0 chroma_qp_offset=0 threads=15 lookahead_threads=2
sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0
constrained_intra=0 bframes=0 weightp=2 keyint=250 keyint_min=25
scenecut=40 intra_refresh=0 rc=cqp mbtree=0 qp=0
[mp4 @ 0x55a16718ff00] track 1: codec frame size is not set
Output #0, mp4, to 'output_test.mp4':
  Metadata:
    encoder         : Lavf59.27.100
  Stream #0:0: Video: h264 (avc1 / 0x31637661), yuv420p(tv, smpte170m,
progressive), 720x480 [SAR 1:1 DAR 3:2], q=2-31, 29.97 fps, 29969 tbn
(default)
    Metadata:
      DURATION        : 00:01:28.939000000
      encoder         : Lavc59.37.100 libx264
    Side data:
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: N/A
  Stream #0:1(eng): Audio: ac3 (ac-3 / 0x332D6361), 48000 Hz, 5.1(side),
fltp, 448 kb/s (default)
    Metadata:
      DURATION        : 00:01:29.043000000
frame= 2664 fps=116 q=-1.0 Lsize=  261131kB time=00:01:28.99
bitrate=24037.9kbits/s dup=525 drop=0 speed=3.87x
video:256229kB audio:4867kB subtitle:0kB other streams:0kB global
headers:0kB muxing overhead: 0.013529%
[libx264 @ 0x55a167189c80] frame I:39    Avg QP: 0.00  size:164396
[libx264 @ 0x55a167189c80] frame P:2625  Avg QP: 0.00  size: 97511
[libx264 @ 0x55a167189c80] mb I  I16..4: 18.4% 20.8% 60.7%
[libx264 @ 0x55a167189c80] mb P  I16..4:  2.6% 16.3%  6.3%  P16..4: 31.5%
11.0%  8.8%  0.0%  0.0%    skip:23.5%
[libx264 @ 0x55a167189c80] 8x8 transform intra:62.3% inter:79.9%
[libx264 @ 0x55a167189c80] coded y,uvDC,uvAC intra: 99.2% 97.0% 97.0%
inter: 59.7% 55.0% 55.0%
[libx264 @ 0x55a167189c80] i16 v,h,dc,p: 46% 35% 18%  1%
[libx264 @ 0x55a167189c80] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 43% 38% 11%  1%
 1%  1%  1%  1%  2%
[libx264 @ 0x55a167189c80] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 37% 30% 13%  3%
 5%  3%  3%  3%  3%
[libx264 @ 0x55a167189c80] i8c dc,h,v,p: 17% 36% 44%  3%
[libx264 @ 0x55a167189c80] Weighted P-Frames: Y:5.7% UV:3.6%
[libx264 @ 0x55a167189c80] ref P L0: 62.0%  9.2% 18.1% 10.3%  0.3%
[libx264 @ 0x55a167189c80] kb/s:23613.21
-------------- next part --------------
A non-text attachment was scrubbed...
Name: original.jpg
Type: image/jpeg
Size: 194087 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-user/attachments/20230224/19c52b92/attachment.jpg>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: transcoded.jpg
Type: image/jpeg
Size: 208746 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-user/attachments/20230224/19c52b92/attachment-0001.jpg>


More information about the ffmpeg-user mailing list