I tried to use shrinkwrap to shrink some large video files from my iCloud library.
$ docker run -v /some/path:/vids bennetimo/shrinkwrap \
--input-extension mp4 --ffmpeg-opts crf=22,preset=fast /vids
20:04:45.230 [main] DEBUG shrinkwrap -
___ _ _ _
/ __| |_ _ _(_)_ _ | |____ __ ___ _ __ _ _ __
\__ \ ' \| '_| | ' \| / /\ V V / '_/ _` | '_ \
|___/_||_|_| |_|_||_|_\_\ \_/\_/|_| \__,_| .__/
|_|
20:04:45.234 [main] DEBUG shrinkwrap -
Using config:
Input Extension: mp4
Output Extension: mp4
Transcode Audio: true
Transcode Video: true
Backup Metadata: false
Metadata Suffix: -metadata
Overwrite Existing Transcodes: false
Transcoded Files Suffix: -tc
Using Shrinkwrap Preset: standard
FFMpeg Additional Options: -crf 22 -preset fast
Input: /vids
20:04:45.266 [main] DEBUG shrinkwrap - Shrinkwrapping file: /vids/IMG_0550.mp4 (1/2)
20:04:45.277 [main] DEBUG shrinkwrap - Executing cmd: List(/bin/sh, -c, ffmpeg -y -noautorotate -i "/vids/IMG_0550.mp4" -copy_unknown -map_metadata 0 -map 0 -codec copy -codec:v libx264 -pix_fmt yuv420p -codec:a libfdk_aac -vbr 4 -crf 22 -preset fast "/vids/IMG_0550-tc.mp4")
ffmpeg version 4.0.4 Copyright (c) 2000-2019 the FFmpeg developers
built with gcc 6.4.0 (Alpine 6.4.0)
configuration: --disable-debug --disable-doc --disable-ffplay --enable-shared --enable-avresample --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-gpl --enable-libass --enable-libfreetype --enable-libvidstab --enable-libmp3lame --enable-libopenjpeg --enable-libopus --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx265 --enable-libxvid --enable-libx264 --enable-nonfree --enable-openssl --enable-libfdk_aac --enable-libkvazaar --enable-libaom --extra-libs=-lpthread --enable-postproc --enable-small --enable-version3 --extra-cflags=-I/opt/ffmpeg/include --extra-ldflags=-L/opt/ffmpeg/lib --extra-libs=-ldl --prefix=/opt/ffmpeg
libavutil 56. 14.100 / 56. 14.100
libavcodec 58. 18.100 / 58. 18.100
libavformat 58. 12.100 / 58. 12.100
libavdevice 58. 3.100 / 58. 3.100
libavfilter 7. 16.100 / 7. 16.100
libavresample 4. 0. 0 / 4. 0. 0
libswscale 5. 1.100 / 5. 1.100
libswresample 3. 1.100 / 3. 1.100
libpostproc 55. 1.100 / 55. 1.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/vids/IMG_0550.mp4':
Metadata:
major_brand : mp42
minor_version : 0
compatible_brands: mp41isom
creation_time : 2015-10-25T02:36:25.000000Z
date : 2015-10-25T02:37:24Z
date-eng : 2015-10-25T02:37:24Z
Duration: 00:00:53.45, start: 0.000000, bitrate: 10609 kb/s
Stream #0:0(und): Video: h264 (avc1 / 0x31637661), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], 10504 kb/s, 30.01 fps, 30 tbr, 30k tbn, 60k tbc (default)
Metadata:
creation_time : 2015-10-25T02:36:25.000000Z
handler_name : VideoHandler
encoder : AVC Coding
Stream #0:1(und): Audio: aac (mp4a / 0x6134706D), 44100 Hz, mono, fltp, 98 kb/s (default)
Metadata:
creation_time : 2015-10-25T02:36:25.000000Z
handler_name : SoundHandler
Stream mapping:
Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
Stream #0:1 -> #0:1 (aac (native) -> aac (libfdk_aac))
Press [q] to stop, [?] for help
[libx264 @ 0x55a08cca8540] using SAR=1/1
[libx264 @ 0x55a08cca8540] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 AVX2 LZCNT BMI2
[libx264 @ 0x55a08cca8540] profile High, level 3.1
[libx264 @ 0x55a08cca8540] 264 - core 148 - H.264/MPEG-4 AVC codec - Copyleft 2003-2016 - http://www.videolan.org/x264.html - options: cabac=1 ref=2 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=6 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=1 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=30 rc=crf mbtree=1 crf=22.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
[libfdk_aac @ 0x55a08ccaa3c0] Note, the VBR setting is unsupported and only works with some parameter combinations
Output #0, mp4, to '/vids/IMG_0550-tc.mp4':
Metadata:
major_brand : mp42
minor_version : 0
compatible_brands: mp41isom
creation_time : 2015-10-25T02:36:25.000000Z
date : 2015-10-25T02:37:24Z
date-eng : 2015-10-25T02:37:24Z
encoder : Lavf58.12.100
Stream #0:0(und): Video: h264 (libx264) (avc1 / 0x31637661), yuv420p(progressive), 1280x720 [SAR 1:1 DAR 16:9], q=-1--1, 30 fps, 15360 tbn, 30 tbc (default)
Metadata:
creation_time : 2015-10-25T02:36:25.000000Z
handler_name : VideoHandler
encoder : Lavc58.18.100 libx264
Side data:
cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
Stream #0:1(und): Audio: aac (libfdk_aac) (mp4a / 0x6134706D), 44100 Hz, mono, s16 (default)
Metadata:
creation_time : 2015-10-25T02:36:25.000000Z
handler_name : SoundHandler
encoder : Lavc58.18.100 libfdk_aac
frame= 1605 fps= 24 q=-1.0 Lsize= 32893kB time=00:00:53.45 bitrate=5041.1kbits/s dup=1 drop=0 speed=0.785x
video:32310kB audio:510kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.221778%
[libx264 @ 0x55a08cca8540] frame I:11 Avg QP:21.40 size: 56477
[libx264 @ 0x55a08cca8540] frame P:446 Avg QP:23.86 size: 32012
[libx264 @ 0x55a08cca8540] frame B:1148 Avg QP:25.59 size: 15842
[libx264 @ 0x55a08cca8540] consecutive B-frames: 4.2% 0.4% 2.4% 93.0%
[libx264 @ 0x55a08cca8540] mb I I16..4: 14.7% 67.9% 17.4%
[libx264 @ 0x55a08cca8540] mb P I16..4: 4.6% 18.9% 2.2% P16..4: 45.5% 18.7% 8.6% 0.0% 0.0% skip: 1.5%
[libx264 @ 0x55a08cca8540] mb B I16..4: 4.1% 6.3% 0.2% B16..8: 36.3% 7.8% 0.2% direct:33.8% skip:11.3% L0:51.5% L1:41.7% BI: 6.7%
[libx264 @ 0x55a08cca8540] 8x8 transform intra:66.3% inter:56.3%
[libx264 @ 0x55a08cca8540] coded y,uvDC,uvAC intra: 53.9% 95.2% 78.7% inter: 19.7% 77.8% 36.4%
[libx264 @ 0x55a08cca8540] i16 v,h,dc,p: 23% 16% 24% 37%
[libx264 @ 0x55a08cca8540] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 15% 15% 24% 7% 9% 8% 9% 7% 6%
[libx264 @ 0x55a08cca8540] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 19% 17% 15% 6% 14% 8% 10% 6% 4%
[libx264 @ 0x55a08cca8540] i8c dc,h,v,p: 61% 18% 12% 9%
[libx264 @ 0x55a08cca8540] Weighted P-Frames: Y:5.8% UV:2.7%
[libx264 @ 0x55a08cca8540] ref P L0: 66.7% 33.3%
[libx264 @ 0x55a08cca8540] ref B L0: 87.8% 12.2%
[libx264 @ 0x55a08cca8540] ref B L1: 97.3% 2.7%
[libx264 @ 0x55a08cca8540] kb/s:4947.26
20:05:53.571 [main] DEBUG shrinkwrap - Executing cmd: List(/bin/sh, -c, exiftool -tagsfromfile "/vids/IMG_0550.mp4" -extractEmbedded -all:all \
-"*gps*" -time:all --FileAccessDate --FileInodeChangeDate -FileModifyDate \
-ext mp4 -overwrite_original "/vids/IMG_0550-tc.mp4")
0 image files updated
1 files weren't updated due to errors
Error: Not a valid MOV - /vids/IMG_0550-tc.mp4
20:05:54.361 [main] ERROR shrinkwrap - Encountered a problem. Exiting shrinkwrap for safety