appwiki:ffmpeg

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
appwiki:ffmpeg [2021/06/18 19:12] – created yingappwiki:ffmpeg [2022/12/07 07:21] (current) – [Common Convertion] ying
Line 1: Line 1:
-====== REF ====== 
-  * https://ottverse.com/trim-cut-video-using-start-endtime-reencoding-ffmpeg/ 
  
 ====== FFmpeg - the core command app of open source transcoder ====== ====== FFmpeg - the core command app of open source transcoder ======
Line 52: Line 50:
 ffmpeg.exe -i "d:\out\me.mpg" -c:v libx264 -c:a libfaac -crf 20 -preset:v veryslow "d:\out\me_out.mov" ffmpeg.exe -i "d:\out\me.mpg" -c:v libx264 -c:a libfaac -crf 20 -preset:v veryslow "d:\out\me_out.mov"
 </code> </code>
 +
 +  * copy portion of video <code>
 +# about -ss before -i and after -i  difference, which can make cut video works or not works
 +# ref: https://ottverse.com/trim-cut-video-using-start-endtime-reencoding-ffmpeg/
 +
 +ffmpeg.exe -i video.mp4 -c copy -ss 00:00:09 -to 00:00:21 video_cut.mp4
 +
 +# -ss in front means: start time (from 9s), duration time (21s)
 +ffmpeg.exe -ss 00:00:09 -i video.mp4 -c copy -to 00:00:21 video_cut.mp4
 +</code>
 +  * combine list of videos into 1 video
 +    * ref: https://stackoverflow.com/questions/7333232/how-to-concatenate-two-mp4-files-using-ffmpeg
 +
 +  * gif maker <code>
 +ffmpeg -i input.mp4 -vf "fps=10,scale=640:-1:flags=lanczos,split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse" -loop 0 output.gif
 +</code>
 +
 +  * 2x2 stack <code>
 +#ref: https://ottverse.com/stack-videos-horizontally-vertically-grid-with-ffmpeg/
 +ffmpeg -i input0.mp4 -i input1.mp4 -i input2.mp4 -i input3.mp4 -filter_complex "[0:v][1:v]hstack=inputs=2[top]; [2:v][3:v]hstack=inputs=2[bottom]; [top][bottom]vstack=inputs=2[v]" -map "[v]" finalOutput.mp4
 +</code>
 +
 +  * image to square size (like convert image to texture size format) <code>
 +ffmpeg -i image.jpg -vf "scale=1024:1024:force_original_aspect_ratio=decrease,pad=1024:1024:-1:-1:color=white" -q:v 1 tex_image.jpg
 +
 +# longest side, so basically original size with padding to square
 +ffmpeg -i image.jpg -vf "scale=max(iw\,ih):max(iw\,ih):force_original_aspect_ratio=decrease,pad=max(iw\,ih):max(iw\,ih):-1:-1:color=white" -q:v 1 tex_image.jpg
 +</code>
 +
 +====== GIF related ======
 +
 +  * use every 1 from out of 10 frame from a huge frame-by-frame gif recording, and save as a 600px width gif <code dos>
 +ffmpeg.exe -i big_recording.gif -vf "select=not(mod(n-1\,10)),scale=600:-1" -vsync vfr light_10th_600w.gif
 +</code>
 +
 +
  • appwiki/ffmpeg.1624043550.txt.gz
  • Last modified: 2021/06/18 19:12
  • by ying