Difference between revisions of "Ffmpeg"

From KeegansWiki
Jump to navigation Jump to search
 
Line 3: Line 3:
 
* ffmpeg-php must be compiled by source
 
* ffmpeg-php must be compiled by source
 
=Concatenate videos=
 
=Concatenate videos=
mpeg -i export_1.mp4 -i export_2.mp4 -i export_3.mp4 -i export_4.mp4 -filter_complex concat=n=4:v=1:a=0 -an output.mp4
+
ffmpeg -i export_1.mp4 -i export_2.mp4 -i export_3.mp4 -i export_4.mp4 -filter_complex concat=n=4:v=1:a=0 -an output.mp4
 
Note than n=v should be updated to match the proper count of videos. -an is for no audio
 
Note than n=v should be updated to match the proper count of videos. -an is for no audio
 +
 
=Creating Time Lapses=
 
=Creating Time Lapses=
 
== From images ==
 
== From images ==

Latest revision as of 15:50, 6 January 2018

Linux Installation

Concatenate videos

ffmpeg -i export_1.mp4 -i export_2.mp4 -i export_3.mp4 -i export_4.mp4 -filter_complex concat=n=4:v=1:a=0 -an output.mp4

Note than n=v should be updated to match the proper count of videos. -an is for no audio

Creating Time Lapses

From images

    ffmpeg -r 30 -i img_%04d.jpg -sameq -s hd720 -vcodec libx264 -vpre hq -crf 25 ./output_30fps.mp4

Taking frames from a video

    ffmpeg -i export_4_full.mp4  -vf select='not(mod(n\,1500))',setpts=N/FRAME_RATE/TB export_4.mp4


CLI Stuff

Mp3

Fade in and out

ffmpeg -i out.mp3 -af 'afade=t=in:ss=0:d=3,afade=t=out:st=129:d=7' promise_final.mp3

Trim size

ffmpeg -i promise.mp3 -ss 00:00:45 -t 00:02:16 ~/Desktop/out.mp3

Webm

HD, 14Mbps bitrate

ffmpeg -ss 01:18:02 -t 00:00:19 -i input.mkv -b:v 14M -c:v libvpx -an output.webm

Renaming Image Files Script

<?php
        $ducks = glob("*.jpg");

        $pref = "IMG_";
        $suf = ".jpg";

        $count = 0;
        foreach($ducks as $duck)
        {
                $cmd = "mv $duck $pref" . str_pad($count, 4, 0, STR_PAD_LEFT) . $suf;
                echo $cmd . "\n";
                #system($cmd);
                $count++;
        }
?>