Hot answers tagged

89

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 \ output.mp4 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). enable='between(...


62

You can use ffmpeg to create video from audio using several filters. ahistogram Convert input audio to a video output, displaying the volume histogram. ffmpeg ffmpeg -i input.flac -filter_complex \ "[0:a]ahistogram,format=yuv420p[v]" \ -map "[v]" -map 0:a output.mp4 ffplay ffplay -f lavfi "amovie=input.flac, asplit [a][out1]; [a] ahistogram [out0]" ...


47

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 ...


27

The article you linked is not very good. Normally, single pass bitrate encodings convert your bitrate into a RF value with a maximum bitrate limit and takes it from there. x264's one-pass ABR ratecontrol is not implemented as CRF + limit. He's right that 2pass is by far the best way to hit a target bitrate, though. And he apparently doesn't realize that ...


26

The image sequence muxer has a start number option, so ffmpeg -i video.webm -start_number 98 image-%03d.png


24

Use drawbox for the box, and drawtext for the text. ffmpeg -i input.mp4 -vf \ "format=yuv444p, \ drawbox=y=ih/PHI:color=black@0.4:width=iw:height=48:t=fill, \ drawtext=fontfile=OpenSans-Regular.ttf:text='Title of this Video':fontcolor=white:fontsize=24:x=(w-tw)/2:y=(h/PHI)+th, \ format=yuv420p" \ -c:v libx264 -c:a copy -movflags +faststart output.mp4 ...


24

#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 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 ...


18

There was one, but it fell in to disuse and isn't used very often anymore, largely because of the lack of mobile support, but also due to security issues it created. It was called Flash.


18

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 ...


17

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.


15

I found that using Adobe Media Encoder is much easier when just cropping. Add the video to the queue and open the export settings. On the source tab you can crop the video and there you can also enter how many pixels to remove at each side. Remember to set the correct output size in the video tab on the right side. Here is a screenshot showing how i did it:


14

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 ...


14

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 command: ffmpeg -i input.mp4 -i image.png \ -filter_complex "[0:v][1:v] overlay=W-w:H-h:enable='between(t,0,20)'" \ -pix_fmt yuv420p -c:a copy \ ...


13

A videofilter in ffmpeg always has to modify pixel information hence the reason why you need to re-encode. It seems logical at first that you wouldn't have to do this when cropping but the way lossy video codecs work makes this pretty impossible without re-encoding everything. They usually don't see an array of pixel information but a much more complex ...


12

2017 update: ffmpeg supports h264 and h265 NVENC GPU-accelerated video encoding. You can do 1-pass or 2-pass encoding at the quality that you choose, for either hevc_nvenc or h264_nvenc, or and even with an entry-level GPU it's much faster than non-accelerated encoding and Intel Quick Sync accelerated encoding. 2-pass high-quality encoding: ffmpeg -i in....


12

A while back I ran some introductory video editing workshops. I used to tell the participants about a particularly cool effect that I once found in Pinnacle; it was a pinhata that came swinging into the first video along with a stick that hit the second video out of it and it unfolded across the screen. The point of this anecdote is the following: Don't use ...


12

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.5, areverse" output.mp4 [edit 2019-07-24: Note that this solution is not good for streaming solutions since it requires the full track to be processed before ...


11

Yes, this is possible using ffmpeg and the mkv container. An example command sequence would be: ffmpeg -i input1 -i input2 -c copy -map 0 -map 1 output.mkv source Breaking down the command: -i input1 This selects the first input file. Could be something like my video_track1.mov. -i input2 Here you can specify the second input file. You can add another ...


11

This slows down one part of a video and keeps the rest as is. ffmpeg -i Soon.mp4 -filter_complex "[0:v]trim=0:2,setpts=PTS-STARTPTS[v1]; [0:v]trim=2:5,setpts=2*(PTS-STARTPTS)[v2]; [0:v]trim=5,setpts=PTS-STARTPTS[v3]; [0:a]atrim=0:2,asetpts=PTS-STARTPTS[a1]; [0:a]atrim=2:5,asetpts=PTS-STARTPTS,atempo=0.5[a2]; [0:a]atrim=5,...


10

Use ffmpeg and the "transpose" filter as "poor" suggested. For example, if your files are mp4 and are in the current directory: mkdir -p rotated for f in *.mp4; do ffmpeg -i "$f" -vf transpose=2 -c:a copy -metadata:s:v rotate="" rotated/"$f"; done The transpose value can be "1" or "clock" for clockwise rotation, "2" or "cclock" for counter-clockwise ...


10

Using the latest ffmpeg General users should always use ffmpeg from the current git master branch (the latest code available): When encountering an issue the first thing to do is check to see if you are using a build from git master. It is considered stable. It will have more bug fixes and features. FFmpeg development is very active. If you want to get ...


10

Yes. MPEG-4 Part 14 (the MP4 container format) supports any number of objects (e.g. video, audio and subtitle streams) and isn't limited to only one stream per content type. In practice however, you seldom see a video file that has multiple video streams, because the range of applications for this is very limited. I would also advise you not to put multiple ...


10

The usual solution for this situation: -fflags +genpts It should eliminate the warning, but there's no guarantee your sync issues will be solved.


10

Use ffmpeg -i in.mp4 -vf yadif,format=yuv420p -force_key_frames expr:gte(t\,n_forced/2) -c:v libx264 -crf 18 -bf 2 -c:a aac -q:a 1 -ac 2 -ar 48000 -use_editlist 0 -movflags +faststart out.mp4 -vf specifies video filters yadif will deinterlace videos if they're interlaced. format=yuv420p will produce pixel format with 4:2:0 chroma subsampling. -...


9

I think I've found the easiest way! Just crop the area you want. Go to the Export window without worrying about the black margins showing. Set the final resolution and export settings as you would want. (THIS IS THE IMPORTANT ONE) On the top left of the Export Window, there are two tabs; SOURCE and OUTPUT. Go to the Source Tab. On the left-most side, find ...


9

MERGING VIDEO CLIPS To combine video clips there is something called Nested Sequence. A very powerful technique. When adding clips to a timeline you are working in what is called a sequence (normally named Sequence 01), drop your two clips into your timeline and rename your sequence 01 to something like 'My day trip to the market'. Select a different ...


9

This is possible but will require scripting. ffprobe will be used to determine the duration of the input, then the countdown and background box will be created by the drawtext filter. A 30 second input will start from 30 and count down to 0. Example: input=input.mp4 duration=$(ffprobe -loglevel error -show_entries format=duration -of default=nw=1:nk=1 "$...


9

Here's a way to do it with the blackdetect and trim filters. First, a better way to get the blackdetect output is via ffprobe because it is capable of writing structured data such as XML, JSON or one key=value per line. You do this using metadata injection: ffprobe -f lavfi -i "movie=/path/to/input.mp4,blackdetect[out0]" -show_entries tags=lavfi....


9

Run ffmpeg -i titlefile.mp4 -vf setdar=16/9 -video_track_timescale 29971 -ac 1 newtitle.mp4 and then run concat with the new title video. Modern containers like MP4 have Presentation TimeStamps, which are denominated with reference to a timebase. So, if the timebase value is 1/500 and a frame's PTS is 200, then that tells the video player to show that ...


9

so now I'm wondering if my tapes are marked as PAL SECAM, do I need a PAL VCR? Yes, VCRs partially deconstruct the signal to encode it on the tape, and so are specific to a particular analogue video format. In practical terms, if you try to play a PAL tape in an NTSC VCR connected to a PAL TV, you'll probably get a distorted black-and-white image, or ...


Only top voted, non community-wiki answers of a minimum length are eligible