{"id":1816,"date":"2022-05-31T05:31:44","date_gmt":"2022-05-30T21:31:44","guid":{"rendered":"https:\/\/rogen.us\/what-are-some-ffmpeg-commands-i-often-use\/"},"modified":"2022-05-31T05:31:44","modified_gmt":"2022-05-30T21:31:44","slug":"what-are-some-ffmpeg-commands-i-often-use","status":"publish","type":"post","link":"https:\/\/rogen.us\/en\/what-are-some-ffmpeg-commands-i-often-use\/","title":{"rendered":"Some ffmpeg commands I often use"},"content":{"rendered":"<p><![CDATA[\n\n<p>It is easy to install the ffmpeg command on the system. For opensuse, just open a terminal and type <code>sudo zypper in ffmpeg<\/code>.<\/p>\n\n\n\n\n\n<p>Here are some ffmpeg commands I often use:<\/p>\n\n\n\n\n\n<p><em>1.<\/em> <code>ffmpeg -i a.mkv a.mp4<\/code>  \/\/Re-encode and pack a.mkv into a.mp4.<\/p>\n\n\n\n\n\n<p><em>2.<\/em> <code>ffmpeg -i a.mkv -c copy a.mp4<\/code> \/\/Directly encapsulate a.mp4 without re-encoding a.mkv.<\/p>\n\n\n\n\n\n<p><em>3.<\/em> <code>ffmpeg -ss 00:00:00 -i a.mkv -c copy -t 600 a.mp4<\/code> \/\/Capture the first 600 seconds of a.mkv and package them into a new a.mp4 file.<\/p>\n\n\n\n\n\n<p><em>4.<\/em> <code>ffmpeg -i a.ts -c copy -map 0 -f segment -segment_list playlist.m3u8 -segment_time 10 a%03d.ts<\/code>\/\/Slice a.ts and generate playlist.m3u8 file, 10 seconds a slice.<\/p>\n\n\n\n\n\n<p><em>5.<\/em> <code>ffmpeg -v 5 -y -i 1.m4a -acodec libmp3lame -ac 2 -ab 192k 1.mp3<\/code> \/\/Change m4a file to mp3 file.<\/p>\n\n\n\n\n\n<p><em>6.<\/em> <code>ffmpeg -i video.avi -vf subtitles=subtitle.srt out.avi<\/code> or <code>ffmpeg -i video.avi -vf \"ass=subtitle.ass\" out.avi<\/code> \/\/ Burn sub into videos. add <code>-threads 4 -preset ultrafast<\/code> to the command to the fast version.<\/p>\n\n\n\n\n\n<p><em>7.<\/em> <code>ffmpeg -i music.mp4 -vn -acodec pcm_s16le -ar 44100 -ac 2 music.wav<\/code> \/\/Extract wav from mp4.<\/p>\n\n]]><\/p>\n","protected":false},"excerpt":{"rendered":"<p>It is easy to ins&#8230;<\/p>","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[250],"tags":[],"class_list":["post-1816","post","type-post","status-publish","format-standard","hentry","category-coding-notes","wpcat-250-id"],"views":90,"_links":{"self":[{"href":"https:\/\/rogen.us\/en\/wp-json\/wp\/v2\/posts\/1816","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/rogen.us\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/rogen.us\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/rogen.us\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/rogen.us\/en\/wp-json\/wp\/v2\/comments?post=1816"}],"version-history":[{"count":0,"href":"https:\/\/rogen.us\/en\/wp-json\/wp\/v2\/posts\/1816\/revisions"}],"wp:attachment":[{"href":"https:\/\/rogen.us\/en\/wp-json\/wp\/v2\/media?parent=1816"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/rogen.us\/en\/wp-json\/wp\/v2\/categories?post=1816"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/rogen.us\/en\/wp-json\/wp\/v2\/tags?post=1816"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}