Some ffmpeg commands I often use

It is easy to install the ffmpeg command on the system. For opensuse, just open a terminal and type sudo zypper in ffmpeg.

Here are some ffmpeg commands I often use:

1. ffmpeg -i a.mkv a.mp4 //Re-encode and pack a.mkv into a.mp4.

2. ffmpeg -i a.mkv -c copy a.mp4 //Directly encapsulate a.mp4 without re-encoding a.mkv.

3. ffmpeg -ss 00:00:00 -i a.mkv -c copy -t 600 a.mp4 //Capture the first 600 seconds of a.mkv and package them into a new a.mp4 file.

4. ffmpeg -i a.ts -c copy -map 0 -f segment -segment_list playlist.m3u8 -segment_time 10 a%03d.ts//Slice a.ts and generate playlist.m3u8 file, 10 seconds a slice.

5. ffmpeg -v 5 -y -i 1.m4a -acodec libmp3lame -ac 2 -ab 192k 1.mp3 //Change m4a file to mp3 file.

6. ffmpeg -i video.avi -vf subtitles=subtitle.srt out.avi or ffmpeg -i video.avi -vf "ass=subtitle.ass" out.avi // Burn sub into videos. add -threads 4 -preset ultrafast to the command to the fast version.

7. ffmpeg -i music.mp4 -vn -acodec pcm_s16le -ar 44100 -ac 2 music.wav //Extract wav from mp4.