Last active
August 29, 2015 14:06
-
-
Save benjaminhorner/93ba2c51d4ec55a2226f to your computer and use it in GitHub Desktop.
Encode videos in WEBM and MP4 format with FFMPEG and extract first and last image
This file contains 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
## WebM | |
ffmpeg -i SOURCE_VIDEO_NAME.mov -codec:v libvpx -vf scale=1280:-1 -quality good -cpu-used 0 -b:v 1000k -qmin 10 -qmax 40 -maxrate 1000k -bufsize 2000k -threads 0 -an -pass 1 -f webm /dev/null | |
ffmpeg -i SOURCE_VIDEO_NAME.mov -codec:v libvpx -vf scale=1280:-1 -quality good -cpu-used 0 -b:v 1000k -qmin 10 -qmax 40 -maxrate 1000k -bufsize 2000k -threads 0 -codec:a libvorbis -b:a 128k -movflags faststart -pass 2 -f webm OUTPUT_VIDEO_NAME.webm | |
## MP4 | |
ffmpeg -i SOURCE_VIDEO_NAME.mov -codec:v libx264 -vf scale=1280:-1 -quality good -cpu-used 0 -b:v 1000k -qmin 10 -qmax 40 -maxrate 1000k -bufsize 2000k -threads 0 -an -pass 1 -f mp4 /dev/null | |
ffmpeg -i SOURCE_VIDEO_NAME.mov -codec:v libx264 -vf scale=1280:-1 -quality good -cpu-used 0 -b:v 1000k -qmin 10 -qmax 40 -maxrate 1000k -bufsize 2000k -threads 0 -codec:a libfdk_aac -b:a 128k -movflags faststart -pass 2 -f mp4 OUTPUT_VIDEO_NAME.mp4 | |
## First image | |
ffmpeg -i SOURCE_VIDEO_NAME.mov -r 1 -t 00:00:01 -f image2 OUTPUT_VIDEO_NAME.png | |
## Last image | |
# Get total frames | |
# Search for this line : nb_frames=824 | |
ffprobe -show_streams 36_AGE.mov | |
#Extract last frame | |
ffmpeg -i SOURCE_VIDEO_NAME.mov -vf "select='eq(n,LAST_INDEX_MINUS_ONE)'" -vframes 1 OUTPUT_VIDEO_NAME.png |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment