- FFMpeg est un outil en ligne de commande, très puissant pour manipuler des fichiers vidéo mais « arride » en treme d’utilisation.
- https://www.ffmpeg.org/documentation.html
- Extraire une fraction d »une vidéo
- sous DOS : Version 20150322
cd C:\Program Files\ffmpeg-20150322-git-aa65ff2-win64-static\
ff-prompt.bat -
ffmpeg -ss 00:10:00 -t 00:15:00 -i fichierentre.avi fichiersortie.avi
- coupe la vidéo en une vidéo de 15 minutes débutant à la 10ème minute
(extrait de vidéo allant de 00:10:00 à 00:25:00) -
(quelques) Options :
- -i => fichier d’entré
- -ss => (input/output) position de départ : soit en secondes soit au format hh:mm:ss
- -t => (input) durée (prioritaire sur -to)
- -to =>(output) position de fin sur video de sortie => si première séquence durée = position de fin donc -t = -to : soit en secondes soit au format hh:mm:ss
- Changer la résolution :
-
ffmpeg -i C:\Users\Yves\Videos\SCOOP\input1.MOV -s 160x120 C:\Users\Yves\Videos\SCOOP\output1.mpeg ffmpeg -i C:\Users\Yves\Videos\SCOOP\input2.MOV -s 160x120 C:\Users\Yves\Videos\SCOOP\output2.mpeg
-
- Rotation :
-
ffmpeg -i C:\Users\Yves\Videos\SCOOP\input3.mp4 -vf "rotate=180" C:\Users\Yves\Videos\SCOOP\output.mp4
-
-
Test :
- ffmpeg -ss 00:10:00 -t 00:15:00 -i C:\tmp\fichierentre.mp4 C:\tmp\fichiersortie.mp4 => OK
- ffmpeg -ss 00:10:00 -i C:\tmp\fichierentre.mp4 -to 00:05:00 C:\tmp\fichiersortie.mp4
- ffmpeg -ss 00:00:39 -i C:\tmp\fichierentre.mp4 -to 00:42:15 C:\tmp\fichiersortie.mp4
- ffmpeg -ss 00:00:48 -i C:\tmp\fichierentre.avi -to 00:5:10 C:\tmp\fichiersortie.avi
- ffmpeg -i C:\tmp\fichierentre.avi C:\tmp\fichiersortie.mp4
-
19 commandes indispensables :
- ffmpeg is a multiplatform, open-source library for video and audio files. I have compiled 19 useful and amazing commands covering almost all needs: video conversion, sound extraction, encoding file for iPod or PSP, and more.
-
Getting infos from a video file
- ffmpeg -i video.avi
-
Turn X images to a video sequence
- ffmpeg -f image2 -i image%d.jpg video.mpg
- This command will transform all the images from the current directory (named image1.jpg, image2.jpg, etc…) to a video file named video.mpg.
-
Turn a video to X images
- ffmpeg -i video.mpg image%d.jpg
- This command will generate the files named image1.jpg, image2.jpg, …The following image formats are also availables : PGM, PPM, PAM, PGMYUV, JPEG, GIF, PNG, TIFF, SGI.
-
Encode a video sequence for the iPpod/iPhone
- ffmpeg -i source_video.avi input -acodec aac -ab 128kb -vcodec mpeg4 -b 1200kb -mbd 2 -flags +4mv+trell -aic 2 -cmp 2 -subcmp 2 -s 320×180 -title X final_video.mp4
- Explanations :Source : source_video.avi
Audio codec : aac
Audio bitrate : 128kb/s
Video codec : mpeg4
Video bitrate : 1200kb/s
Video size : 320px par 180px
Generated video : final_video.mp4
-
Encode video for the PSP
- ffmpeg -i source_video.avi -b 300 -s 320×240 -vcodec xvid -ab 32 -ar 24000 -acodec aac final_video.mp4
- Explanations :Source : source_video.avi
Audio codec : aac
Audio bitrate : 32kb/s
Video codec : xvid
Video bitrate : 1200kb/s
Video size : 320px par 180px
Generated video : final_video.mp4
- Explanations :Source : source_video.avi
-
Extracting sound from a video, and save it as Mp3
- ffmpeg -i source_video.avi -vn -ar 44100 -ac 2 -ab 192k -f mp3 sound.mp3
- Explanations :Source video : source_video.avi
Audio bitrate : 192kb/s
output format : mp3
Generated sound : sound.mp3
-
Convert a wav file to Mp3
- ffmpeg -i son_origine.avi -vn -ar 44100 -ac 2 -ab 192k -f mp3 son_final.mp3
-
Convert .avi video to .mpg
- ffmpeg -i video_origine.avi video_finale.mpg
-
Convert .mpg to .avi
- ffmpeg -i video_origine.mpg video_finale.avi
-
Convert .avi to animated gif(uncompressed)
- ffmpeg -i video_origine.avi gif_anime.gif
-
Mix a video with a sound file
- ffmpeg -i son.wav -i video_origine.avi video_finale.mpg
- Convert .avi to .flv
- ffmpeg -i video_origine.avi -ab 56 -ar 44100 -b 200 -r 15 -s 320×240 -f flv video_finale.flv
-
Convert .avi to dv
- ffmpeg -i video_origine.avi -s pal -r pal -aspect 4:3 -ar 48000 -ac 2 video_finale.dv
- Or:
- ffmpeg -i video_origine.avi -target pal-dv video_finale.dv
- ffmpeg -i video_origine.avi -s pal -r pal -aspect 4:3 -ar 48000 -ac 2 video_finale.dv
-
Convert .avi to mpeg for dvd players
- ffmpeg -i source_video.avi -target pal-dvd -ps 2000000000 -aspect 16:9 finale_video.mpegExplanations :target pal-dvd : Output format
ps 2000000000 maximum size for the output file, in bits (here, 2 Gb)
aspect 16:9 : Widescreen
Compress .avi to divx
-
ffmpeg -i video_origine.avi -s 320x240 -vcodec msmpeg4v2 video_finale.avi
- ffmpeg -i source_video.avi -target pal-dvd -ps 2000000000 -aspect 16:9 finale_video.mpegExplanations :target pal-dvd : Output format
-
Compress Mkv to mpg avec minimum de pertes
- ffmpeg -i Input.mkv -f avi -c:v mpeg4 -b:v 1000k -c:a libmp3lame -b:a 320k output.mpg
- 4000K : proche origine
- 1000K : correct
- 500K : trop faible
- Mkv 720Px to .mp4
- ffmpeg -i C:\input.mkv -vf scale=720:-1 -acodec copy -threads 12 C:\output.mp4
- ffmpeg -i Input.mkv -f avi -c:v mpeg4 -b:v 1000k -c:a libmp3lame -b:a 320k output.mpg
-
Compress Ogg Theora to Mpeg dvd
- ffmpeg -i film_sortie_cinelerra.ogm -s 720×576 -vcodec mpeg2video -acodec mp3 film_termine.mpg
-
Compress .avi to SVCD mpeg2
- NTSC format:
- ffmpeg -i video_origine.avi -target ntsc-svcd video_finale.mpg
- PAL format:
- ffmpeg -i video_origine.avi -target pal-svcd video_finale.mpg
-
Compress .avi to VCD mpeg2
-
NTSC format:
ffmpeg -i video_origine.avi -target ntsc-vcd video_finale.mpg
PAL format:
ffmpeg -i video_origine.avi -target pal-vcd video_finale.mpg
Multi-pass encoding with ffmpeg
ffmpeg -i fichierentree -pass 2 -passlogfile ffmpeg2pass fichiersortie-2
-
-
Biblio