<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-GB">
	<id>https://www.marcelpost.com/wiki/index.php?action=history&amp;feed=atom&amp;title=Ffmpeg-examples</id>
	<title>Ffmpeg-examples - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://www.marcelpost.com/wiki/index.php?action=history&amp;feed=atom&amp;title=Ffmpeg-examples"/>
	<link rel="alternate" type="text/html" href="https://www.marcelpost.com/wiki/index.php?title=Ffmpeg-examples&amp;action=history"/>
	<updated>2026-04-17T09:12:21Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.39.17</generator>
	<entry>
		<id>https://www.marcelpost.com/wiki/index.php?title=Ffmpeg-examples&amp;diff=3513&amp;oldid=prev</id>
		<title>Admin at 07:29, 17 August 2021</title>
		<link rel="alternate" type="text/html" href="https://www.marcelpost.com/wiki/index.php?title=Ffmpeg-examples&amp;diff=3513&amp;oldid=prev"/>
		<updated>2021-08-17T07:29:32Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;Bunch of ffmpeg examples on one page&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ffmpeg -y -i INFILE.mp4 -vcodec mpeg4 -vb 200k -acodec libvo_aacenc -ac 1 -ab 94000 -ar 16000 OUTFILE.mp4&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
ffmpeg -y -i INFILE.mp4 -c:v libx264 -crf 23  -vb 200k -c:a copy OUTFILE.mp4&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
truncate without re-encoding&lt;br /&gt;
&lt;br /&gt;
ffmpeg -y -i INFILE.mpg -ss mm:ss -t mm:ss -c copy OUTFILE.mp4&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
convert jpg images to video:&lt;br /&gt;
ffmpeg -r 1/0.1 -f concat   -i filelist.txt -r 25 -c:v libx264 -pix_fmt yuv420p -y  OUTFILE.mp4&lt;br /&gt;
(where filelist.txt contains the list of image file names, e.g. img001.jpg, img002.jpg)&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
ffmpeg -framerate 10  -pattern_type glob -i &amp;#039;*.jpg&amp;#039; -s 1280x720 -c:v libx264 -crf 23 out.avi&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Video bitrate:&lt;br /&gt;
  &lt;br /&gt;
   Rule of thumb: divide your target size (in bits) by the video length (in seconds)&lt;br /&gt;
   Example 1: for a 6 second video to be 10MBytes, use (10,000,000 / 6) = 1.6M&lt;br /&gt;
&lt;br /&gt;
       -vb 1600k&lt;br /&gt;
&lt;br /&gt;
   Example 2: for a 30 minute video to be 400MB, use (400,000,000 / 1,800) = 222,222 = 222k&lt;br /&gt;
 &lt;br /&gt;
       -vb 222k&lt;br /&gt;
&lt;br /&gt;
   Note: lower CRF (Constant Rate Factor) equals higher quality (and larger files)&lt;br /&gt;
   (max bitrate over wifi around 1Mbps)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Audio codecs and options:&lt;br /&gt;
&lt;br /&gt;
 -acodec libvo_aacenc -ac 1 -ab 94000 -ar 16000 &lt;br /&gt;
 -acodec aac -ac 2 -ab 128k&lt;br /&gt;
 -acodec copy&lt;br /&gt;
 -an&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Time selection:&lt;br /&gt;
&lt;br /&gt;
    -ss = start-time offset (0 = begin, 5:00 = after 5 minutes)&lt;br /&gt;
    -t  = duration (1:00 = one minute, 1:45:00 = 1 hour and 45 minutes)&lt;br /&gt;
&lt;br /&gt;
    -ss 2:23&lt;br /&gt;
    -ss 1:49 -t 1:58:02&lt;br /&gt;
    -t 2:15:06&lt;br /&gt;
&lt;br /&gt;
       for example, to remove the first 10 seconds of a 1.5 hour movie:&lt;br /&gt;
&lt;br /&gt;
            ffmpeg -i infile.mp4 -ss 0:10 -t 1:30:00 -c copy outfile.mp4&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Screen resolution:&lt;br /&gt;
&lt;br /&gt;
     -s 1280x720&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Resize and Crop options:&lt;br /&gt;
&lt;br /&gt;
   Resize: -vf scale=iw*2:ih&lt;br /&gt;
&lt;br /&gt;
      -vf &amp;quot;setsar=1/0.75&amp;quot; // Set the pixel sample aspect ratio.&lt;br /&gt;
      -vf &amp;quot;setdar=64:27&amp;quot;  // Set the frame display aspect ratio.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   Scale by percentage:&lt;br /&gt;
&lt;br /&gt;
      -vf scale=iw/2:-1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   Crop: -vf crop=&amp;lt;width&amp;gt;:&amp;lt;height&amp;gt;:&amp;lt;offset from left&amp;gt;:&amp;lt;offset from top&amp;gt;&lt;br /&gt;
&lt;br /&gt;
      -vf crop=680:440:300:50&lt;br /&gt;
&lt;br /&gt;
      example:&lt;br /&gt;
&lt;br /&gt;
         Remove black horizontal bars at the top and bottom.&lt;br /&gt;
&lt;br /&gt;
         The original video is 652x480 (width x height) but black bars only leave a useful video with an area of 652x326 pixels.&lt;br /&gt;
         Since the top and bottom bars are each 77 pixels in height, we offset the area by 77 pixels from the top.&lt;br /&gt;
&lt;br /&gt;
         ffmpeg -y -i inputfile.mp4 -vf crop=652:326:0:77 outfile.mp4&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Joining multiple videos:&lt;br /&gt;
&lt;br /&gt;
   - create a text file containing a list of the videos you wish to join&lt;br /&gt;
     Syntax: file &amp;lt;filename&amp;gt;&lt;br /&gt;
&lt;br /&gt;
     Example:&lt;br /&gt;
      &lt;br /&gt;
       file /path/to/file/video1.mp4&lt;br /&gt;
       file /path/to/file/video2.mp4&lt;br /&gt;
       file /path/to/file/video3.mp4&lt;br /&gt;
&lt;br /&gt;
   - join (concatenate) command:&lt;br /&gt;
&lt;br /&gt;
       ffmpeg -f concat -i myvideolist.txt -c copy allvideos.mp4&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   if you need to join multiple videos with differing bitrates/fps then you will need to re-encode them all to the same format first.&lt;br /&gt;
&lt;br /&gt;
       Something like:&lt;br /&gt;
&lt;br /&gt;
            ffmpeg -i video1.mp4 -filter:v fps=30 -vcodec libx264 -c:a copy video1_reencoded.mp4&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
keyframes:&lt;br /&gt;
&lt;br /&gt;
      -force_key_frames 1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Admin</name></author>
	</entry>
</feed>