-
Notifications
You must be signed in to change notification settings - Fork 347
/
ffmpeg
43 lines (32 loc) · 1.47 KB
/
ffmpeg
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# To print file metadata:
ffmpeg -i <file>
# To convert all m4a files to mp3
for f in *.m4a; do ffmpeg -i "$f" -acodec libmp3lame -vn -b:a 320k "${f%.m4a}.mp3"; done
# To convert video from .foo to .bar
# -g : GOP, for searchability
ffmpeg -i input.foo -vcodec bar -acodec baz -b:v 21000k -b:a 320k -g 150 -threads 4 output.bar
# To convert image sequence to video:
ffmpeg -r 18 -pattern_type glob -i '*.png' -b:v 21000k -s hd1080 -vcodec vp9 -an -pix_fmt yuv420p -deinterlace output.ext
# To combine video and audio into one file
ffmpeg -i video.ext -i audio.ext -c:v copy -c:a copy output.ext
# To add ass subtitle to the video
ffmpeg -i input_video.mp4 -vf ass=sub.ass output_video_subtitles.mp4
# To convert webm to mp4
ffmpeg -i input_video.webm output_video.mp4
# To convert mp4 to mov
ffmpeg -i input_video.mp4 -acodec copy -vcodec copy -f mov output_video.mov
# To convert mov to mp4
ffmpeg -i input_video.mov -vcodec copy -acodec copy output_video.mp4
# Listen to 10 seconds of audio from a video file
#
# -ss : start time
# -t : seconds to cut
# -autoexit : closes ffplay as soon as the audio finishes
ffmpeg -ss 00:34:24.85 -t 10 -i path/to/file.mp4 -f mp3 pipe:play | ffplay -i pipe:play -autoexit
# To combine audio and video from N files:
# See also https://stackoverflow.com/questions/7333232/how-to-concatenate-two-mp4-files-using-ffmpeg
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