Difference between revisions of "Ffmpeg"

From Colettapedia
Jump to navigation Jump to search
Line 1: Line 1:
 +
 +
 +
== My Home Video Conversion Pipeline example==
 +
 +
# <code> ffmpeg -ss 1:23:40 -to 1:26:05 -i Coletta-Tape03.avi -vf yadif -crf 12 temp1.mp4 </code>
 +
# <code> python3 -m vidstab -i temp1.mp4 -o temp1_stab.mp4 </code> - also set num frames for stability using -s 10 and drop edges using -z 10
 +
# <code> ffmpeg -i temp1_stab.mp4 -vf "setpts=N/29.97/TB,fps=29.97" -r 29.97 -crf 12 temp1_stab_30fps.mp4 </code>
 +
# <code> ffmpeg -i temp1_stab_30fps.mp4 -i 1992_Gaeta_Christmas_Eve.mp4 -shortest -c:v copy -map 0:v:0 -map 1:a:0 FINAL.mp4 </code>
 +
 +
== Pull in images as frames Example ==
 +
* <code> ffmpeg -i ./%04d.png -c:v libx264 -vf "format=yuv420p" -crf 12 output.mp4 </code>
 +
 
==H.264 encoding==
 
==H.264 encoding==
* Also set resolution and bitrate all at the same time:
+
* <code> ffmpeg -i VID_20160918_113318088.mp4 -vprofile high -codec:v libx264 -preset slow -b:v 2500k -maxrate 2500k -bufsize 5000k -vf scale=-2:720 -threads 0 -codec:a aac -b:a 128k ../HD_size/VID_20160918_113318088_720.mp4</code>
<pre>ffmpeg -i VID_20160918_113318088.mp4 -vprofile high -codec:v libx264 -preset slow -b:v 2500k -maxrate 2500k -bufsize 5000k -vf scale=-2:720 -threads 0 -codec:a aac -b:a 128k ../HD_size/VID_20160918_113318088_720.mp4</pre>
+
** Set resolution and bitrate all at the same time
* <pre> ffmpeg -r 1 -i img%01d.png -vcodec mpeg4 -y movie.mp4</pre>
+
* <code> ffmpeg -r 1 -i img%01d.png -vcodec mpeg4 -y movie.mp4</code>
 
** fps is defined with the "-r" bit - so "-r 1" would be 1 fps, "-r 30" would be 30, etc.
 
** fps is defined with the "-r" bit - so "-r 1" would be 1 fps, "-r 30" would be 30, etc.

Revision as of 15:51, 20 February 2021


My Home Video Conversion Pipeline example

  1. ffmpeg -ss 1:23:40 -to 1:26:05 -i Coletta-Tape03.avi -vf yadif -crf 12 temp1.mp4
  2. python3 -m vidstab -i temp1.mp4 -o temp1_stab.mp4 - also set num frames for stability using -s 10 and drop edges using -z 10
  3. ffmpeg -i temp1_stab.mp4 -vf "setpts=N/29.97/TB,fps=29.97" -r 29.97 -crf 12 temp1_stab_30fps.mp4
  4. ffmpeg -i temp1_stab_30fps.mp4 -i 1992_Gaeta_Christmas_Eve.mp4 -shortest -c:v copy -map 0:v:0 -map 1:a:0 FINAL.mp4

Pull in images as frames Example

  • ffmpeg -i ./%04d.png -c:v libx264 -vf "format=yuv420p" -crf 12 output.mp4

H.264 encoding

  • ffmpeg -i VID_20160918_113318088.mp4 -vprofile high -codec:v libx264 -preset slow -b:v 2500k -maxrate 2500k -bufsize 5000k -vf scale=-2:720 -threads 0 -codec:a aac -b:a 128k ../HD_size/VID_20160918_113318088_720.mp4
    • Set resolution and bitrate all at the same time
  • ffmpeg -r 1 -i img%01d.png -vcodec mpeg4 -y movie.mp4
    • fps is defined with the "-r" bit - so "-r 1" would be 1 fps, "-r 30" would be 30, etc.