====== ffmpeg ======
**ffmpeg** ist ein Programm zur [[linux:Video|Videoverarbeitung]].
===== Beispiele =====
==== Einfaches Konvertieren in anderes Format ====
ffmpeg -i video_in.mp4 video_out.webm
==== gif aus Video erstellen ====
ffmpeg -ss 00:05:40 -i ../video.mp4 -to 6 -r 25 animation.gif
ffmpeg -ss 00:00:02 -i video.mp4 -to 5 -r 5 -vf scale=400:-1 bild.gif
==== Video ausschneiden ====
ffmpeg -ss 01:29:06.000 -i video.avi -to 7.5 -r 25 video-cut.mp4
==== Einzelbilder erstellen aus Video ====
ffmpeg -i Baergida.mp4 -ss 00:05:40 -t 6 -r 5 -f image2 ./test/foo-%03d.jpeg
==== Audio entfernen ====
ffmpeg -i example.mkv -c copy -an example-nosound.mkv
==== Videos zusammenfügen ====
=== Variante 1 ===
Videos müssen im gleichen Format vorliegen.
ffmpeg -i "concat:teil1.webm|teil2.webm" -acodec copy -vcodec copy ausgabe.webm
=== Variante 2 ===
Datei files.txt erstellen mit folgendem Inhalt (Bsp.):
file 'file1.mp4'
file '/path/to/file2.mp4'
file 'file3.mp4'
Dann ffmpeg ausführen:
ffmpeg -f concat -safe 0 -i files.txt -c copy output.mp4
==== Videos drehen ====
-transpose:
* 0 = keine Rotation
* 1 = 90 Grad im Uhrzeigersinn
* 2 = 180 Grad
* 3 = 90 Grad gegen den Uhrzeigersinn
Um 90 Grad nach rechts drehen
ffmpeg -i input.mpeg -vf "transpose=1" -qscale 0 output.mpeg
-qscale 0 nicht unbedingt notwendig
ffmpeg -i input.mp4 -vf "transpose=1" output.mp4
==== Horizontales und vertikales Flippen ====
ffmpeg -i input.mpeg -vf "hflip,vflip" -qscale 0 output.mpeg
==== Helligkeit, Kontrast, Gamma ====
Vorschau:
ffplay -vf eq=contrast=1:brightness=0.06:saturation=2 INPUT.mp4
Rendern:
ffmpeg -i INPUT.mp4 -vf eq=contrast=1:brightness=0.06:saturation=2 -c:a copy OUTPUT.mp4
==== Audiodateien crosfaden ====
ffmpeg -i first.flac -i second.flac -filter_complex acrossfade=d=20 output.flac
Doku dazu: https://ffmpeg.org/ffmpeg-filters.html#acrossfade
Mehrere Dateien auf einmal:
ffmpeg -i 0.flac -i 1.flac -i 2.flac -i 3.mp3 -flac
-filter_complex "[0][1]acrossfade=d=10:c1=tri:c2=tri[a];
[a][2]acrossfade=d=10:c1=tri:c2=tri[b];
[b][3]acrossfade=d=10:c1=tri:c2=tri"
out.flac
Siehe auch: https://superuser.com/questions/1363461/crossfade-many-audio-files-into-one-with-ffmpeg
==== Webcam ====
//Von https://trac.ffmpeg.org/wiki/Capture/Webcam //
=== List devices ===
v4l2-ctl --list-devices
=== List device capabilities ===
Supported pixel formats, video formats, and frame sizes
ffmpeg -f v4l2 -list_formats all -i /dev/video0
=== Encoding examples ===
ffmpeg -f v4l2 -framerate 25 -video_size 640x480 -i /dev/video0 output.mkv
ffmpeg -f v4l2 -input_format yuyv422 -framerate 25 -video_size 640x480 -i /dev/video1 output.mkv
ffmpeg -f v4l2 -input_format h264 -framerate 25 -video_size 640x480 -i /dev/video1 output_h264.mkv
=== Adjusting camera functions ===
List:
v4l2-ctl -L
Adjust:
v4l2-ctl -c
===== Weblinks =====
* https://ffmpeg.org/
* [[wp>de:ffmpeg]]