ffmpeg -stream_loop 3 -i input.mp4 -c copy output.mp4
This can avoid re-encoding because it can use stream copy.
0 means no loop, -1 means infinite loop.
This may not work with anything older than FFmpeg 4.0.
The concat demuxer allows you to loop an input without needing to re-encode because it can use stream copy.
You can do a simple image overlay using the following syntax:
ffmpeg -i input.mp4 -i image.png \
-filter_complex "[0:v][1:v] overlay=25:25:enable='between(t,0,20)'" \
-pix_fmt yuv420p -c:a copy \
overlay=25:25 means we want to position the image 25px to the right and 25px down, originating from the top left corner (0:0).
Yes, you can use FFmpeg in a commercial product
FFmpeg is licensed under the GNU Lesser General Public License (LGPL) version 2.1 or later.
It is also available under the General Public License (GPL) version 2 or later.
Some features, external libraries (libx264 and libx265 for example), and various filters, require GPL. If those parts get used the GPL ...
using the scale filter will do it, but there is a bit more to it.
ffmpeg -i input.mov -vf scale=720x406 output.mov
will create a movie with the required pixel dimensions, but if you look at the output you'll find that it adds information into the metadata so that it will play back at the same aspect ratio as the original, by using non-square pixels. So if ...
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 utility which can ignore those portions and write the salvageable parts to a new file, like ddrescue.
Now, if the file protocol is not the cause of errors, you can ...
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/emulated/0/ffvid/frameCount.mp4 -vf reverse -af areverse reversed.mp4
This filter buffers the entire clip. For larger files, segment the file, reverse each segment ...
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 clicking [windows+r] and typing cmd then hitting enter. This is also called "command prompt". Once setup you enter ffmpeg commands in one of these windows to use it.
Here are the basic ...
These settings helped me to lighten up a dark video using the filter eq, with some added saturation.
filtername=option1=value1:option2=value2:option3=value3... These can be in any order.
Filter ranges and all options:
ffplay -vf eq=brightness=0.06:saturation=2 INPUT.MOV
ffmpeg -i INPUT.MOV -...
Default frame rate for image inputs is 25. You can change it with the -framerate input option. Example for 24 fps:
ffmpeg -framerate 24 -i input_%03d.jpg -vf format=yuv420p output.mp4
-vf format=yuv420p (or the legacy alias -pix_fmt yuv420p) will ensure compatible chroma subsampling for MP4. Otherwise, ffmpeg will try to preserve color fidelity,...
Other answers here are only working with the "known" meta keys, for custom/arbitrary meta keys, -map_metadata 0 is not sufficient to keep them all.
In my transcoder project, a lot of camera makers like to inject custom meta keys in the MP4/MOV container, and I want to keep them in the transcoded MP4/MOV files. After a lot of head scratching, ffmpeg ...
The default settings for ffmpeg are very low quality, and since you don't specify any codec or quality parameters it's just using the defaults (I don't know why the devs don't fix that because it generates a lot of questions on forums everywhere).
Edit: the defaults are now quite sane. With a recent (as in later than 2017) build of ffmpeg you don't need to ...
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 command won't terminate on its own, and the output file will grow infinitely.
I'm using the below code to do the same thing.
ffmpeg -framerate 30 -i img%03d.png -c:v libx264 -pix_fmt yuv420p -crf 23 output.mp4
Breaking down the command:
ffmpeg <- call ffmpeg
-framerate 30 <- set the input framerate to 30
-i img%03d.png <- read PNG images with filename img001, img002, img003, etc..
Use drawbox for the box, and drawtext for the text.
ffmpeg -i input.mp4 -vf \
drawtext=fontfile=OpenSans-Regular.ttf:text='Title of this Video':fontcolor=white:fontsize=24:x=(w-tw)/2:y=(h/PHI)+th, \
-c:v libx264 -c:a copy -movflags +faststart output.mp4
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=noprint_wrappers=1 input.mp4
To see a list all entries use -show_streams and/or -show_format ...
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 <PID>.
Unfortunately this will not survive a reboot.
If you use a virtual machine, with something like VirtualBox, you could perform your encoding in a ...
#1 To simultaneously fade the audio in/out:
ffmpeg -i clip.mp4 -vf 'fade=in:0:30,fade=out:960:30'
-c:v libx264 -crf 22 -preset veryfast fadeInOut.mp4
The afade times are in seconds.
#2 Automatically? No. But see workaround below
You can first run ffprobe to get duration.
ffprobe -i ...
This method is best if you need to perform additional filtering:
Use the trim, atrim, setpts, asetpts, and concat filters:
ffmpeg -i input -filter_complex \
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.srt \
-map 0:v -map 0:a -map 1 -map 2 \
-c:v copy -c:a copy -c:s srt \
-metadata:s:s:0 language=eng -metadata:s:s:1 language=ger \
Since the ...
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: frame that stores only the changes between the current picture and previous ones
B-frame: frame that stores differences with previous or future pictures
You could possibly use the curves filter. It has a lighter preset:
ffmpeg -i input -vf curves=preset=lighter -c:a copy output
The red, green, and blue components can be adjusted separately. The following is the same as what the lighter preset uses:
Additionally you can make your own curves preset in Photoshop, ...
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 will be sped up.
x264 supports both 8-bit and 10-bit outputs, and you don't have to do anything special.
If using ffmpeg you can see what pixel formats and bit depths are supported by libx264:
$ ffmpeg -h encoder=libx264
Supported pixel formats: yuv420p yuvj420p yuv422p yuvj422p yuv444p yuvj444p nv12 nv16 nv21 yuv420p10le yuv422p10le yuv444p10le nv20le
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 work for you:
ffmpeg -re -f lavfi -i "movie=filename=input.mp4:loop=0, setpts=N/(FRAME_RATE*TB)" output.mp4
Zero loop= arguments means infinity loop. Values ...
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 duration / total # of frames
You can just specify -r 30000/1001 to maintain the average rate (near-abouts). You don't specify which format you're outputting to, ...
This will output a lossless H.264 video where frames will use information from other frames
ffmpeg -f image2 -r 30 -i %09d.jpg -vcodec libx264 -profile:v high444 -refs 16 -crf 0 -preset ultrafast a.mp4
Explanation of options:
-f image2 - tells ffmpeg to select a group of images
-r 30 - tells ffmpeg to encode at 30 frames (or images) per second (change ...