various FFMPEG command lines

1 minute read Published: 2021-07-24

A selection of various command lines for #ffmpeg that I either found online and used and adapted somehow or built myself

rotate iPhone Videos according to their metadata, requires reencoding the video

ffmpeg -i "$v" -movflags use_metadata_tags -c copy -c:v h264 -profile:v high -b:v 16000k "${v%.*}.new.mov"

convert animation videos 10bit to 8bit encoding, so that a raspberry pi can play it

ffmpeg -i abc.mkv -map 0 -c copy -c:v libx264 -profile baseline -tune animation -crf 18 'abc-recode.mkv'

cut and crop

ffmpeg -i stream.mpg -ss 3138 -t 4.0 -y -map v:0 -map a:0 -filter:v 'crop=245:203:924:305' -c:a ac3 -b:a 151k -c:v h264 -b:v 3500k -r 30 boso-3rd-assistant.mkv

cut file into multiple segments according to time (1h)

ffmpeg -i input.mp4 -c copy -map 0 -segment_time 01:00:00 -f segment -reset_timestamps 1 output-%03d.mp4

Encode *.wav to *.flac but copy metadata from *.mp3 files with the same name

for X in *.wav ; do ffmpeg -i "${X%.wav}.mp3" -i "$X" -map_metadata 0 -map 1 -c:a flac "${X%.wav}.flac" ; done