Last active
December 7, 2023 10:03
-
-
Save Integralist/dc05d8b18c8d793ad347f92623075535 to your computer and use it in GitHub Desktop.
[ffmpeg examples] #ffmpeg #crop #video #concat #split #resize
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
# see the individual 'extract' and 'concat' examples below to understand this 'one liner' version. | |
ffmpeg -i 1989.02.20\ -\ Chi-Town\ Rumble\ 1989.mp4 -to 00:00:30 1.mp4 -ss 00:02:53 -to 00:05:07 2.mp4 -ss 00:26:53 -to 00:47:55 3.mp4 -ss 01:10:04 -to 01:11:46 4.mp4 -ss 01:29:09 -to 01:42:13 5.mp4 -ss 01:43:53 6.mp4 && printf "file '1.mp4'\nfile '2.mp4'\nfile '3.mp4'\nfile '4.mp4'\nfile '5.mp4'\nfile '6.mp4'" > concat.txt && ffmpeg -f concat -safe 0 -i concat.txt -c copy 1989.02.20\ -\ Chi-Town\ Rumble\ 1989--new.mp4 && rm {1,2,3,4,5,6}.mp4 && rm concat.txt && say all done |
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
# https://ffmpeg.org/ffmpeg-formats.html#concat-1 | |
cat mylist.txt | |
file '/path/to/file1' | |
file '/path/to/file2' | |
file '/path/to/file3' | |
ffmpeg -f concat -safe 0 -i mylist.txt -c copy output.mp4 |
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
ffmpeg -i 2019-hack-week-vol1.mp4 -ss 00:05:36 -t 00:11:18 -async 1 cut.mp4 | |
# note: -t represents the duration you want the new video crop to last for | |
# | |
# we can also use -to to specify a specific finish time (which is much more practical to use) | |
# $ ffmpeg -i foo.mp4 -ss 00:26:42 -to 00:32:11 -async 1 cut.mp4 |
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
# https://superuser.com/questions/681885/how-can-i-remove-multiple-segments-from-a-video-using-ffmpeg | |
# | |
# the following command will generate three new videos (a.tvshow, c.tvshow, e.tvshow) from the single abcdef.tvshow | |
# | |
# we can then use the `concat` filter (shown earlier) to rejoin them together. | |
ffmpeg -i abcdef.tvshow -t 5 a.tvshow -ss 10 -t 5 c.tvshow -ss 20 -t 5 e.tvshow |
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
ffmpeg -i example.mov -vf "scale=2200:-1" resized.mov |
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
# https://unix.stackexchange.com/questions/1670/how-can-i-use-ffmpeg-to-split-mpeg-video-into-10-minute-chunks | |
# | |
ffmpeg -i input.mp4 -c copy -map 0 -segment_time 00:20:00 -f segment -reset_timestamps 1 output%03d.mp4 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment