Differences

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

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Next revisionBoth sides next revision
ffmpeg_notes [2019-08-02 14:06] nikffmpeg_notes [2021-06-19 07:31] – [image sequence → video] nik
Line 1: Line 1:
 ==== Ffmpeg - various notes ==== ==== Ffmpeg - various notes ====
 +
 +==== add audio track to a video ====
 +
 +''ffmpeg -i input.mkv -i audio.mp3 -c copy output.mkv''
 +
 +====extract audio from mp4 as mp3====
 +
 +''ffmpeg -i input.mp4 -b:a 320K -vn output-audio.mp3''
 +
 +====avoid audio/video reencode====
 +
 +options '-c:a copy' and '-c:v copy'
  
 ====slo-mo video transcode (e.g. iphone)==== ====slo-mo video transcode (e.g. iphone)====
Line 11: Line 23:
 ''for file in `/bin/ls -1`; do ffmpeg -i $file -filter "setpts=6.0*PTS" -r 30 -an $file.30fps.mp4 ; done'' ''for file in `/bin/ls -1`; do ffmpeg -i $file -filter "setpts=6.0*PTS" -r 30 -an $file.30fps.mp4 ; done''
  
-====video -> image sequence====+====video → image sequence====
  
 ...timelapsed (1 frame every 4 seconds) ...timelapsed (1 frame every 4 seconds)
  
 ''ffmpeg -i IMG_4566.MOV -r 0.25 IMG_4566_seq/output_%05d.png'' ''ffmpeg -i IMG_4566.MOV -r 0.25 IMG_4566_seq/output_%05d.png''
 +
 +====image sequence  → video====
 +
 +''ffmpeg -i %05d.jpg -c:v libx265 -r 25 out.mkv''
 +==== concat ====
 +
 +a list of files (e.g. named files.txt)\\
 +''file 'dust_and_shadow_28min.mp4' ''\\
 +''file 'dust_and_shadow_black.mp4' ''\\
 +
 +then...\\
 +''ffmpeg -f concat -i files.txt -c copy dust_and_shadow_30min.mp4''
 +
 +also -> https://stackoverflow.com/questions/7333232/how-to-concatenate-two-mp4-files-using-ffmpeg
  
 ====ffmpeg filters  ==== ====ffmpeg filters  ====
Line 133: Line 159:
 ''ffmpeg -i clip.mov -i clip2.mov  -filter_complex vstack merged.mov'' ''ffmpeg -i clip.mov -i clip2.mov  -filter_complex vstack merged.mov''
  
- 
-====avoid audio/video reencode==== 
- 
-options '-c:a copy' and '-c:v copy' 
  
 ====blending=== ====blending===
Line 144: Line 166:
  
 ====etc==== ====etc====
 +  * tuning x265 output -> http://forum.doom9.org/showthread.php?t=172458
   * further examples -> https://hhsprings.bitbucket.io/docs/programming/examples/ffmpeg/index.html   * further examples -> https://hhsprings.bitbucket.io/docs/programming/examples/ffmpeg/index.html
   * An ffmpeg and SDL Tutorial or How to Write a Video Player in Less Than 1000 Lines (2015) http://dranger.com/ffmpeg/   * An ffmpeg and SDL Tutorial or How to Write a Video Player in Less Than 1000 Lines (2015) http://dranger.com/ffmpeg/
   * various examples -> https://oioiiooixiii.blogspot.com/   * various examples -> https://oioiiooixiii.blogspot.com/
  
  • ffmpeg_notes.txt
  • Last modified: 2023-08-27 12:27
  • by nik