Hier werden die Unterschiede zwischen zwei Versionen angezeigt.
ffmpeg [2024/07/19 00:42] 127.0.0.1 Externe Bearbeitung |
ffmpeg [2025/09/06 11:20] (aktuell) jango [Links] |
||
---|---|---|---|
Zeile 1: | Zeile 1: | ||
+ | =====Stream===== | ||
+ | Mit [[vlc|VLC]] kann man auch direkt streamen. | ||
+ | |||
+ | < | ||
+ | |||
+ | // save to file | ||
+ | ffmpeg.exe -i http:// | ||
+ | |||
+ | // restream to hls | ||
+ | ffmpeg.exe -re -i manifest.m3u8 -f hls -hls_time 1 -hls_list_size 5 -hls_flags delete_segments live.m3u8 | ||
+ | ffmpeg -i manifest.m3u8 -f ssegment -strftime 1 -segment_list live.m3u8 -segment_time 10 live_%%Y%%m%%d%%H%%M%%S.ts | ||
+ | |||
+ | // restream to dash | ||
+ | ffmpeg -i manifest.m3u8 -f dash live.mpd | ||
+ | |||
+ | // restream to rtmp | ||
+ | ffmpeg.exe -re -i test.mp4 -vcodec copy -acodec copy -f flv rtmp:// | ||
+ | ffmpeg -re -i file.mp4 -vcodec libx264 -f flv rtmp:// | ||
+ | |||
+ | //restream to hls | ||
+ | ffmpeg -re -i https:// | ||
+ | |||
+ | // find recording devices | ||
+ | ffmpeg -list_devices true -f dshow -i dummy | ||
+ | // list recording device options | ||
+ | ffmpeg -f dshow -list_options true -i video=" | ||
+ | // start recording | ||
+ | ffmpeg -f dshow -s 320x240 -r 30 -vcodec mjpeg -i video=" | ||
+ | |||
+ | // stream desktop | ||
+ | ffmpeg -f gdigrab -r 30 -i desktop -c:v libx264 -g 250 -c:a libfdk_aac -ac 2 -hls_time 1 -hls_list_size 4 -hls_wrap 8 -s 1366x768 -strict -2 -ab 128k -ar 44100 D:/ | ||
+ | |||
+ | // stream image | ||
+ | ffmpeg.exe -loop 1 -i test.png -vcodec libx264 -acodec copy -vf " | ||
+ | </ | ||
+ | |||
+ | =====Convert===== | ||
+ | |||
+ | https:// | ||
+ | |||
+ | < | ||
+ | |||
+ | ffmpeg -i file.mp4 file.mp3 | ||
+ | |||
+ | // mp4 to flv | ||
+ | ffmpeg -i v.mp4 -c:v libx264 -crf 19 v.flv | ||
+ | |||
+ | // avi to gif | ||
+ | FFmpeg –i – v.avi v.gif | ||
+ | |||
+ | // mp4 to ts | ||
+ | ffmpeg -i test.mp4 -bsf:v h264_mp4toannexb -codec copy output.ts | ||
+ | |||
+ | // mix png and mp3 to mp4 | ||
+ | ffmpeg -loop 1 -framerate 2 -i test.png -i test.mp3 -c:v libx264 -preset medium -tune stillimage -crf 18 -c:a copy -shortest -pix_fmt yuv420p test.mp4 | ||
+ | |||
+ | ffmpeg -i video.mp4 -i overlay.png -filter_complex " | ||
+ | |||
+ | // extract frames | ||
+ | ffmpeg -i test.mp4 frame_%05d.bmp | ||
+ | |||
+ | // extract all frames from between 1 and 5 seconds, and also between 11 and 15 seconds: | ||
+ | ffmpeg -i in.mp4 -vf select=' | ||
+ | |||
+ | </ | ||
+ | |||
+ | =====Modify===== | ||
+ | |||
+ | < | ||
+ | |||
+ | // extract metadata | ||
+ | ffmpeg -i in.mp3 -f ffmetadata metadata.txt | ||
+ | |||
+ | // add metadata | ||
+ | ffmpeg -i in.mp3 -acodec copy -metadata title=" | ||
+ | |||
+ | // remove audio | ||
+ | ffmpeg in.mp4 -an out.mp4 | ||
+ | |||
+ | // remove video | ||
+ | ffmpeg -i in.mp4 -vn out.mp3 | ||
+ | |||
+ | // increase volume to 150% | ||
+ | ffmpeg -i in.mp4 -filter:a " | ||
+ | |||
+ | // decrease volume by 50% | ||
+ | ffmpeg -i in.mp4 -filter:a " | ||
+ | |||
+ | // | ||
+ | ffmpeg -i in.mp4 -vf yadif out.mp4 | ||
+ | |||
+ | //replace the first 90 seconds of audio with silence | ||
+ | ffmpeg -i in.mp4 -vcodec copy -af " | ||
+ | |||
+ | //replace all audio between 1' | ||
+ | ffmpeg -i in.mp4 -vcodec copy -af " | ||
+ | |||
+ | // rotate 2x 90' clockwise | ||
+ | // 0 = 90CounterCLockwise and Vertical Flip (default) | ||
+ | // 1 = 90Clockwise | ||
+ | // 2 = 90CounterClockwise | ||
+ | // 3 = 90Clockwise and Vertical Flip | ||
+ | ffmpeg -i in.mp4 -vf " | ||
+ | |||
+ | // flip vertical/ | ||
+ | ffmpeg -i in.mp4 -vf " | ||
+ | |||
+ | //scale | ||
+ | ffmpeg -i in.mp4 -vf scale=1024: | ||
+ | ffmpeg -i in.mp4 -s 1280x720 -c:a copy out.mp4 | ||
+ | |||
+ | // overlay, 1st input on layer 0, 2nd input on layer 1 | ||
+ | ffmpeg -i in.mp4 -i overlay.png -filter_complex " | ||
+ | |||
+ | ffmpeg -i in.mp4 -i overlay.png -filter_complex " | ||
+ | |||
+ | // cut out a clip, start at 0 seconds and record 3 seconds long | ||
+ | ffmpeg -i in.mp4 -ss 0 -c copy -t 3 out.mp4 | ||
+ | ffmpeg -i in.mp4 -ss 00:00:00 -c copy -t 00:00:03 out.mp4 | ||
+ | |||
+ | // cut out a clip, start at 00:00:00 seconds and record until 00:01:30 | ||
+ | ffmpeg -i in.mp4 -ss 00:00:00 -to 00:01:30 -c:v copy -c:a copy out.mp4 | ||
+ | |||
+ | // make transparent background | ||
+ | ffmpeg -i in.png -vf colorkey=white: | ||
+ | |||
+ | //change color (lt, lte, eq, gte, gt) | ||
+ | ffmpeg -i logo.png -vf " | ||
+ | |||
+ | // 0:0:0:0 == rgba | ||
+ | ffmpeg -i logo.png -filter_complex " | ||
+ | |||
+ | //Delay video by 3.84 seconds: | ||
+ | ffmpeg -i in.mp4 -itsoffset 3.84 -i in.mp4 -map 1:v -map 0:a -vcodec copy -acodec copy out.mp4 | ||
+ | |||
+ | //Delay audio by 3.84 seconds: | ||
+ | ffmpeg -i in.mp4 -itsoffset 3.84 -i in.mp4 -map 0:v -map 1:a -vcodec copy -acodec copy out.mp4 | ||
+ | |||
+ | // demuxing | ||
+ | // file.txt example | ||
+ | file ' | ||
+ | file ' | ||
+ | file ' | ||
+ | file ' | ||
+ | // then run | ||
+ | ffmpeg -f concat -i file.txt -c copy out.mp4 | ||
+ | |||
+ | //copy the video from in0.mp4 and audio from in1.mp4: | ||
+ | ffmpeg -i in0.mp4 -i in1.mp4 -c copy -map 0:0 -map 1:1 -shortest out.mp4 | ||
+ | |||
+ | </ | ||
+ | |||
+ | =====Links===== | ||
+ | |||
+ | * [[https:// | ||
+ | * [[https:// | ||
+ | * [[https:// | ||
+ | * [[https:// | ||
+ | * [[https:// | ||
+ | * [[https:// |