Last active
January 19, 2023 10:56
ffmpeg cookbook
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# rotate | |
ffmpeg -i input.mp4 -map_metadata 0 -c copy -metadata:s:v rotate="180" output.mp4 | |
# extract subs from mp4 | |
# https://superuser.com/questions/393762/how-to-extract-subtitles-from-mp4-and-mkv-movies | |
ffmpeg -i video.mp4 subtitle.srt | |
# convert audio (using vbr) | |
ffmpeg -i input.mkv -c:a libopus -b:a 256k -vbr 1 -af "channelmap=channel_layout=5.1" output.mkv | |
# use still image instead of video and convert audio | |
ffmpeg -loop 1 -i image.jpg -i input.mkv -c:v libx264 -tune stillimage -c:a libopus -b:a 256k -pix_fmt yuv420p -shortest output.mkv | |
# Speeding up/slowing down audio | |
# You can speed up or slow down audio with the atempo audio filter. To double the speed of audio: | |
ffmpeg -i input.mkv -filter:a "atempo=2.0" -vn output.mkv | |
# Change audio speed converting to opus 256k | |
ffmpeg -i input.mkv -c:a libopus -b:a 256k -af "channelmap=channel_layout=5.1, atempo=2.0" -vn output.mkv | |
# convert tempo from 25fps to 23.976fps (23,976/25 = 0,95904) | |
# [optional] convert with codec Opus, 224kbps VBR, 5.1 channels | |
ffmpeg -i input.mkv -c:a libopus -b:a 224k -vbr 1 -af "channelmap=channel_layout=5.1,rubberband=tempo=0.95904" -vn out.mkv |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment