ffmpegref.txt 2.1 KB

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