To get list of video format supported by ffmpeg, run
1 |
ffmpeg -formats |
Example See ffmpeg […]
To get list of video format supported by ffmpeg, run
1 |
ffmpeg -formats |
Example See ffmpeg […]
To check if ffmpeg installed on your computer support h264, run
1 |
ffmpeg -formats | grep h264 |
See ffmpeg […]
Convert Video For Streaming
1 |
ffmpeg -y -i FILE_NAME.wmv -c:v libx264 -c:a aac -coder 1 -b:v 500k -threads 0 -b:a 96k FILE_NAME.mp4 |
if you want to scale the video to specific size, use -vf scale option, example
1 |
ffmpeg -y -i FILE_NAME.wmv -vf scale=720:480 -c:v libx264 -c:a aac -coder 1 -b:v 500k -threads 0 -b:a 96k FILE_NAME.mp4 |
Inject metadata
1 |
qt-faststart FILE_NAME.mp4 FILE_NAME-meta.mp4 |
Convert Video to MP4 This is verified method, works good, i converted many videos, no quality lose
1 |
ffmpeg -i FILE_NAME.INPUT_EXTN -crf 25.0 -c:v libx264 -c:a libfaac -ar 48000 -b:a 160k -coder 1 -threads 0 FILE_NAME_nm.mp4 |
To cut a video during transcode
1 |
time ffmpeg -ss 00:34:00 -t 00:02:00 -i FILE_NAME.INPUT_EXTN -crf 25.0 -c:v libx264 -c:a libfaac -ar 48000 -b:a 160k -coder 1 -threads 0 FILE_NAME_nm.mp4 |
Other Methods, Need to experiment To […]
Create thumbnail with ffmpeg To create thumbnail from video using ffmpeg, use
1 |
ffmpeg -y -ss HH:MM:SS -i VIDEO.AVI -f image2 -vframes 1 1.jpg |
Here HH:MM:SS = replace with time where you want to take screen shot. 1.jpg = is the tumbnail image generated. Create thumbnail with mplayer METHOD 1
1 2 |
mkdir out mplayer VIDEO.AVI -ss 0:8:0 -nosound -vo jpeg:outdir=out -frames 2 |
-ss = you can specify time in seconds or in hh:mm:ss format. -frames 2 = […]
To Scape a Video using ffmpeg, run
1 |
ffmpeg -i FILE_NAME.avi -vf scale=1280:720 FILE_NAME_OUT.avi |
See ffmpeg […]
To cut a video using ffmpeg, use
1 |
ffmpeg -ss 00:17:00 -i IN_FILE.avi -t DURATION_IN_SECONDS -acodec copy -vcodec copy -async 1 OUT_FILE.avi |
To cut a video and encoding it
1 |
ffmpeg -ss 00:17:00 -i IN_FILE.avi -t DURATION_IN_SECONDS -crf 25.0 -c:v libx264 -c:a aac -ar 48000 -b:a 160k -coder 1 -threads 0 OUT_FILE.mp4 |
DURATION_IN_SECONDS specify duration of new clip. If you specify 60, it will cut 60 seconds of video start from time specified in -ss. In this cause, from 00:17:00 to 00:18:00. For more info, see “Cutting small sections” part of […]
To install ffmpeg 4 on Ubuntu, you can use PPA https://launchpad.net/~jonathonf/+archive/ubuntu/ffmpeg-4
1 2 |
apt install software-properties-common -y add-apt-repository ppa:jonathonf/ffmpeg-4 -y |
Now install ffmpeg with
1 |
apt update && apt install ffmpeg -y |
See ffmpeg […]
When installing ffmpeg, i get error
1 2 3 4 5 6 7 8 9 10 11 12 |
CC libavcodec/libvorbisenc.o CC libavcodec/libx264.o libavcodec/libx264.c: In function ‘X264_frame’: libavcodec/libx264.c:282:9: error: ‘x264_bit_depth’ undeclared (first use in this function) if (x264_bit_depth > 8) ^ libavcodec/libx264.c:282:9: note: each undeclared identifier is reported only once for each function it appears in libavcodec/libx264.c: In function ‘X264_init_static’: libavcodec/libx264.c:892:9: error: ‘x264_bit_depth’ undeclared (first use in this function) if (x264_bit_depth == 8) ^ make: *** [libavcodec/libx264.o] Error 1 |
This is due to incompatability with ffmpeg and x264. What you can do is try another version of x264. You will be able to download older version of x264 from ftp://ftp.videolan.org/pub/x264/snapshots On 2018-08-14, it failed with latest stable snapshot. So i tried 14 days old stable snapshot
1 2 3 4 5 6 7 8 |
cd /usr/local/src/ wget ftp://ftp.videolan.org/pub/x264/snapshots/x264-snapshot-20180730-2245-stable.tar.bz2 tar xvf x264-snapshot-20180730-2245-stable.tar.bz2 cd /usr/local/src/x264-snapshot-20180730-2245-stable make clean && make distclean ./configure --prefix=/usr --enable-shared make && make install ldconfig |
[…]
Install FFmpeg on CentOS using yum Install ffmpeg on Ubuntu Cut a Video using ffmpeg Scale a video using ffmpeg Create thumbnail from video using ffmpeg Convert Video info MP4 using ffmpeg Extract Audio from Video using ffmpeg check if ffmpeg support H264 Show all formats supported by ffmpeg Saving a steam with ffmpeg ffmpeg […]