Hot answers tagged

48 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.
Gyan's user avatar
  • 31.8k
9 votes
Accepted

What is the ffmpeg filter equivalent of "Automatic levels" for colors?

Here's the details on what the presets do: [PRESET_COLOR_NEGATIVE] = { "0/1 0.129/1 0.466/0.498 0.725/0 1/0", "0/1 0.109/1 0.301/0.498 0.517/0 1/0", "0/1 0.098/1 0.235/0.498 0.423/0 1/0", ...
Gyan's user avatar
  • 31.8k
8 votes
Accepted

Correct "stripes" in VHS record

Those are interlacing artifacts. They become visible when the motion in the video is faster than the field rate, so that when both fields are combined into a progressive scan image, the movement is ...
Michael Liebman's user avatar
6 votes

How to set pts time format when using ffmpeg filter to add timestamp

Do In order to draw Timestamp: 01:25., you should specify this one to (feed) ffmpeg: drawtext = text = 'Timestamp\: %{pts\:gmtime\:0\:%M\\\:%S}.' Don't If you specify this one to (feed) ffmpeg: ...
Константин Ван's user avatar
6 votes

Removing / Overlaying logo on mp4 video format with ffmpeg on linux

Your command is missing double quotes around the filter definition : ffmpeg -i input.mp4 -vf "delogo=x=270:y=190:w=40:h=40" -c:a copy output.mp4 (as explained in FFmpeg filters documentation) ...
audionuma's user avatar
  • 470
5 votes
Accepted

replace black frames with previous frames

It's possible to have the black frames removed and earlier frames duplicated. ffmpeg -i in.mp4 -vf blackframe=0,metadata=select:key=lavfi.blackframe.pblack:value=50:function=less -vsync cfr -c:a copy ...
Gyan's user avatar
  • 31.8k
4 votes

FFMPEG: Why does the concat filter cause loss of a/v sync/lipsync?

Split using -f segment -segment_time 10 and end with 360a-a%03d.mp4. Then create a text file with one entry on each line like file '360a-a001.mp4, interleaving the entries in the correct order. Then ...
Gyan's user avatar
  • 31.8k
4 votes
Accepted

mplayer/ffmpeg How to set caca filter's output size

Found. Caca library is driven mostly by environment variables rather than filter params. export CACA_GEOMETRY=200x78 mplayer -vo caca $INPUT
Ondra Žižka's user avatar
4 votes
Accepted

ffmpeg: can I crop using vf while also using filter_complex at the same time?

Use this: ffmpeg -i input.mp4 -filter_complex \ "[0:v]crop='if(gte(iw,ih),ih,iw):if(gte(ih,iw),iw,ih)',scale=720x720,split=3[1v][2v][3v]; \ [1v]trim=0:4.95,setpts=PTS-STARTPTS[v1]; \ [2v]trim=4.95:...
Gyan's user avatar
  • 31.8k
3 votes
Accepted

How to improve quality of a WebCam video?

More Light You're seeing noise for two reasons. One is the tiny sensor of your webcam, but since you don't want to buy a new one right now, you can't do anything about that. However, the sensor size ...
MoritzLost's user avatar
  • 5,392
3 votes
Accepted

How to concatenate multiple videos with fades (from- and to-black) in-between?

So here is what I came up with. A not fully one-liner solution 1) Generate black clips ffmpeg -f lavfi -i "color=black:s=1920x1080:r=30" \ -f lavfi -i "anullsrc=r=48000:cl=stereo" ...
TedGrassman's user avatar
3 votes
Accepted

How to set pts time format when using ffmpeg filter to add timestamp

Use text='timestamp \: %{pts\:gmtime\:0\:%H\\\:%M\\\:%S}'
Gyan's user avatar
  • 31.8k
3 votes
Accepted

Add semi-transparent box around subtitle

Use ffmpeg -i movie.mkv -strict -2 -vf "subtitles=subtitle.srt:force_style='FontName=ubuntu,fontsize=30,BorderStyle=3,OutlineColour=&H80000000',scale=720:-1" -qscale:v 3 Movie.avi See Style ...
Gyan's user avatar
  • 31.8k
3 votes

"ffmpeg" set fontsize and font

I did solved this with " " "subtitles=subtitle.srt:force_style='FontName=ubuntu,Fontsize=30'"
Slobodan Vidovic's user avatar
3 votes

ffmpeg concat with or without audio

Use the concat demuxer instead: Create a text file of the following format file 'C:\source.mp4' inpoint 0 duration 1 file 'C:\source.mp4' inpoint 3 duration 1 file 'C:\source.mp4' inpoint 6 duration ...
Gyan's user avatar
  • 31.8k
