65
votes
How to use FFmpeg Command for Reverse Video?
FFmpeg has a reverse video filter and reverse audio filter.
For video only:
ffmpeg -i /storage/emulated/0/ffvid/frameCount.mp4 -vf reverse reversed.mp4
For audio and video:
ffmpeg -i /storage/...
60
votes
Accepted
Fix bad files and streams with ffmpeg so VLC and other players would not crash
If parts of the file reside on physically bad sectors, or for whatever reason, the OS cannot serve the whole file to FFmpeg, then naturally FFmpeg can't do anything about that. You should get a ...
54
votes
Accepted
How do I set up and use FFmpeg in Windows?
FFmpeg is indeed a powerful video encoder/decoder tool¹. It operates in the command line, as opposed to using a GUI. Command line is that black window you find by typing [windows+r], then cmd in the ...
51
votes
Accepted
How to deinterlacing with ffmpeg?
Add the yadif filter i.e.
ffmpeg -i input.vob -vf yadif -c:v libx264 -preset slow -crf 19 -c:a aac -b:a 256k output.mp4
See yadif docs for more info.
51
votes
Accepted
ffmpeg Color Correction: Gamma, Brightness and Saturation
These settings helped me to lighten up a dark video using the filter eq, with some added saturation.
Syntax:
filtername=option1=value1:option2=value2:option3=value3... These can be in any order.
...
50
votes
Accepted
How to prevent FFmpeg from dropping metadata?
Other answers here only work with the "known" meta keys, but for custom/arbitrary meta keys, -map_metadata 0 is not sufficient to keep them all.
In my transcoder project, a lot of camera ...
37
votes
Convert mp4 to webm without quality loss with ffmpeg
Answer
Use two-pass Constant Quality mode:
ffmpeg -i input.mp4 -b:v 0 -crf 30 -pass 1 -an -f webm -y /dev/null
ffmpeg -i input.mp4 -b:v 0 -crf 30 -pass 2 output.webm
Notes
If you're using ...
31
votes
Repeat/loop Input Video with ffmpeg?
With ffmpeg 2.8.4, the following command creates output.mp4 that is a repeating copy of input.mp4 until the ffmpeg process is stopped:
ffmpeg -stream_loop -1 -i input.mp4 -c copy output.mp4
This ...
31
votes
Accepted
Can I set the start number for image sequence output?
The image sequence muxer has a start number option, so
ffmpeg -i video.webm -start_number 98 image-%03d.png
30
votes
Accepted
What is KeyInt and min-keyint and no-scenecut
The frames in your H.264 video are grouped into units called GOPs (Group Of Pictures). Inside these GOPs frames are classified into three types:
I-frame: frame that stores the whole picture
P-frame: ...
29
votes
Accepted
How to use ffprobe to obtain certain information about mp4/h.264 files
If you only want the information from the first video stream use -select_streams v:0:
ffprobe -v error -select_streams v:0 -show_entries stream=width,height,duration,bit_rate -of default=...
28
votes
Accepted
Is there a way to pause and resume FFmpeg encoding?
Suspend
A simple method is to suspend it with ctrl+z. Or you could get the PID with pgrep ffmpeg then use kill -s SIGSTOP <PID> to suspend.
Then resume with fg command or kill -s SIGCONT <...
27
votes
Accepted
ffmpeg: how to add several subtitle streams
Whenever's there's multiple inputs fed to ffmpeg, and you need one more than video/audio/subtitle stream sent to the output, -map statements are needed.
ffmpeg -i $movie.mov -i $sub_en.srt -i $sub_de....
25
votes
Accepted
Is it possible to speed up a video using handbrake?
You can use ffmpeg, a free command-line tool, to do this.
The basic command is
ffmpeg -i input.mov -vf "setpts=(PTS-STARTPTS)/30" -crf 18 output.mov
The 30 indicates the factor by which the video ...
25
votes
Accepted
How to fade in/out a video/audio clip with unknown duration?
#1 To simultaneously fade the audio in/out:
ffmpeg -i clip.mp4 -vf 'fade=in:0:30,fade=out:960:30'
-af 'afade=in:st=0:d=1,afade=out:st=32:d=1'
-c:v libx264 -crf 22 -preset ...
23
votes
How to prevent FFmpeg from dropping metadata?
The -metadata option is for manipulating the metadata. If you just want to copy the metadata from an input file to an output file, you should use the -map_metadata option:
ffmpeg -i a.MOV -...
23
votes
ffmpeg: Create a black background video from audio, for Youtube upload
Alternatively you can have ffmpeg generate the black video with the color source filter instead of making an image:
ffmpeg -f lavfi -i color=c=black:s=1280x720:r=5 -i audio.mp3 -crf 0 -c:a copy -...
22
votes
Is there a way to pause and resume FFmpeg encoding?
On Windows, pressing the "Pause/Break" key (the top-right most key) will pause it. Enter will resume.
If it doesn't work, click on the command prompt window to give it focus.
18
votes
ffmpeg Color Correction: Gamma, Brightness and Saturation
Gamma correction is likely to be a better choice than brightness, to stretch the histogram to the right rather than push it over:
# tinker with numbers
ffplay -vf eq=gamma=1.5:saturation=1.3 original....
18
votes
Accepted
RTMP server using ffmpeg
You can use FFmpeg as an RTMP server as following
ffmpeg -f flv -listen 1 -i rtmp://localhost:1935/live/app -c copy rtsp://YOUR_RTSP_HOST
Notes:
-listen 1 makes FFmpeg act as a RTMP server when used ...
17
votes
17
votes
Accepted
ffmpeg default output frame rate
r_frame_rate is "the lowest framerate with which all timestamps can be represented accurately (it is the least common multiple of all framerates in the stream)."
avg_frame_rate is just that: total ...
16
votes
Repeat/loop Input Video with ffmpeg?
At least on FFmpeg 2.8.x (but oldie should works too) you can use lavfi as input format and complex filter graph using movie and setpts filters as a argument for -i option.
Next command doing this ...
16
votes
Add an image overlay in front of video using ffmpeg
This is an addition to the excellent answer by PTS and an answer for chovy. If you want to place the overlay at the lower right corner, FFMPEG can calculate that for you very easily.
Use the modified ...
16
votes
Is there a way to pause and resume FFmpeg encoding?
It didn't seem possible as of Sep 30 2015. I would suggest segmenting the source file, encoding the segments and then stitching the resultant files.
This isn't a true pause/resume facility but the ...
16
votes
Accepted
How to limit file size with ffmpeg?
The fs parameter will stop the encode once it hits its value. So, if the output hits the 10MB mark while encoding the 15th second, then that's the duration of your output file.
If you want to make ...
16
votes
Accepted
FFMpeg: "Invalid audio stream. Exactly one MP3 audio stream is required"
You're trying to store an AAC stream in a MP3 container, would be my guess.
Either store the result as "${i%.mp3}-ENCODED.aac" or switch -c:a aac to -c:a libmp3lame
16
votes
Accepted
FFmpeg - dropping duplicate frames
Don't see any frames duplicated. The message you quoted - More than 1000 frames duplicated - is not ffmpeg's analysis of the input. FFmpeg duplicates or drops frames when the input and output ...
15
votes
Accepted
ffmpeg: explicitly tag h.264 as bt.601, rather than leaving unspecified?
PAL and NTSC have different color primaries, so
NTSC = SMPTE 170M = BT 601 525
PAL = BT 470 BG = BT 601 625
See the rows for value 5 & 6 on the table on page 387 of the active H.264 standard.
...
15
votes
How to fade in/out a video/audio clip with unknown duration?
It's a terrible hack, but this might work if all you want to do is audio fade in/out but don't know exactly how long the clip is:
ffmpeg -i input.mp4 -filter_complex "afade=d=0.5, areverse, afade=d=0....
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
ffmpeg × 2083video × 375
encoding × 161
audio × 120
mp4 × 116
h.264 × 87
conversion × 83
transcoding × 77
streaming × 76
filter × 73
codec × 68
video-editor × 66
video-quality × 49
linux × 47
windows × 44
subtitles × 41
editing × 40
framerate × 37
compression × 31
hls × 31
libx264 × 29
premiere × 28
video-capture × 28
sync × 28
mkv × 25