Hot answers tagged

2 votes
Accepted

ffmpeg - how do i crop different values from top and bottom

After two days of looking for an answer to this question, I found out the logic behind it and I'll share it here, because this topic looks as the best place for it, I hope it helps people understand ...
WYSIWYG's user avatar
  • 36
2 votes

Programmatically detect 'packed B-frames' AVI files

I wanted to avoid grepping ffmpeg's warnings from stdout/stderr in my own tools, so I looked for an alternative/stabler approach. The key to how ffmpeg detects packed B-frames is here: https://github....
Alexandro Sánchez's user avatar
2 votes

Meaning of ffmpeg output (tbc, tbn, tbr)

abbrev full variable explanation fps frames per second AVStream.avg_frame_rate average frame rate = total frames / total seconds. A variable frame rate video may have an fps of 57.16 tbr time base, ...
wisbucky's user avatar
  • 131
2 votes
Accepted

How to re-encode leaving only every Nth frame in?

See FFmpeg documentation regarding select filter https://ffmpeg.org/ffmpeg-filters.html#Examples-160, so to keep every 60th frame use -vf "select=not(mod(n\,60))" And this has been already ...
tbucher's user avatar
  • 76
2 votes
Accepted

Why does ffmpeg flip upside-down the video when concatenating with -f concat?

The concat demuxer amalgamates all its inputs and presents them as a single input. It takes the properties of the first input as representing the properties of the amalgam. Since the 1st input has a ...
Gyan's user avatar
  • 32.3k
2 votes
Accepted

ffmpeg-converted video file won't play in Windows Media Player or Movies & TV

Legacy media players like Windows Media Player may be finicky about the files they will accept. In this case, it looks like the audio channel count of 6 is too high. Add the CLI option -ac 2 and check....
Gyan's user avatar
  • 32.3k
2 votes

ffmpeg - inacurate overlay position

Change base video to full chroma sampling and try. [0:v] select='between(t,1.247,2.550)+between(t,4.181,5.681)', setpts='PTS-STARTPTS-((gt(T,2.550)*1.630))/TB',format=yuv444p[v0]; and [v0][1:v] ...
Gyan's user avatar
  • 32.3k
2 votes

ffmpeg, first second of cut video part freezed

What works for me was: ffmpeg -ss 00:01:00 -i video.mp4 -to 00:02:00 -c:v libx264 -c:a aac cut.mp4
YodaCode's user avatar
2 votes

ffmpeg one draw text to multiple outputs

You need to split the drawtext output and then map a split result for each output. ffmpeg \ -i ./source/video/women/1.mp4 \ -i ./source/audio/women.mp3 -y \ -filter_complex drawtext=fontsize=80:...
Gyan's user avatar
  • 32.3k
1 vote

How to hold the last frame when using ffmpeg

This solution is much faster because it does not require re-encoding. If there already is an existing audio stream: ffmpeg -i in.mp4 -vcodec copy -af apad -t 60 out.mp4 If there is NO existing audio ...
wisbucky's user avatar
  • 131
1 vote

Unable to find a suitable output format for 'libfdk_aac' libfdk_aac: Invalid argument

The error is happening because the -x265-params option is missing the required parameter. Instead of a real parameter to pass to libx265, it is swallowing the audio codec option. See Passing Options ...
Alain1A45's user avatar
  • 111
1 vote
Accepted

Lossless masking of MP4/h.264

The short answer is no. You can use the drawbox filter to overlay a gray or any other color box over a rectangular region of a video. However, it then has to be re-encoded. You can specify lossless ...
Gyan's user avatar
  • 32.3k
1 vote

Codecs supporting variable resolution (y height of frame changes with time)?

create videos with different resolutions: ffmpeg -lavfi "color=green:704x396;anullsrc" -t 1 "in-01.webm" -y ffmpeg -lavfi "color=yellow:640x480;anullsrc" -t 1 "in-02....
Баяр Гончикжапов's user avatar
1 vote
Accepted

ffmpeg how to change audio tbn

There's no such option for audio in MP4. MKV uses a fixed timescale of 1000 which is why audio has that tbn. In MP4, ffmpeg will set it to the sample rate. The latter is precise. Notice the timestamps ...
Gyan's user avatar
  • 32.3k
1 vote
Accepted

Fade transition - fade vs. fadefast vs. fadeslow

They differ in rate of progression, i.e. fade is a linear progression, so that at half the duration, fade status is 50% i.e. both inputs are equally mixed. For fadefast, it starts fast and then slows ...
Gyan's user avatar
  • 32.3k
1 vote

Can you fix videos with "error: more than 5 seconds of late video" without re-encoding with ffmpeg?

Will just note, that I experienced this on one machine's vlc; when I tried on what would be presumably the same vlc version on the same OS (Ubuntu 20.04) but on a different machine, I did not get that ...
sdbbs's user avatar
  • 121
1 vote
Accepted

ffmpeg seek position options not working with h264

.h264 is a raw format. It has no timestamps or metadata storing the input duration. Therefore you need to convert it to mp4 or another suitable format. You can mux to MP4 and use that. ffmpeg -i xx....
Gyan's user avatar
  • 32.3k
1 vote

FFmpeg: maximum VHS quality?

we're recently experimenting with FFMPEG (analog) capture too, so we opened this "issue" @ github: https://github.com/cdgriffith/FastFlix/issues/418 Feel free to join the discussion in order ...
FORART npo's user avatar
1 vote
Accepted

ffmpeg: video size/quality changes when applying ffmpeg with no filters or other parameters

When you run ffmpeg without specifying any options, its default behavior is to decode the audio and video and then reencode them. In the case of mp4, it chooses its aac encoder for the audio, and ...
suzumer's user avatar
  • 26
1 vote
Accepted

A video tool or ffmpeg filter to fix slightly shaky films from the 70s and 80s?

This is most often caused by interlace artifacts as televisions and video devices prior to 1998 used interlace to pass video between them. This included VCR's DVD players TV's (even HDTV's at the time)...
user40484's user avatar
1 vote

Error when trying to execute ffmpeg command

This will get you one frame at the one minute mark. ffmpeg -ss 00:01:00 -i "[FilePath]" -frames:v 1 img.png
1957classic's user avatar
1 vote

Is it possible to embed a thumbnail in a .mkv file?

I was also going down this rabbit hole and found that there's an option -attach filename that's more specific to mkv files. It's at the end of the "Main Options" section of the manual: https:...
Samuel Powell's user avatar
1 vote
Accepted

Convert mp4 to webm in a reasonable time

First of all, consider to avoid "2-pass" if you only need to convert format. Most of time, CRF is enough unless you have specific requirement on the output file size. Use "CRF" to ...
Qiang's user avatar
  • 26
1 vote

Ignore region of video for vidstabdetect

You can use a crop filter in the detect phase. I do this to ignore the date/timestamp in the bottom of my old videos. E.g. for my 1440x1080p 60fps video I use -vf "crop=1440:750:1:1 , ...
Neil Erath's user avatar
1 vote

changing timebase of mkv file

Although the Matroska format supports up to nanosecond precision timestamps, currently ffmpeg only seems to support milisecond timestamps, which is the default value. (There is a patch to fix this, ...
goweon's user avatar
  • 111
1 vote

ffmpeg: Make letters appear one at the time, like a typewriter

After improving for my case what Thiago said. I arrived to this: First the ffmpeg code For mp4: ffmpeg -f lavfi -i color=c=black:s=640x480:d=8 -vf "subtitles=typewriter.ass" -...
Dorian Grv's user avatar
1 vote

Widely compatible video format with lossless audio

To my knowledge, the only lossless audio format with really wide compatibility is plain old linear PCM. As container format, MP4 is the most wide-spread.
soundflix's user avatar
  • 111
1 vote

How can you use ffmpeg's afftdn -sn flag to sample noise from a reference noise file?

This worked beautifully, many thanks to @Gyan. Just to add to the accepted answer, as I needed to do this for a large number of mp3 audio files with similar noise profiles and with a naming scheme of ...
Musical BenjiMan's user avatar
1 vote

FFMPEG - convert video to Black & White with threshold?

The main answer didn't work for me, this did: ffmpeg -i input.mkv -f lavfi -i color=gray:s=1280x720 -f lavfi -i color=black:s=1280x720 -f lavfi -i color=white:s=1280x720 -filter_complex "[0:v]...
jangles's user avatar
  • 111
1 vote

How do I fade in and out in FFmpeg?

As the topic asks for ffmpeg in general, an additional info to the answer of MarianD if you have only audio; there are no frames, so you have to use the start time option and for that you have to use ...
Schusch's user avatar
  • 15

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