3 votes
Accepted

FFmpeg: afade plugin, how to specify time 1:55 if colon separates filter parameters? Escape

Enclose the time argument in single quotes and escape the colons within. So, afade=t=out:curve=hsin:st='00\:0\:30':d='00\:00\:10'
Gyan's user avatar
  • 31.8k
3 votes

Add noise to video while maintaining compressibility

As you say, noise by definition doesn't compress well. You can try different types of noise in FCP. The Add Noise filter has several choices - Gaussian is a reasonable simulation of film grain, but ...
user1118321's user avatar
  • 2,146
3 votes
Accepted

FFMPEG duplicates the first frame when encoding

You can skip that first frame during the computation process. ffmpeg -y -i "720p50_mobcal_ter.avi" -i "720p50_mobcal_ter.mpg" -filter_complex "[1:v]trim=start_frame=1,setpts=PTS-STARTPTS[cut];[0:v][...
Gyan's user avatar
  • 31.8k
3 votes
Accepted

Color leakage effects with ffmpeg blend=all_expr

The default pixel format for testsrc filter is rgb24, which gets converted to yuv444p for encoding to H264. The default pixel format for color is yuv420p, which is kept as-is. The blend filter ...
Gyan's user avatar
  • 31.8k
2 votes
Accepted

Accurate audio selection

This command, which used t reference for aselect, worked for me: ffmpeg -i AV36_1.avi -vf "select=between(n\,200\,399),setpts=PTS-STARTPTS" -af "aselect=between(t\,(200/15)\,(399/15)),asetpts=PTS-...
Gyan's user avatar
  • 31.8k
2 votes
Accepted

Stack images with "hstack"-filter from video or image sequence in ffmpeg

You're better off using the tile filter for this: ffmpeg -i INPUT.mov -vf fps=1,scale=192:108,tile=54x1 output.jpg The tile argument is the size of a rectangle. So for a 54 second video, 54x1 ...
Gyan's user avatar
  • 31.8k
2 votes

What -preset medium stand for in ffmpeg

On the page you linked to it explains it fairly well: A preset is a collection of options that will provide a certain encoding speed to compression ratio. A slower preset will provide better ...
stib's user avatar
  • 13.6k
2 votes
Accepted

What -preset medium stand for in ffmpeg

preset is a private option that may be defined for an encoder, such as libx264. It is a shorthand method to set a whole bunch of options at once, and won't have any effect if set when using an encoder ...
Gyan's user avatar
  • 31.8k
2 votes
Accepted

ffmpeg fade to specific color values over time

The lut filter expressions don't work with time. geq does. geq=r='(1-0.7*min((T-S)/D,1))*p(X,Y)':g={the same as r}:b={the same}:enable='gte(t,S)' S should be your start time in second. D is duration ...
Gyan's user avatar
  • 31.8k
2 votes

If I use a normal build of ffmpeg how take advantage of video acceleration for scale?

The answer to your second question is yes. Change -c:v libx264 to -c:v h264_nvenc. I use those builds as well. If you use the option -encoders you can see a list of included video and audio codecs. ...
Gordon's user avatar
  • 106
2 votes
Accepted

Replace all completely black frames with interpolated frames

After poring over the documentation all weekend, I figured out how to use the minterpolate filter to do motion interpolation. The full command is ffmpeg -i in.mp4 -vf blackframe=0,metadata=select:...
BlueRaja - Danny Pflughoeft's user avatar
2 votes
Accepted

Combine -vf yadif,format=yuv420p and -filter_complex for watermark

Use ffmpeg -i input.mp4 -i logo.png \ -filter_complex "[0]yadif,format=yuv420p[main];[1][main]scale2ref=iw/5:ow*450/450[wm][vid];[vid][wm]overlay=W-w-W*3/100:H-h-H*1/100:enable='gt(t,30)'" \ -...
Gyan's user avatar
  • 31.8k
1 vote

How to use ffmpeg to fade in/out a veriable frame rate video clip with unknown duration

This works here ffmpeg -i VID_1.mp4 -sseof -2 -copyts -i VID_1.mp4 -lavfi "[1]fade=out:s=1:d=2[tail];[0][tail]overlay,fade=in:s=0:d=2,scale=640:-2[video];anullsrc,atrim=0:2.1[audiotail];[0][audiotail]...
Gyan's user avatar
  • 31.8k
1 vote
Accepted

ffmpeg error "Error initializing complex filters"

Font paths have to be escaped: fontfile='c\:\\Windows\\Fonts\\simsun.ttc'
Gyan's user avatar
  • 31.8k

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