ffmpegref.txt 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. # convert *.mkv to *.mp4
  2. ffmpeg -i input.mkv -codec copy output.mp4
  3. # ffmpeg
  4. ffmpeg -i filename.mp3/filename.mp4 # to read entire history
  5. # remove logo with the ffmpeg delogo
  6. ffplay input.mp4 -vf "delogo=x=1400:y=20:w=500:h=480:show=1"
  7. # combine/concat multiple audio tracks into single audio
  8. ffmpeg -f concat -safe 0 -1 list.txt audio.mp3
  9. list.txt contains paths to all segments:
  10. file audiofile1.mp3
  11. file audiofile2.mp3
  12. file audiofile3.mp3
  13. # combine one image + one audio file to make one video using ffmpeg
  14. ffmpeg -r 1 -loop 1 -i image.jpg -i audio.mp3 -acodec copy -r 1 -shortest -vf
  15. scale=1280:720 video.mp4
  16. # combine/concat multiple video files into single video
  17. ffmpeg -f concat -i list.txt video.mp4
  18. list.txt contains paths to all segments:
  19. file videofile1.mp4
  20. file videofile2.mp4
  21. file videofile3.mp4
  22. # trim files from the beginning to a specific duration
  23. ffmpeg -i input_audio.wav -t 5 output_audio.wav
  24. ffmpeg -i input_video.mp4 -t 00:00:05 output_video.mp4
  25. This works for both video and audio files. Both of the commands above do the
  26. same thing: save the first 5 seconds of the input file to the output file. I
  27. have used to different ways of inputting the duration: a single number (number
  28. of seconds) and HH:MM:SS (hours, minutes, seconds).
  29. You can go even further by specifying a start time with -ss, and even an end
  30. time with -to:
  31. ffmpeg -i input_audio.mp3 -ss 00:01:14 output_audio.mp3
  32. ffmpeg -i input_audio.wav -ss 00:00:30 -t 10 output_audio.wav
  33. ffmpeg -i input_video.h264 -ss 00:01:30 -to 00:01:40 output_video.h264
  34. ffmpeg -i input_audio.ogg -ss 5 output_audio.ogg
  35. You can see start time (-ss HH:MM:SS), duration (-t duration) in seconds, end
  36. time (-to HH:MM:SS), and start time (-s duration) in seconds (starting after
  37. duration seconds).
  38. # trim videos with below example time-line
  39. # 00:00:00 - 00:01:55.030 ---- 00:03:02 - 00:21:09
  40. ffmpeg -i singapore.mp4 -ss 00:00:00 -to 00:01:55.030 output1.mp4
  41. ffmpeg -i singapore.mp4 -ss 00:03:02 -to 00:21:09 output2.mp4