Skip to content

Instantly share code, notes, and snippets.

@benigumocom
Last active December 15, 2020 06:32
動画ファイル軽量化 ffmpeg
ffmpeg -i PXL_20201207_213255197.mp4 -c:v libx265 -filter:v "setpts=0.1*PTS" out.mp4
# -filter:v "setpts=0.1*PTS" - 10倍速
ffmpeg -i input.mp4 -c:a copy -c:v libx265 -tag:v hvc1 output_265.mp4
# -c:a copy - 音声そのままコピー
# -tag:v hvc1 - Apple互換
ffmpeg -i input.mp4 -c:v libaom-av1 -crf 30 -b:v 0 -strict experimental output_av1.mp4
# 遅すぎて完了したことがない
# Note: AV1 encoding is very slow in comparison to VP9 or H.264, and considered experimental at this stage.
# Hence the use of -strict experimental (or the alias -strict -2) is necessary.
# To trigger this mode, you must use a combination of -crf and -b:v 0. -b:v MUST be 0.
# https://trac.ffmpeg.org/wiki/Encode/AV1
ffprobe -hide_banner input.mp4
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'PXL_20201213_213259178_reduced.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2mp41
encoder : Lavf58.45.100
Duration: 00:08:04.93, start: 0.000000, bitrate: 1323 kb/s
Stream #0:0(eng): Video: hevc (Main) (hvc1 / 0x31637668), yuvj420p(pc, progressive), 1920x1080 [SAR 1:1 DAR 16:9], 1123 kb/s, 29.83 fps, 29.83 tbr, 11456 tbn, 29.83 tbc (default)
Metadata:
handler_name : VideoHandle
Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 191 kb/s (default)
Metadata:
handler_name : SoundHandle
# hevc = H.265 - Wikipedia https://ja.wikipedia.org/wiki/H.265
@benigumocom
Copy link
Author

【Google フォト対策】ffmpeg で動画軽量化
https://android.benigumo.com/20201215/google-photo-ffmpeg/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment