Last active
December 17, 2015 09:58
-
-
Save datt/5590761 to your computer and use it in GitHub Desktop.
useful ffmpeg commands
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #1. Getting resolution of video using ffmpeg | |
| # after running following command you will get output in format 640x480 | |
| `ffmpeg -i #{path_to_video} 2>&1 | grep 'Video:' | cut -d \, -f 3 | sed -e 's/\[PAR//g' -e 's/x/:/g' | cut -d ' ' -f 2` | |
| #2. Extracting preview(single) image for video | |
| `ffmpeg -i #{path_to_video} -f image2 -ss 1 -vframes 1 #{path_to_video}/preview_0000.jpg` | |
| #3. Extracting images from a video for a duration | |
| `ffmpeg -i #{path_to_video} -r 25 -sameq -t #{duration} -s #{resolution} -vf -ss #{start_point} #{IMAGE_FILES_PATH}prefix_%d.jpeg` | |
| #4. Trimming/cutting a video | |
| `ffmpeg -sameq -ss #{start_point} -t #{duration} -i #{input_vdo} #{output_vdo}` | |
| #5. Converting to MP4 | |
| `ffmpeg -i #{input_vdo} -r 25 -y -sameq -vcodec libx264 #{output_vdo}`# here output video path extension should be .mp4 | |
| # path_to_video should be path to your video | |
| # duration is defined in seconds | |
| # start_point starting point in seconds | |
| # resolution in 'digitxdigit'format |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment