FFmpeg: Difference between revisions
m highlight merging |
No edit summary |
||
| Line 1: | Line 1: | ||
== Merging mp4 and m4a == | == Usage == | ||
=== Merging mp4 and m4a === | |||
Using {{code|ffmpeg}} you can combine the two together: | Using {{code|ffmpeg}} you can combine the two together: | ||
{{highlight|lang=terminal|code= | {{highlight|lang=terminal|code= | ||
| Line 5: | Line 7: | ||
}} | }} | ||
== Extracting a video section == | === Extracting a video section === | ||
To extract a video section: | To extract a video section: | ||
{{highlight|lang=terminal|code= | {{highlight|lang=terminal|code= | ||
| Line 19: | Line 21: | ||
| The length of the video in HH:MM:SS | | The length of the video in HH:MM:SS | ||
|} | |} | ||
=== Slideshow to Video === | |||
See: https://trac.ffmpeg.org/wiki/Slideshow | |||
Example usage: | |||
{{highlight|lang=terminal|code= | |||
## Remove any empty image files (explained below) | |||
# find ./images -size 0 -print0 | xargs -0 rm -- | |||
## Process images to 25fps with 8 CPU cores | |||
# ffmpeg -pattern_type glob \ | |||
-i ./images/\*.jpg \ | |||
-c:v libx264 \ | |||
-vf "fps=25,format=yuv420p" \ | |||
-threads 8 | |||
output.mp4 | |||
}} | |||
The {{code|*}} needs to be escaped or contained in single quotes because {{code|ffmpeg}} will do the globbing, not the shell. | |||
Empty files will cause {{code|ffmpeg}} to stop processing additional files. Run {{code|find ./slideshow -size 0 -print0 | xargs -0 rm --}} to delete zero-sized files to prevent this from happening. | |||
== Issues == | == Issues == | ||
Revision as of 23:49, 21 July 2019
Usage
Merging mp4 and m4a
Using ffmpeg you can combine the two together:
# ffmpeg -i video.mp4 -i audio.m4a -acodec copy -vcodec copy output.mp4
Extracting a video section
To extract a video section:
# ffmpeg -i input.mp4 -ss 00:00:15 -t 00:00:10 -async 1 output.mp4
Where:
| -ss | The start time in HH:MM:SS |
|---|---|
| -t | The length of the video in HH:MM:SS |
Slideshow to Video
See: https://trac.ffmpeg.org/wiki/Slideshow
Example usage:
## Remove any empty image files (explained below)
# find ./images -size 0 -print0
The * needs to be escaped or contained in single quotes because ffmpeg will do the globbing, not the shell.
Empty files will cause ffmpeg to stop processing additional files. Run find ./slideshow -size 0 -print0 to delete zero-sized files to prevent this from happening.
Issues
Copying DASH video (via -vcodec copy) using versions older than 0.10 will result in an empty file because it is unable to read the video contents.