On Sat, 19 Oct 2024 06:44:36 -0400, Paul <
nospam@needed.invalid> wrote
ffmpeg -i input.mp4 -vf deshake output.mp4
Check the resolution of the input video, versus that
of the output video.
That worked well enough. Thanks. I'll use that to clean up video shaking.
It's easy to do, but it increased the size of the video by a third.
But the resolution was fine, visually (see details below).
The main negative is there was a slight artifact of an angled line in the
bottom of the output video that seems to have been introduced by ffmpeg.
I only did it once though, and on a relatively large 1-1/2 hour long video:
ffmpeg -i input.mp4 -vf deshake output.mp4
where here are the before and after file sizes:
10/18/2024 06:39 PM 270,732,733 input.mp4
10/19/2024 12:12 PM 347,497,221 output.mp4
The resulting visual resolution looked just fine to me, so other than the
strange artifact (which could be data related for all I know as I only ran
this single test before thanking you), it was a win because it's so easy.
Looking at the details inside of Media Info, input.mp4 is reported as
First video stream 313kb/s, 788*444 (16:9) at 25,000 FPS, AVC (
High@L3)(CABAC / 5 Ref Frames)
First audio stream 61.1 kb/s, 44.1 kHz, 1 channel, AAC LC
Where output.mp4 is only slightly different in MediaInfo reports as
First video stream 416kb/s, 788*444 (16:9) at 25,000 FPS, AVC (
High@L3)(CABAC / 4 Ref Frames)
First audio stream 66.2 kb/s, 44.1 kHz, 1 channel, AAC LC
EVERYTHING BELOW IS THE FFMPEG LOG OUTPUT
ffmpeg -i input.mp4 -vf deshake output.mp4
ffmpeg version 4.2.3 Copyright (c) 2000-2020 the FFmpeg developers
built with gcc 9.3.1 (GCC) 20200523
configuration: --enable-gpl --enable-version3 --enable-sdl2
--enable-fontconfig --enable-gnutls --enable-iconv --enable-libass
--enable-libdav1d --enable-libbluray --enable-libfreetype
--enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb
--enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy
--enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx
--enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265
--enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp
--enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc
--enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom
--enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid
--enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2
--enable-avisynth --enable-libopenmpt
libavutil 56. 31.100 / 56. 31.100
libavcodec 58. 54.100 / 58. 54.100
libavformat 58. 29.100 / 58. 29.100
libavdevice 58. 8.100 / 58. 8.100
libavfilter 7. 57.100 / 7. 57.100
libswscale 5. 5.100 / 5. 5.100
libswresample 3. 5.100 / 3. 5.100
libpostproc 55. 5.100 / 55. 5.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'input.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf58.12.100
Duration: 01:34:44.25, start: 0.000000, bitrate: 381 kb/s
Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p,
788x444, 313 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc (default)
Metadata:
handler_name : VideoHandler
Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, mono,
fltp, 61 kb/s (default)
Metadata:
handler_name : SoundHandler
Stream mapping:
Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
Stream #0:1 -> #0:1 (aac (native) -> aac (native))
Press [q] to stop, [?] for help
[libx264 @ 0000023bbadce0c0] using cpu capabilities: MMX2 SSE2Fast LZCNT
[libx264 @ 0000023bbadce0c0] profile High, level 3.0, 4:2:0, 8-bit
[libx264 @ 0000023bbadce0c0] 264 - core 160 - H.264/MPEG-4 AVC codec -
Copyleft 2003-2020 -
http://www.videolan.org/x264.html - options: cabac=1
ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00
mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11
fast_pskip=1 chroma_qp_offset=-2 threads=6 lookahead_threads=1
sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0
constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1
weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40
intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0
qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to 'output.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf58.29.100
Stream #0:0(und): Video: h264 (libx264) (avc1 / 0x31637661), yuv420p,
788x444, q=-1--1, 25 fps, 12800 tbn, 25 tbc (default)
Metadata:
handler_name : VideoHandler
encoder : Lavc58.54.100 libx264
Side data:
cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, mono,
fltp, 69 kb/s (default)
Metadata:
handler_name : SoundHandler
encoder : Lavc58.54.100 aac
frame=142105 fps= 25 q=-1.0 Lsize= 339348kB time=01:34:44.22 bitrate=
489.1kbits/s speed=1.02x
video:288672kB audio:46031kB subtitle:0kB other streams:0kB global
headers:0kB muxing overhead: 1.387617%
[libx264 @ 0000023bbadce0c0] frame I:904 Avg QP:18.54 size: 15601
[libx264 @ 0000023bbadce0c0] frame P:49446 Avg QP:20.64 size: 3873
[libx264 @ 0000023bbadce0c0] frame B:91755 Avg QP:25.71 size: 981
[libx264 @ 0000023bbadce0c0] consecutive B-frames: 1.5% 36.5% 2.5% 59.6%
[libx264 @ 0000023bbadce0c0] mb I I16..4: 18.8% 70.8% 10.3%
[libx264 @ 0000023bbadce0c0] mb P I16..4: 3.4% 6.8% 0.4% P16..4: 39.9%
10.1% 3.7% 0.0% 0.0% skip:35.7%
[libx264 @ 0000023bbadce0c0] mb B I16..4: 0.3% 0.5% 0.0% B16..8: 29.7%
2.3% 0.2% direct: 0.6% skip:66.4% L0:39.2% L1:58.6% BI: 2.2%
[libx264 @ 0000023bbadce0c0] 8x8 transform intra:64.2% inter:83.1%
[libx264 @ 0000023bbadce0c0] coded y,uvDC,uvAC intra: 35.0% 60.9% 13.1%
inter: 5.7% 12.1% 0.1%
[libx264 @ 0000023bbadce0c0] i16 v,h,dc,p: 23% 25% 8% 43%
[libx264 @ 0000023bbadce0c0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 23% 20% 25% 4%
6% 6% 6% 6% 5%
[libx264 @ 0000023bbadce0c0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 24% 27% 15% 4%
8% 7% 8% 5% 4%
[libx264 @ 0000023bbadce0c0] i8c dc,h,v,p: 54% 21% 18% 7%
[libx264 @ 0000023bbadce0c0] Weighted P-Frames: Y:2.3% UV:0.4%
[libx264 @ 0000023bbadce0c0] ref P L0: 70.1% 10.3% 14.7% 4.8% 0.1%
[libx264 @ 0000023bbadce0c0] ref B L0: 91.9% 6.8% 1.3%
[libx264 @ 0000023bbadce0c0] ref B L1: 97.6% 2.4%
[libx264 @ 0000023bbadce0c0] kb/s:416.03
[aac @ 0000023bbadcfc00] Qavg: 3536.932