Aokocax Useful FFmpeg Commands Save

A document describing how to easily find answers to video solutions/problems that you will need in daily life with FFmpeg

Project README

Useful FFmpeg commands

Turkish

The use of video in digital life is increasing exponentially day by day. I prepared a document explaining how you can easily find answers to video solutions/problems that you will need in daily life with FFmpeg library. I show you which commands to run for video solutions you will need with about 20 different scenarios in the file.

Download FFmpeg to your computer for Windows => https://github.com/BtbN/FFmpeg-Builds/releases for Mac Os => https://evermeet.cx/ffmpeg/ After downloading from .cx/ffmpeg/ffmpeg-105012-gbb813ccb45.zip addresses, you can run ffmpeg as arguments by entering bin folder via terminal.

  1. Convert any video format to other format.

  2. ffmpeg -i source.avi output.mp4

    ffmpeg -i source.mov output.mp4

  3. Increasing/decreasing the framerate of the video. (Twitter and some platforms require 30FPS video)

  4. ffmpeg -i source.mp4 -framerate 30 output30fps.mp4

  5. Adding audio to video.

  6. It will be as long as the video or audio, whichever is shorter.

    ffmpeg -i source.mp4 -i sound.mp3 -vcodec copy -map 0:v -map 1:a -map 1:a -shortest output.mp4

  7. Cutting the first three seconds of the video.

  8. ffmpeg -i source.mp4 -t 3 output3seconds.mp4

    or

    ffmpeg -i source.mp4 -t 00:00:03 output3seconds.mp4

  9. Cut a specific range of video.

  10. Getting next 3 seconds starting from 3 seconds

    ffmpeg -i source.mp4 -ss 3 -t 3 source3seconds.mp4

  11. Cut video from a specific second to the end of the video

  12. ffmpeg -i source.mp4 -ss 3 output3seconds.mp4

    ffmpeg -i source.mp4 -ss 00:00:03 output3seconds.mp4

  13. Convert video to animated gif.

  14. ffmpeg -i source.mp4 -vf "fps=10,scale=320:-1:flags=lanczos,split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse" -loop 0 output.gif

  15. Converting part of video to animated gif.

  16. ffmpeg -i source.mp4 -ss 1 -t2 -vf "fps=10,scale=320:-1:flags=lanczos,split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse" -loop 0 tar.gif

  17. Concat two videos (without audio).

  18. ffmpeg -i source1.mp4 -i source2.mp4 -y -filter_complex "[0:v][1:v] concat=n=2:v=1:[v]" -map "[v]" output.mp4

  19. Concat two videos back-to-back (with audio).

  20. ffmpeg -i source1.mp4 -i source2.mp4 -y -filter_complex "[0:v:0][0:a:0][1:v:0][1:a:0] concat=n=2:v=1:a=1 [v] [a]" -map "[a]" -map "[v]" output.mp4

  21. Adding a watermark to the middle of the screen.

  22. ffmpeg -i source.mp4 -i logo.png -filter_complex "overlay = (main_w - overlay_w)/2:(main_h - overlay_h) / 2" watermark.mp4

  23. Adding a watermark to a specific point of the screen.

  24. ffmpeg -i source.mp4 -i logo.png -filter_complex "overlay = (main_w - overlay_w)/2:(main_h - overlay_h) / 2" watermark.mp4

  25. Extracting all the frames in the video as an image

  26. ffmpeg -i source.mp4 "%04d.png"

  27. Take a screenshot of a specific frame in the video.

  28. ffmpeg -i wm.mp4 -ss 00:00:01.23 -vframes 1 -q:v 2 output.jpg

  29. Take a screenshot from every 1 second of the video

  30. ffmpeg -i wm.mp4 -r 1 -f image2 screenshot-%03d.jpg

  31. Merging two separate audio files.

  32. ffmpeg -i sound1.wav -i sound2.wav -filter_complex "[0:0][1:0]concat=n=2:v=0:a=1[out]" -map "[out]" soundconcat.wav

  33. Extracting the audio file from the video as mp3.

  34. ffmpeg -i source.mp4 output.mp3

  35. To mute the video.

  36. ffmpeg -i source.mp4 -c copy -an sessiz.mp4

  37. ffmpeg -f concat -i filelist.txt -i audio.mp3 -c:a copy output.mp4

    filelist.txt sample file

    a1.jpg
    a2.jpg
    a3.jpg
    
  38. Writing text on the video with the desired font.

  39. ffmpeg -i source.mp4 -filter:v "drawtext=enable='between(t,0,2)':fontsize=30:fontfile=font.otf:fontcolor=yellow:text='my text':x = (w - text_w) / 2:y = (h - text_h - line_h) / 2" output.mp4

    between(t,0,2) 0-2 seconds

    center the screen x = (w - text_w) / 2:y = (h - text_h - line_h) / 2

    You can make it output in the position you want by giving x and y values.

  40. Split video into segments

  41. ffmpeg -i input.mp4 -c copy -map 0 -segment_time 4 -f segment -segment_list list.txt output_video%03d.mp4

  42. Concat segmented video

  43. ffmpeg -y -v error -i list.txt -map 0 -c copy output.mp4

Open Source Agenda is not affiliated with "Aokocax Useful FFmpeg Commands" Project. README Source: aokocax/useful-FFmpeg-commands
Stars
193
Open Issues
3
Last Commit
2 years ago

Open Source Agenda Badge

Open Source Agenda Rating