text:
How to create this effect in Premiere or After Effects
Is there a a name for this effect where the pace of the footage is changing as seen in this video?

?
Thank you!

Hi there. What is your question? Is it "how to create" or is it "what is the name"? Please edit your post to clarify

Looks like speed ramping on each beat https://www.youtube.com/watch?v=gtrcAKl1Rfs


text:
Final Cut Pro and/or Compressor exports not showing progress
Pretty much any time I am exporting from Final Cut Pro, either via it's native "share" interface or by "send to compressor" the progress bar does absolutely nothing for a very long time, although in Compressor I can see at least the "elapsed time" is moving.
When I open Activity Monitor though I can see my CPU is working hard, and there is a process using a ton of resources called "VTEncoderXPCService".
Am I doing something wrong? Is this normal behavior?
With short videos it may only linger in this state for a few minutes, but right now I am compressing nine hours of footage and it has so far been in this state of not showing any progress for ~25 minutes.

source: Stack Exchange

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/

sort: votes


text:
Rounded Border in .ass subtitle
I am highlighting subtitle like this
Dialogue: 0,0:00:00.00,0:00:05.00,Default,,0,0,0,,{\t(0,500, \3c&H00FFFF&\3a&H128&)}highlighted
How to change the border so it will look rounded?
I have used \be and \bord but it looks this tag not for border radius

The only way to achieve rounded corners is to use draw text tag.
Here is an example of dialogue for rounded corners box.
Dialogue: 0,0:00:00.00,0:00:01.00,Default,,0,0,0,,{\an7\p1\bord0\shad0\1a&HAA&\c&H000000&\pos(100,100)\an7}m 0 10 b 0 0 10 0 20 0 l 70 0 b 80 0 80 10 80 10 l 80 30 b 80 40 70 40 60 40 l 20 40 b 0 40 0 30 0 30 l 0 30{\p0}

These are some links for more detailed explanation and examples 1, 2

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/


text:
Slideshow mp4 from jpg files with ffmpeg
Have an command to make slideshow mp4 from *.jpg files:
ffmpeg -r 1/3 -f concat -safe 0 -i <(ls -v *.jpg | sed "s|^|file '$PWD/|") -vf "scale='min(1920,iw)':min'(1080,ih)':force_original_aspect_ratio=decrease,pad=1920:1080:(ow-iw)/2:(oh-ih)/2" -c:v libx264 -pix_fmt yuv420p -r 60 -preset slow -crf 14 slideshow.mp4
Need good effects from one jpg to another like morphing or just fade in fade out, not just "one picture 3 sec, next picture 3 sec, etc.". Need exactly mp4 video file as result to make possibility to view this on other devices: mediaplayer, tv, smartphone etc.

I have done some research around this problem. Looks like it’s not easy to construct a one line command. Need a script with several steps describing the effects between each individual picture. Something with -loop 1 -i './01.jpg' -loop 1 -i './02.jpg' use filter_complex and something like setpts=PTS-STARTPTS,split=2[stream1out1][stream1out2];[stream2blurred][stream2raw] step by step.
This is useful github link with slideshow-scripts, e.g. blurred background, fade in/out, zoom in/out.  But this scripts eat many memory, slow generation time, and big mp4 final size.
So looks like initial command not so bad for using as is.


text:
How to record glitch footage on a tv?
I’ve got an analog glitch fx module. It takes rca video input and outputs the same.
The footage is on my pc.
My plan is to connect it as follows.

Play the footage on my pc.
HDMI cable from pc to a (HDMI/RCA) converter.
RCA cable from converter to glitch fx
RCA cable from glitch fx to tv.

My question is: is there any way I can record the footage from the tv directly onto something eg memory card, stream to another pc, dvd, some sort of other recorder?
At the moment, the only way I know for sure is to record the tv with a camera pointed at it.
I think the problem is that the tv will only output on one ‘source’, so for it to play the rca in, I don’t think it will send the video out via hdmi to another pc where I could record it, for example.
Any help appreciated.

If you are wanting to record the footage, why do you need the TV at all? Why not use RCA cable from glitch fx to recording device?

@DrMayhem because I need to see it while it records so I can modulate the fx in real time. I think a fix would be a HDMI capture card or a DVD player that connects via HDMI and has an rca in, they might make the quality worse though.


text:
Washed out colours when converting MOV to WEBM using FFMPEG
I'm trying to convert a simple animation from MOV to WEBM so it can be used as an OBS alert for my Twitch stream.
However, when I convert using FFMPEG, the colour is slightly washed out.

This is what I'm currently using:
ffmpeg -i "file_name.mov" -c:v libvpx-vp9 -lossless 1 -auto-alt-ref 0 "file_name.webm"

I was not expecting the colour to be slightly washed out.
Is there anyway to ensure that the WEBM, once converted from the MOV file does not lose its colour?
Many thanks.


text:
Premiere Pro: How to add multiple masks for Lumetri Color effect?
I'm expected to do color correction to multiple separate parts of the same clip at the same time, which is why I have assumed using multiple masks for Lumetri Color effect and changing the effect for each mask would affect the part that is masked. However, it seems having multiple masks doesn't matter: It adds the same effect color change to each mask. How is it that I can use Lumetri Color to make a color correction on the same part of the clip but with different colors on each mask? After searching on YouTube, the results returned how to use one mask.

I have found an answer!
It works by duplicating the clip and placing it on a track right above (or below), masking each so it only shows the part that is color-corrected as well with no need to mask with Lumetri Color, and the final step is to add the clip that includes the background. That final clip can also be using Lumetri Color but without masking required as long as this is the bottom track.
In order for them to look more natural, I used feathering to make the masks less sharp.


text:
First input link main timebase (1/15360) do not match the corresponding second input link xfade timebase (1/90000)
ffmpeg community
I am new to ffmpeg and i am facing this error for more then 2 days. This ffmpeg command:
!ffmpeg -i "{fromPath}" -i "{toPath}" -filter_complex "xfade=transition={chosenTransition}:duration={transitionDuration}:offset=-1.5" -c:v libx264 -crf 18 -preset veryfast "{outPath}"
I run that previous command 3 times in row where output of the previous command is input that is getting produced as 15360 timebase video i guess.
is giving me this error: "First input link main timebase (1/15360) do not match the corresponding second input link xfade timebase (1/90000)"
So when i merge two of my videos the output is video with (1/15360) timebase. Original videos has (1/90000) timebase.
Pls help what i wana archive is basicly multiple videos inside a folder called "clips" merge together using a random transition from xfade/ffmpeg.
On colab i tried all this ways:
!rm -rf chunks
!mkdir chunks
time.sleep(1)
folderPath = '/content/clips'
videoOutput = '/content/test.mp4'
transitionDuration = 6

videoFiles = [f"{folderPath}/{f}" for f in os.listdir(folderPath) if f.endswith('.mp4')]
random.shuffle(videoFiles)
fromPath = videoFiles[0]
toPath = ''
outPath = ''
transitions = ['fade', 'wipeup', 'slidedown', 'circleclose', 'radial' , 'hrslice', 'hblur', 'smoothleft', 'smoothright']

for videoIndex, videoName in enumerate(videoFiles):
    if videoIndex == 0:
        continue
    toPath = videoName
    chosenTransition = random.choice(transitions)
    print('chosenTransition', chosenTransition)
    clipDuration = int((imageio.get_reader(fromPath)).get_meta_data()['duration']) - transitionDuration
    # !echo -i /content/clips/clip0.mp4 -i /content/clips/clip1.mp4 -filter_complex xfade=transition={chosenTransition}:duration=3:offset={clipDuration} dissolveVideo.mp4

    if videoIndex == len(videoFiles) - 1:
        outPath = videoOutput
    else:
        outPath = f'/content/chunks/chunk{videoIndex}.mp4'
    time.sleep(2)

    # !echo -i "{fromPath}" -i "{toPath}" -filter_complex "[0:v]xfade=transition={chosenTransition}:duration=3:offset={clipDuration},settb=1/19000[v0];[0:a][1:a]acrossfade=d=3[aout]" -map "[v0]" -map "[aout]" -c:v libx264 -crf 18 -preset ultrafast "{outPath}"
    !ffmpeg -i "{fromPath}" -i "{toPath}" -filter_complex "xfade=transition={chosenTransition}:duration={transitionDuration}:offset=-1.5,settb=1/15360" -c:v libx264 -crf 18 -preset veryfast "{outPath}"
    # !ffmpeg -i "{fromPath}" -i "{toPath}" -filter_complex "[0:v]settb=1/15360,setpts=PTS-STARTPTS[v0];[1:v]settb=1/15360,setpts=PTS-STARTPTS[v1];[v0][v1]xfade=transition={chosenTransition}:duration={transitionDuration}:offset=-1.5[vout]" -map "[vout]" -c:v libx264 -crf 18 -preset ultrafast "{outPath}"
    # !ffmpeg -i "{fromPath}" -i "{toPath}" -filter_complex "[0]settb=AVTB [0v]; [1]settb=AVTB [1v]; [0v] [1v]xfade=transition={chosenTransition}:duration={transitionDuration}:offset=1" -c:v libx264 -crf 18 -preset ultrafast "{outPath}"
    # !ffmpeg -i "{fromPath}" -i "{toPath}" -filter_complex "[0:v]xfade=transition={chosenTransition}:duration=3:offset={clipDuration},settb=1/15360[v0];[0:a][1:a]acrossfade=d=3[aout]" -map "[v0]" -map "[aout]" -c:v libx264 -crf 18 -preset ultrafast "{outPath}"
    # !ffmpeg -y -progress .progressinfo.dat -i "{fromPath}" -i "{toPath}" -filter_complex "[0:v]settb=AVTB,setpts=PTS-STARTPTS[v0];[1:v]settb=AVTB,setpts=PTS-STARTPTS[v1];[v0][v1]xfade=transition={chosenTransition}:duration={transitionDuration}:offset={clipDuration}[vout];[0:a]asettb=AVTB,asetpts=PTS-STARTPTS[a0];[1:a]asettb=AVTB,asetpts=PTS-STARTPTS[a1];[a0][a1]acrossfade=d=3[aout]" -map "[vout]" -map "[aout]" -c:v libx264 -crf 18 -preset ultrafast "{outPath}"

Firstly, there is nothing wrong with the timebase; ffmpeg can compare timebases, and generate new timebases.
Secondly, the problem is about different frame rates. if you use input frame rate settings
ffmpeg -r 30 -i "{fromPath}" -r 30 -i "{toPath}" ...

or use filter frame rate settings
ffmpeg -i "{fromPath}" -i "{toPath}" -filter_complex "[0:v]fps=30[v0];[1:v]fps=30[v1];[v0][v1]xfade=transition ...

or use same frame rate input streams, i.e. 30 frame per second, on your original command,
, ffmpeg will have no problems generating an output with fading transitions.


text:
ffmpeg - Prevent ffmpeg to skip frames
I am trying to move a png image by 10px over a white background during 2s (fps=25), but the transition I got is not smooth.
Here is the command I am using:
ffmpeg -y -vsync passthrough -f lavfi -i color=c=white:size=300x250 -loop 1 -framerate 25 -i image.png -filter_complex "[0][1]overlay=eval=frame:format=yuv444:x=120:y=lerp(100\,110\,t/2)[s1]" -map "[s1]"  -c:v libx264 -t 2 video.mp4 -hide_banner -loglevel debug

At first I thought that all decimals were rounded to integers, but from what I see in the logs it seems that ffmpeg skips frames that contain a fraction of a pixel as a y coordinate (i.e. 100.2).
Here is the generated video & the log file.
Is there a way to generate a smooth effect?

ffmpeg does not do sub-pixel overlay. Computed co-ordinates are truncated to integers.
The closest to getting a smooth result is to overlay a large PNG on a large background and then downscale the result to the final resolution i.e. [largebg][largefg]overlay=...,scale=300:250:flags=bicubic

do you know if using overlay_cuda (gpu) supports sub-pixels?

No, it does not.

I tried: Scaling by 4, but the result is blurry. Can you think of another way to get the best quality? ffmpeg -y  -vsync 0 -f lavfi -i "color=c=white:size=300x250" -f lavfi -i "color=color=black@0.0:size=1200x1000,format=yuva420p" -loop 1 -i image.png -filter_complex "[2]scale=228:136[s0];[1][s0]overlay=eof_action=repeat:eval=frame:format=yuv444:x=480:y=lerp(400\,440\,t/2)[s1];[s1]scale=300x250:flags=bicubic[s2];[0][s2]overlay[s3]" -map "[s3]" -c:v libx264 -crf 0 -pix_fmt yuv420p -t 2 video_scale.mp4 -hide_banner


text:
How do you extract bitmap subtitles to a standard image format using ffmpeg?
I need to extract bitmap-based subtitles to a standard image format like PNG or BMP. Preserving transparency would be a bonus. I don't need to convert to text, and I don't want a subtitle-specific format.

The key is using the overlay filter to embed the subtitles on a transparent or fixed-color background. Adjust the size and rate to match your input video.
Transparent version
ffmpeg -i my_video.mkv -f lavfi -i "color=size=1920x1080:rate=23.98:color=black@0.0,format=rgba" -filter_complex "[1:v][0:s]overlay,mpdecimate[out]" -map "[out]" -an -vsync vfr frames_%04d.png
This means:

-i my_video.mkv: Input filename
-f lavfi: The next input is a libavfilter graph specification.
-i "color=size=1920x1080:rate=23.98:color=black@0.0,format=rgba": Produce a video stream that is 1080p with a 23.98 fps frame rate. The @0.0 specifier indicates a fully-transparent color, which requires format=rgba.
-filter_complex "[1:v][0:s]overlay,mpdecimate[out]": Overlay the first subtitle stream in input source 0 (the original video) atop the first video stream in input source 1 (the lavfi output). Decimate the output frames by removing all duplicates. Output a stream named "out".
-map "[out]": Use the stream named "out" in the final output.
-an: Audio is disabled.
-vsync vfr: Drop frame timestamps so that each unique frame, in sequence, is output only once.
frames_%04d.png: Output frames_0000.png where 0000 is an increasing number. If you expect more than 10000 unique frames, increase %04d to %05d for 5 digits, etc.

Non-transparent version (much faster?)
If you can tolerate, or prefer, a non-transparent background, the process may run much faster. It goes 3-4x faster on my machine. Just remove the @0.0,format=rgba part.
ffmpeg -i my_video.mkv -f lavfi -i "color=size=1920x1080:rate=23.98:color=black" -filter_complex "[1:v][0:s]overlay,mpdecimate[out]" -map "[out]" -an -vsync vfr frames_%04d.png
Output
You'll get a PNG for each frame of unique subtitle content, plus a frame of black/transparent in between. Maybe there's a way to filter out those blank frames, but for now I can handle that outside ffmpeg.
Caution
If you add -t to limit the time of the extracted subtitles, be sure to add it twice: once after the -i for the input video and once after the -i for the black frames & subtitles. This will ensure that both streams terminate at the specified time; otherwise one stream will keep going for the full video duration.


text:
How to animate transparent images using Xfade and ffmpeg
I am trying to making a video using 1 background image and 5 transparent images (all the images are in same dimensions 500x500). Where the 5 transparent images animate for 2 seconds (Slideup, WipeDown, Fade etc.) and come to their original positions using Xfade and FFMpeg.

When I tried the example in the Xfade site using 3 images (1 background image and two transparent images), the first image i.e. 1.png is overlaid on the background image i.e. bg.jpg and after 4 seconds next the second image i.e. 2.png moved from right to left, I got the transition what I expected but the 2.png is overlapping the 1.png, where I want to show the 1.png also. Below is the example I tried.
ffmpeg -loop 1 -t 5 -i bg.jpg -loop 1 -t 5 -i 1.png -loop 1 -t 5 -i 2.png -filter_complex "[1][2]xfade=transition=wipeleft:duration=1:offset=4,format=yuva420p[trans];[0][trans]overlay=10:10" -c:v libx264 -preset ultrafast -tune stillimage -c:a aac -strict experimental -b:a 192k output3.mp4
All I want to animate the 5 images on a background image, each image should come one after the other with 2 seconds transitions and all the 5 transparent images should overlay on the background image and all the images should be visible. Over all the video should be of 20 seconds length.
Note: all the images are in same dimensions 500x500, I attached all the images below.
Thank you.

add blank video: `-filter_complex "
color=black@0:s=500x500[t1];
[t1][1]xfade=transition=wipeleft:duration=1:offset=2[t1];
[0][t1]overlay=10:10[o1];
color=black@0:s=500x500[t2];
[t2][2]xfade=transition=wipedown:duration=1:offset=2[t2];
[o1][t2]overlay=10:10...`

@БаярГончикжапов Hi, thank you for the answer... i got the output what i am looking for...
i have few doubts...
1.How to set the duration of the video to fixed time Ex: 30 seconds duration
2. How to add a song to this (here if the song duration is 40 sec i.e, greater than the fixed duration then final video duration should be 40 secs)
3. How to control the animation to get smooth transition effects...
Thank you.

...-t 30 -i bg.jpg... 2. ... -shortest output.mp4

@БаярГончикжапов How to add the song? i added -i audio.mp3 but it doesn't work...

ffmpeg -loop 1 -i bg.jpg ....png -t 40 -i audio.mp3 -filter_complex ... -shortest out.mp4

@БаярГончикжапов Thank you.

authors: Баяр Гончикжапов


text:
How can I combine a screenshot and two video files with ffmpeg?
I have a folder with video files. Some are .mov, some are .mp4. As a first step I am converting the .mov-files into .mp4 with:
while read mov; do
   mp4=$(echo "$mov"|sed -e 's|\.mov$|.mp4|i')
   if [ "$mov" == "$mp4" ]; then
     echo "Failed to generate unique MP4 filename for file $mov"
   fi
   ffmpeg -i "$mov" -c:v libx264 -f mp4 "$mp4"
 done < <(find . -type f -iname '*.mov')

This works technically fine.
As a second step I need to merge two video files: the first one is always the same (intro.mp4 with audio), the second file is the either converted .mov or the .mp4 from the folder (also with audio).
Additionally I need a screenshot of the first frame from the second video, which shall be the very first frame and visible for e.g. half a second (for e.g. youtube-shorts to differentiate the videos).
I create the screenshot with
ffmpeg -i ${fzbVideo} -ss 1 -vframes 1 ${cover}"_%01d.jpg"

which works perfectly fine.
As far as I could I followed the example shown here and the documentation of ffmpeg
and created a loop for all the videos and the steps of merge screenshot and videos:
for fzbVideo in *.mp4; do
    # intro should be at the beginning of each video
    intro="intro/fzb-intro.mp4"
    # getting a cover imge
    cover="$(basename ${fzbVideo} .mp4)_cover"
    # naming the output file
    fzbVideoOutput="$(basename ${fzbVideo} .mp4)_output.mp4"
    #   create a cover image from the first frame of the video
    ffmpeg -i ${fzbVideo} -ss 1 -vframes 1 ${cover}"_%01d.jpg"
    # combine the cover image with the intro and the actual video file
    ffmpeg \
-loop 1 -framerate 1 -t 1 -i ${cover}"_1.jpg" \
-i ${intro} \
-i ${fzbVideo} \
-f lavfi -t 0.1 -i anullsrc=channel_layout=stereo:sample_rate=44100 \
-filter_complex '[0:v:0][0:a:0][1:v:0][1:a:0][2:a:0][2:a:0]concat=n=3:v=1:a=1' ${fzbVideoOutput}
done

But this creates the error:
Stream specifier ':a:0' in filtergraph description [0:v:0][0:a:0][1:v:0][1:a:0][2:a:0][2:a:0]concat=n=3:v=1:a=1 matches no streams.

What do I need to change?
Additionally, is there a way to combine the converstion from .mov to .mp4 also in the loop (if necessary)?

Meta information: content from the CLI, in case this is important information:
ffmpeg version 6.0 Copyright (c) 2000-2023 the FFmpeg developers
  built with Apple clang version 14.0.3 (clang-1403.0.22.14.1)
  configuration: --prefix=/opt/homebrew/Cellar/ffmpeg/6.0_1 --enable-shared --enable-pthreads --enable-version3 --cc=clang --host-cflags= --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libaribb24 --enable-libbluray --enable-libdav1d --enable-libmp3lame --enable-libopus --enable-librav1e --enable-librist --enable-librubberband --enable-libsnappy --enable-libsrt --enable-libsvtav1 --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libspeex --enable-libsoxr --enable-libzmq --enable-libzimg --disable-libjack --disable-indev=jack --enable-videotoolbox --enable-audiotoolbox --enable-neon
  libavutil      58.  2.100 / 58.  2.100
  libavcodec     60.  3.100 / 60.  3.100
  libavformat    60.  3.100 / 60.  3.100
  libavdevice    60.  1.100 / 60.  1.100
  libavfilter     9.  3.100 /  9.  3.100
  libswscale      7.  1.100 /  7.  1.100
  libswresample   4. 10.100 /  4. 10.100
  libpostproc    57.  1.100 / 57.  1.100
Input #0, image2, from 'IMG_5546_cover_1.jpg':
  Duration: 00:00:01.00, start: 0.000000, bitrate: 836 kb/s
  Stream #0:0: Video: mjpeg (Baseline), yuvj420p(pc, bt470bg/unknown/unknown), 1080x1920, 1 fps, 1 tbr, 1 tbn
Input #1, mov,mp4,m4a,3gp,3g2,mj2, from 'intro/fzb-intro.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 1
    compatible_brands: isommp41mp42
    creation_time   : 2023-11-24T21:59:10.000000Z
  Duration: 00:00:00.83, start: 0.000000, bitrate: 1247 kb/s
  Stream #1:0[0x1](und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709, progressive), 602x1070, 1191 kb/s, 30 fps, 30 tbr, 600 tbn (default)
    Metadata:
      creation_time   : 2023-11-24T21:59:10.000000Z
      handler_name    : Core Media Video
      vendor_id       : [0][0][0][0]
  Stream #1:1[0x2](und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, mono, fltp, 38 kb/s (default)
    Metadata:
      creation_time   : 2023-11-24T21:59:10.000000Z
      handler_name    : Core Media Audio
      vendor_id       : [0][0][0][0]
Input #2, mov,mp4,m4a,3gp,3g2,mj2, from 'IMG_5546.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf60.3.100
  Duration: 00:00:28.37, start: 0.000000, bitrate: 3126 kb/s
  Stream #2:0[0x1](und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709, progressive), 1080x1920, 2989 kb/s, 29.97 fps, 29.97 tbr, 30k tbn (default)
    Metadata:
      handler_name    : Core Media Video
      vendor_id       : [0][0][0][0]
      encoder         : Lavc60.3.100 libx264
  Stream #2:1[0x2](und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 128 kb/s (default)
    Metadata:
      handler_name    : Core Media Audio
      vendor_id       : [0][0][0][0]
Stream specifier ':a' in filtergraph description [0:v] [0:a] [1:v] [1:a] [2:v] [2:a] concat=n=3:v=1:a=1 [v] [a] matches no streams.

[2:v:0][2:a:0]

uf, good catch Баяр Гончикжапов, but even when I change it, I get the error Stream specifier ':a:0' in filtergraph description [0:v:0][0:a:0][1:v:0][1:a:0][2:v:0][2:a:0]concat=n=3:v=1:a=1 matches no streams.

change -loop 1 -framerate 30 -t 1 -i ${cover}"_1.jpg" and -f lavfi -t 1 -i anullsrc... and [0:v:0][3:a:0]...

Thanks. I did all the changes, especially this line -filter_complex '[0:v:0][3:a:0][1:v:0][1:a:0][2:a:0][2:v:0]concat=n=3:v=1:a=1' ${fzbVideoOutput}, but again I get Stream specifier ':a:0' in filtergraph description [0:v:0][3:a:0][1:v:0][1:a:0][2:a:0][2:v:0]concat=n=3:v=1:a=1 matches no streams.. Any idea?

it is strange. it works for me: ... ffmpeg \ -loop 1 -framerate 30 -t 1 -i ${cover}"_1.jpg" \ -t 3 -i ${intro} \ -i ${fzbVideo} \ -f lavfi -t 1 -i anullsrc=channel_layout=stereo:sample_rate=44100 \ -filter_complex '[0:v:0][3:a:0][1:v:0][1:a:0][2:v:0][2:a:0]concat=n=3:v=1:a=1' ${fzbVideoOutput}

It seems to be due to the format of the different videos? I get the following error
Stream mapping:   Stream #0:0 (mjpeg) -> concat   Stream #1:0 (h264) -> concat   Stream #1:1 (aac) -> concat   Stream #2:0 (h264) -> concat   Stream #2:1 (aac) -> concat   Stream #3:0 (pcm_u8) -> concat   concat -> Stream #0:0 (libx264)   concat -> Stream #0:1 (aac) .....

part two Press [q] to stop, [?] for help [swscaler @ 0x151480000] deprecated pixel format used, make sure you did set range correctly [Parsed_concat_0 @ 0x6000001b80b0] Input link in0:v0 parameters (size 602x1070, SAR 0:1) do not match the corresponding output link in0:v0 parameters (1080x1920, SAR 0:1) [Parsed_concat_0 @ 0x6000001b80b0] Failed to configure output pad on Parsed_concat_0 Error reinitializing filters! Failed to inject frame into filter network: Invalid argument Error while processing the decoded data for stream #2:0 Conversion failed!

scale and pad before concat

authors: Баяр Гончикжапов


text:
How do i add xfade transition to a batch of videos using ffmpeg?
I'm currently trying to concatenate multiple videos in a folder using FFmpeg. I've successfully applied a xfade transition between two videos using the following command: However, I'm facing two challenges:
Applying xfade to multiple videos: I want to extend this process to apply the xfade transition between all videos in the folder and save it as a single video.
Audio issue after transition: While the visual transition works seamlessly, I've noticed that the audio is muted as soon as the transition finishes in the output video. Is there a modification I can make to the FFmpeg command to ensure that the audio remains synchronized with the video throughout the output?
This is the command i am currently using:
ffmpeg -i input1.mp4 -i input2.mp4 -filter_complex "xfade=transition=fade:duration=0.25:offset=4.5" -c:v libx264 -c:a aac -strict experimental output.mp4

python script:
#!/usr/bin/python3
import os,subprocess,math
def get_length(filename):
  result=subprocess.run(["ffprobe", "-v", "error", "-show_entries",
                        "format=duration", "-of",
                        "default=nw=1:nk=1", filename],
    stdout=subprocess.PIPE,
    stderr=subprocess.STDOUT)
  return float(result.stdout)

LST=[]
DIR="/mnt/public/upload/video/"
for f in os.listdir(DIR):
  if (f.endswith(".mp4")):
    print(f)
    LST.append(f)

FLV=''
FLA=''
OFS=0
XFD=0.25
CNT=0

INP=[]
f=DIR+LST[0]
INP.append(f' -i "{f}"')
PDV='[0:v]'
PDA='[0:a]'

for i in range(len(LST)-1):
  OFS=OFS+get_length(f)-XFD
  FLV+=f'{PDV}'
  FLA+=f'{PDA}'
  CNT=i+1
  PDV=f'[v{CNT}]'
  PDA=f'[a{CNT}]'
  FLV+=f'[{CNT}:v]xfade=transition=pixelize:offset={OFS}:duration={XFD}{PDV};'
  FLA+=f'[{CNT}:a]acrossfade=d={XFD}{PDA}'
  if i < len(LST)-2:
    FLA+=";"
  f=DIR+LST[i+1]
  INP.append(f' -i "{f}"')

s='ffmpeg'
for t in INP:
  s=s+t
s=s+f' -filter_complex "{FLV}{FLA}" -map {PDV} -map {PDA} -c:v h264_nvenc -cq 18 -c:a aac -q:a 4 -map_metadata -1 /tmp/output.mp4 -y -hide_banner'
print(s)
os.system(s)
os.system(f'mpv /tmp/output.mp4')


text:
ffmpeg: why 2 video stream?
I'm on ffmpeg 6.
Take a video then:
ffmpeg -hide_banner -ss 00:01:09 -t 20s -i "video.mkv" -map 0:0 -c:v libx265 -crf 25 -filter_complex "setpts=PTS-STARTPTS" "output_reference.mkv"
then:
ffmpeg -hide_banner -i "output_reference.mkv" -map 0:0 -c:v libx265 -preset medium -crf 25 -filter_complex "setpts=PTS-STARTPTS" "output_test_01.mkv"
Why output_test_01.mkv has 2 video stream inside?
Thanks!

-map 0:0 leads to inclusion of one stream, -filter_complex "setpts=PTS-STARTPTS" leads to another. The filter_complex does NOT operate upon the initially mapped stream. Mapped video streams are operated upon by -vf or -filter:v.
See http://www.ffmpeg.org/ffmpeg.html#Stream-selection
especially 4.1.2, 4.1.3 and the last set of examples.

Thanks for the quick reply! How can I solve my problem? I need only 1 video stream on output  using "-filter_complex "setpts=PTS-STARTPTS" " (to sync the frames btw input and ouput files)

Change -filter_complex to -vf

Thanks, another solution is remove "-map 0:0"


text:
Current hardware and software for converting family tapes to digital. Most of the existing links are out of date/not manufactured. I have a Mac M3
Current hardware and software for converting family tapes to digital please.  Many of the existing links appear out of date/not manufactured.  I have a Mac M3.

It would probably be easier, cheaper  & better quality to get the conversions done by a specialist. You can then edit in iMovie or even DaVinci Resolve [freeware for non-pro use.]

If you can get an old DV or D8 camcorder, and Apple's FW-TB adapter to Apple's TB2-TB3 adapter to the Mac's USB-C Thunderbolt port, you can use QuickTime Player or Final Cut Pro to import miniDV or D8 / Hi8 analog tapes. Works on macOS 14 Sonoma and M1 Mac.
https://discussions.apple.com/thread/255394385?sortBy=oldest_first https://discussions.apple.com/docs/DOC-250008282


text:
How do I export 180º stereoscopic VR footage as "normal" monoscopic video for consumption by normal video players
The title sums up the quest.  I am assuming I can do this with Premiere Pro somehow but if I need to use some other method, I'm fine with that as well.
An example of what I imagine I want to do:  I have footage from my Canon R5C using the VR dual fisheye lens.  This produces dual fisheye video.  I converted it in the EOS VR Utility to rectilinear and loaded it into Premiere Pro.  I hit the "Toggle VR Video Display" and I get a flat square render with two controls for the camera angle (which I assume I can key frame).  What I'd like to do is to export a video with this rendering -- just a flat "normal" monoscopic render without the VR effect so that people can watch it without a VR headset.

I'm working on a program that can do this, but it's not an automatic process, you have to adjust it to frame what you want to see, just like when you move the head with the headset.
https://vongoob9.gitlab.io/vr2normal

I'm currently between projects and I will likely not get back to this until March or April.  There is also a YouTube video by Hugh Hou that says he does it but I haven't watched it yet.


text:
How to update this script to generate HLS video with different resolution streams?
I have the following FFmpeg script:
ffmpeg -i video.mp4 -i video.vtt \
 -map 0:v -map 0:a:0 -map 1 \
 -s:v:0 1080x1920 -c:v:0 h264 -b:v:0 500K \
 -c:a:0 copy -c:a:1 copy -c:a:2 copy -c:s webvtt \
 -f hls -hls_playlist_type vod -var_stream_map "v:0,a:0,s:0" \
 -master_pl_name video.m3u8 -hls_time 6 -hls_list_size 0 -hls_allow_cache 1 -start_number 1 \
 -hls_segment_filename "output/hls/%v/seg-%d.ts" output/hls/%v/index.m3u8

Currently it only produces one 1080x1920 stream, how do I produce more lower resolution ones so it can adjust based on client bandwidth?
Also, I've noticed that it doesn't add the reference to the VTT file to the master HLS playlist; I had to add this manually but is there a way to make FFmpeg do it for me?
#EXT-X-MEDIA:TYPE=SUBTITLES,GROUP-ID="subs",NAME="English",DEFAULT=YES,AUTOSELECT=YES,FORCED=NO,LANGUAGE="en",CHARACTERISTICS="public.accessibility.transcribes-spoken-dialog",URI="0/index_vtt.m3u8"

I've tried this, but I get an argument error:
ffmpeg -i video.mp4 -i video.vtt \
 -map 0:v -map 0:a:0 -map 1 \
 -s:v:0 1080x1920 -c:v:0 h264 -b:v:0 500K \
 -s:v:1 720x1280 -c:v:1 h264 -b:v:1 300K \
 -s:v:2 480x854 -c:v:2 h264 -b:v:2 150K \
 -c:a:0 copy -c:a:1 copy -c:a:2 copy -c:s webvtt \
 -f hls -hls_playlist_type vod -var_stream_map "v:0,a:0,s:0 v:1,a:1 s:1 v:2,a:2 s:2" \
 -master_pl_name video.m3u8 -hls_time 6 -hls_list_size 0 -hls_allow_cache 1 -start_number 1 \
 -hls_segment_filename "output/hls/%v/seg-%d.ts" output/hls/%v/index.m3u8

Create additional maps for the other resolutions that you want.

@TheSomberi Thank you! Are you able to give me an example on how to do that? I'm still a beginner with ffmpeg so I'm not sure about the syntax.

You must add -map options for each resolution, as described in https://ottverse.com/hls-packaging-using-ffmpeg-live-vod/

why is -hls_list_size 0 ??
change that to 5 refer the following thread
https://stackoverflow.com/questions/71913543/how-to-generate-multiple-resolutions-hls-using-ffmpeg-for-live-streaming


text:
The problem with converting ts files to mp4
So I download ts files from h264.m3u8. The files look like this "https://.net/data/3/a/e/6d162b532610fdae/h264_00000005.ts ". I merge them into one common ts file. And I'm trying to get an mp4 file using ffmpeg. I execute the following command sudo /opt/ffmpeg/bin/ffmpeg -y -f mpeg ts -i concat:/tmp/yLx1B9X9Mb/lujqnqQrtm.ts -c copy -bsf:a aac_adtstoasc output.mp4. After that, I get
ffmpeg version n3.1-1-g36fcb8c Copyright (c) 2000-2016 the FFmpeg developers
  built with gcc 4.4.7 (GCC) 20120313 (Red Hat 4.4.7-17)
  configuration: --enable-gpl --enable-version3 --enable-libfdk_aac --enable-libmp3lame --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-nonfree --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libgsm --enable-libxvid --disable-static --enable-shared --prefix=/opt/ffmpeg
  libavutil      55. 27.100 / 55. 27.100
  libavcodec     57. 48.101 / 57. 48.101
  libavformat    57. 40.101 / 57. 40.101
  libavdevice    57.  0.101 / 57.  0.101
  libavfilter     6. 46.102 /  6. 46.102
  libswscale      4.  1.100 /  4.  1.100
  libswresample   2.  1.100 /  2.  1.100
  libpostproc    54.  0.100 / 54.  0.100
[mpegts @ 0x1bc9540] Could not detect TS packet size, defaulting to non-FEC/DVHS
[mpegts @ 0x1bc9540] PES packet size mismatch
    Last message repeated 1 times
[mpegts @ 0x1bc9540] probed stream 0 failed
[mpegts @ 0x1bc9540] nothing to probe for stream 1
[mpegts @ 0x1bc9540] probed stream 1 failed
[mpegts @ 0x1bc9540] probed stream 2 failed
[mpegts @ 0x1bc9540] Could not find codec parameters for stream 0 (Unknown: none): unknown codec
Consider increasing the value for the 'analyzeduration' and 'probesize' options
[mpegts @ 0x1bc9540] Could not find codec parameters for stream 1 (Unknown: none): unknown codec
Consider increasing the value for the 'analyzeduration' and 'probesize' options
[mpegts @ 0x1bc9540] Could not find codec parameters for stream 2 (Unknown: none): unknown codec
Consider increasing the value for the 'analyzeduration' and 'probesize' options
Input #0, mpegts, from 'concat:/tmp/yLx1B9X9Mb/lujqnqQrtm.ts':
  Duration: N/A, bitrate: N/A
    Stream #0:0[0xfaf]: Unknown: none
    Stream #0:1[0x15]: Unknown: none
    Stream #0:2[0x15b4]: Unknown: none
Output #0, mp4, to 'output.mp4':
Output file #0 does not contain any stream

The main problem is that it works for other ts files, but in this case it doesn't. I suspect that the whole problem is that there is a block with h264_init.mp4 here in m3u8, but to be honest I don't understand what I need to do with it.
It seems to me that I have already tried everything, but maybe I was doing it wrong

You're using an obsolete version of ffmpeg. Upgrade to 6.1 and try.

Thanks, but it works with this version too. I immediately merge it not into a ts file, but into an mp4 and after that ffmpeg -i h264_raw.mp4 -c:v copy -c:a copy h264.mp4


text:
Why does VMAF show lower then 100 on same image?
I'm testing ways to compare image similarity using ffmpeg. I'm looking at using SSIM, PSNR and VMAF.
For reference, I'm running the comparison with duplicated sources and expect a score of 100%.
Running SSIM like this:
ffmpeg -hide_banner -f lavfi -i color=red:duration=10:size=1280x720:rate=30 -f lavfi -i color=red:duration=10:size=1280x720:rate=30 -filter_complex "ssim" -pix_fmt yuv420p -t 1 -f null
Gives a perfect score: [Parsed_ssim_0 @ 0x6000015844d0] SSIM Y:1.000000 (inf) U:1.000000 (inf) V:1.000000 (inf) All:1.000000 (inf)
Running PSNR like this:
ffmpeg -hide_banner -f lavfi -i color=red:duration=10:size=1280x720:rate=30 -f lavfi -i color=red:duration=10:size=1280x720:rate=30 -filter_complex "PSNR" -pix_fmt yuv420p -t 1 -f null
Gives a perfect score: [Parsed_psnr_0 @ 0x600001478630] PSNR y:inf u:inf v:inf average:inf min:inf max:inf
Running VMAF like this:
ffmpeg -hide_banner -f lavfi -i color=red:duration=10:size=1280x720:rate=30 -f lavfi -i color=red:duration=10:size=1280x720:rate=30 -filter_complex "libvmaf" -pix_fmt yuv420p -t 1 -f null
I get: [Parsed_libvmaf_0 @ 0x600002c10630] VMAF score: 97.428043
Why does VMAF give less the perfect score for the duplicated inputs?Is there a way around this?

Short answer: the VMAF engine isn't comparing pixel to pixel. The engine calculates some objective metrics for each stream (subject and reference); the final VMAF score then is a prediction of a machine learning model, hence the imperfect score.
Long answer: read the discussion at https://github.com/Netflix/vmaf/issues/76


text:
Best ffmpeg compression settings for fast seeking of long 4 hour clip
I've got a low-resolution 4 hour clip, and need to do a lot of seeking in the video to write down when stuff happens.
Do you have any suggestions for what format/settings would be the most "seek-friendly?"  Right now it is a H264 mp4, ~200mb on disk, and every time I move the playback bar to a new part, it stops and thinks for a few seconds - especially if I have to back up 20 seconds.  I'm looking to be able to move backwards and forwards as fast as possible.  Maybe throwing in more keyframes?  A different video format that is less compressed, but more skip-around optimized?

I'd recommend considering these workarounds in this order, until it seeks fast enough:

Make sure hardware video decoding is turned on
Switch to a faster video player
Decrease the GOP to one second
Encode the video with the "fastdecode" tuning
Use an intra-only format

Ok here is the detailed answer explanation:
Hardware decoding
Most GPUs have hardware-accelerated video decoding for H.264. Make sure that's turned on in your video player. If it isn't then it will fall back to software decoding which is significantly slower.
Faster video player
Even for pretty slow computers, you should be able to seek anywhere within a low-resolution H.264 video in well under a second. But some video players are more efficient than others. When I use Totem (GNOME video player based on gstreamer) seeking is so much slower than when I use MPV (lightweight player based on ffmpeg).
Shorter GOP
A smaller, closed GOP will improve seek times. H.264 is often encoded with x264 which has a default GOP length of 250 frames (and it is closed by default, which means inter-frames cannot pick reference frames outside of the GOP they reside in). At 25fps this means that skipping to a random frame may require up to 10 seconds worth of video being decoded if you happen to hit a frame at the very end of a GOP. Try decreasing the GOP to only one second. Compression ratio will be worse but average case and worst case seek latency will go down.
Tune for fast decoding
Encode the video while tuning for fast decoding (-tune fastdecode). This turns off features that can be a bottleneck on decoders, specifically the in-loop deblocker (a feature which reduces blocking artifacts), weighted P and B frames (a frame type that improves efficiency a lot when brightness changes), and the CABAC entropy coder (a slower but more efficient entropy coder than constrained baseline's CAVLC).
Intra-only format
The fastest seeking would be in an intra-only codec, either a mezzanine like FFV1 or ProRes, or a popular codec like H.264 in an intra-only mode. Most people only do this during the editing process for ultra-high resolution and bitrate videos where seeking would be too slow otherwise.


text:
Davinci Resolve Fusion Media In get two different clips from the timeline in adjustment clip
I have created a fusion composition in an adjustmen clip that takes two input videos.
My MediaIn1 comes from the "background" and my MediaIn2 comes from the MediaPool.
I want to be able to get my MediaIn 1 & 2 from the timeline directly, to make it easier to adjust/swap out clips later on.
I assumed that the "Layer" drop down that shows up when selecting "Timeline" as a Media Source would allow me to do this, but the dropdown is an empty list

Is it possible to get MediaIn from different tracks on the timeline in an adjustment clip in Fusion? If so, how?

I couldn't find a way to make this work using an adjustment clip, so I'm using a fusion transition instead.
This way I can get my two clips from the "Layer" property and adjust their in/out on from edit tab


text:
Cutting and rejoining videos causes audio de-synchronization using ffmpeg
I'm trying to cut a video into pieces and rejoin them using ffmpeg on Windows 11 x64. Here's the details of ffmpeg:
ffmpeg version 2023-11-22-git-0008e1c5d5-full_build-www.gyan.dev Copyright (c) 2000-2023 the FFmpeg developers
  built with gcc 12.2.0 (Rev10, Built by MSYS2 project)
  configuration: --enable-gpl --enable-version3 --enable-static --pkg-config=pkgconf --disable-w32threads
--disable-autodetect --enable-fontconfig --enable-iconv --enable-gnutls --enable-libxml2 --enable-gmp
--enable-bzlib --enable-lzma --enable-libsnappy --enable-zlib --enable-librist --enable-libsrt
--enable-libssh --enable-libzmq --enable-avisynth --enable-libbluray --enable-libcaca --enable-sdl2
--enable-libaribb24 --enable-libaribcaption --enable-libdav1d --enable-libdavs2 --enable-libuavs3d
--enable-libzvbi --enable-librav1e --enable-libsvtav1 --enable-libwebp --enable-libx264 --enable-libx265
--enable-libxavs2 --enable-libxvid --enable-libaom --enable-libjxl --enable-libopenjpeg --enable-libvpx
--enable-mediafoundation --enable-libass --enable-frei0r --enable-libfreetype --enable-libfribidi
--enable-libharfbuzz --enable-liblensfun --enable-libvidstab --enable-libvmaf --enable-libzimg
--enable-amf --enable-cuda-llvm --enable-cuvid --enable-ffnvcodec --enable-nvdec --enable-nvenc
--enable-dxva2 --enable-d3d11va --enable-libvpl --enable-libshaderc --enable-vulkan --enable-libplacebo
--enable-opencl --enable-libcdio --enable-libgme --enable-libmodplug --enable-libopenmpt
--enable-libopencore-amrwb --enable-libmp3lame --enable-libshine --enable-libtheora --enable-libtwolame
--enable-libvo-amrwbenc --enable-libcodec2 --enable-libilbc --enable-libgsm --enable-libopencore-amrnb
--enable-libopus --enable-libspeex --enable-libvorbis --enable-ladspa --enable-libbs2b --enable-libflite
--enable-libmysofa --enable-librubberband --enable-libsoxr --enable-chromaprint
  libavutil      58. 32.100 / 58. 32.100
  libavcodec     60. 34.100 / 60. 34.100
  libavformat    60. 17.100 / 60. 17.100
  libavdevice    60.  4.100 / 60.  4.100
  libavfilter     9. 13.100 /  9. 13.100
  libswscale      7.  6.100 /  7.  6.100
  libswresample   4. 13.100 /  4. 13.100
  libpostproc    57.  4.100 / 57.  4.100

I've a video file in MKV format. I've cut it into 3 pieces using the following command:
ffmpeg.exe -ss 0:0:0 -i input.mkv -t 0:54:15 -c:v hevc_amf -b:v 3M -c:s mov_text seg-01.mp4
ffmpeg.exe -ss 0:54:29 -i input.mkv -t 0:35:35 -c:v hevc_amf -b:v 3M -c:s mov_text seg-02.mp4
ffmpeg.exe -ss 1:30:12 -i input.mkv -t 0:4:10 -c:v hevc_amf -b:v 3M -c:s mov_text seg-03.mp4

The audio is copied in all 3 pieces like original. Now I'm joining them using the following command:
ffmpeg.exe -y -f concat -safe 0 -i .\join.txt -c:v hevc_amf -c:a copy -c:s copy -fflags +genpts out.mp4

where, join.txt is:
file seg-01.mp4
file seg-02.mp4
file seg-03.mp4

ffmpeg throws the following warning:
[mp4 @ 000002a5cf9cc040] Non-monotonic DTS in output stream 0:1; previous: 156240896, current: 156240084; changing to 156240897.
This may result in incorrect timestamps in the output file.
[mp4 @ 000002a5cf9cc040] Non-monotonic DTS in output stream 0:1; previous: 258720980, current: 258720462; changing to 258720981.
This may result in incorrect timestamps in the output file.

I've observed that audio is de-synchronized after the places where I cut.
How to keep audio, video and subtitle synchronized after cutting and rejoining the video using ffmpeg?


text:
Combine images and draw text on each image with animation xfade
I am using ffmpeg to merge multiple images and an audio to produce a video. I am using drawtext and xfade with dissolve transition. My ffmpeg command is given below.
ffmpeg -loop 1 -t 5 -i ./img/img0.jpg -loop 1 -t 5 -i ./img/img1.jpg -loop 1 -t 5 -i ./img/img2.jpg -loop 1 -t 5 -i ./img/img3.jpg -t 20 -i audio.mp3 -filter_complex "
[0]xfade=transition=dissolve:duration=1:offset=4,drawtext=fontfile='./Lato/Lato-Regular.ttf':text='Text1':fontcolor='#666333':fontsize=(h/30):x=50:y=20,setsar=1[v0];
[1]xfade=transition=dissolve:duration=1:offset=4,drawtext=fontfile='./Lato/Lato-Regular.ttf':text='Text1':fontcolor='#666333':fontsize=(h/30):x=50:y=20,setsar=1[v1];
[2]xfade=transition=dissolve:duration=1:offset=4,drawtext=fontfile='./Lato/Lato-Regular.ttf':text='Text1':fontcolor='#666333':fontsize=(h/30):x=50:y=20,setsar=1[v2];
[3]xfade=transition=dissolve:duration=1:offset=4,drawtext=fontfile='./Lato/Lato-Regular.ttf':text='Text1':fontcolor='#666333':fontsize=(h/30):x=50:y=20,setsar=1[v3];
[v0][v1][v2][v3]concat=n=4:v=1:a=0,format=yuv420p[vid]" -map "[vid]" -map 4:a -c:v libx264 output.mp4

I am getting below error when executing this command.
Cannot find a matching stream for unlabeled input pad 1 on filter Parsed_xfade_9

xfade requires two input video streams. You are using only one. It has to fade from a video and into another. Use a black color filter for the other.

Yes you are right it requires two inputs but It does not necessarily have to be videos, it can be images too. I came up with an answer here. https://superuser.com/questions/1819911/combine-images-and-draw-text-on-each-image-with-animation-xfade


text:
Precise positioning and dimensioning using DaVinci Resolve
I have some clips at different resolutions I want to put on my timeline (configured at 1920 x 1080), precisely at 2 pixels from the left, 2 pixels from the bottom, each clip being supposed to be resized to 1280 x 720.
Is there a way to (easily) do this on DaVinci Resolve (free version), without starting a bachelor of mathematics ?

Resolve does not work with pixels; it works resolution-independent. Maybe Handbrake is a better tool for that.

@U.Windl : ok, I understand that, but AFAIK videos are in pixels, and the need for a precise positioning at a given resolution is also there in the real world (no matter further upscales / downscales that can be done at export time). So I guess DaVinci Resolve is able to manage this "real world" needs in some (relative) easy way ?

Well the proportion of "1920/(1920-2)" is 960/959, or 1.001042752867... (or the other way around: 0.9989583...) To to move your FHD by 2 pixels, you can move it by 0.001042... in Resolve (I guess). Maybe it's really easier in Handbrake...


text:
machine hangs during ffmpeg command execution
I'm running this ffmpeg command that does multiple trims on input video and concats those trims to generate output.
ffmpeg -i https://d8r14y803bnlk.cloudfront.net/usetldr/2736037/u/796/st/5a919413ff884892bbfffcd0671687a9/p/67c1a16438bf4bb78b785557f4cef7ef/OJx1SIKTNbbGHmQfKT4C_render.mp4 -filter_complex "[0:v:0]trim=start=0.0:end=4.289,setpts=PTS-STARTPTS,format=yuva420p[0v];[0:v:0]trim=start=4.84:end=1034.7,setpts=PTS-STARTPTS,format=yuva420p[1v];[0v][1v]concat=n=2:v=1:a=0" -crf 18 -an -preset ultrafast -y /tmp/8TZeqB3Z6h.mp4
This command works fine on my M1 mac but hangs EC2 instances (c5.4xlarge).
I'm using ffmpeg version 6.1-static https://johnvansickle.com/ffmpeg/  Copyright (c) 2000-2023 the FFmpeg developers built with gcc 8 (Debian 8.3.0-6)  on EC2.
Any idea why this could be happening?

came across this thread https://video.stackexchange.com/a/27713/20745 where the user recommends using same input file multiple times ( that is, multiple -i switches with same file).
And it seems to work.
Does trim filter store all frames in RAM?

Is there any cleaner workaround for this?

There is split filter that can be used to write it in cleaner way.


text:
Left-to right transition on overlay works only on first one in chain, not second one
my goal is to do this with ffmpeg complex_filters:
I have a background 1080 vid and like to slide in some overlay graphics and texts. So my input is the vid and 3 jpg files. The jpg files should slide in to a position over the background-video, fade in in the same time, stay for a few seconds and then fade out. Then the same thing should be displayed with the second and third jpg. Additionally, a text should be displayed.
My main problem is, that the left-to right transition works only on the first jpg, not the second or third one. The second and third one does the fade-in, but not the slide. All other things work, it's just the "slide in" of the second and third jpg that is ignored after rendering.
My command is:
ffmpeg -i concat-video.mp4  -loop 1 -i card1.jpg -loop 1 -i card2.jpg -loop 1 -i card3.jpg -filter_complex "[0:v] drawtext=alpha='

    # The transition in this block works
    if(lt(t,0),0,if(lt(t,1.5),(t-0)/1.5,if(lt(t,10.5),1,if(lt(t,12.0),(1.5-(t-10.5))/1.5,0))))':fontcolor=ffffff:fontsize=64:text=Title1:x=100:y=100 [cardset1];
    [1:v] format=pix_fmts=yuva420p,scale=765:1083,fade=in:st=0:d=1.5:alpha=1 [fadeIn1];
    [cardset1][fadeIn1] overlay=x='if(lte(-w+(t)*1065,300),-w+(t)*1065,300)':y=300:enable='between(t,0,1.5)':shortest=1 [slideIn1];
    [1:v] format=pix_fmts=yuva420p,scale=765:1083,fade=out:st=3.5:d=1.5:alpha=1 [display1];
    [slideIn1][display1] overlay=300:300:enable='between(t,1.5,8.0)':shortest=1 [fadeOut1];
    [fadeOut1] drawtext=alpha='if(lt(t,0),0,if(lt(t,1.5),(t-0)/1.5,if(lt(t,3.5),1,if(lt(t,5.0),(1.5-(t-3.5))/1.5,0))))':fontcolor=ffffff:fontsize=64:text=Card 1:x=200:y=200 [final1];

    # The transition in this block don't work, only fade-in
    [2:v] format=pix_fmts=yuva420p,scale=765:1083,fade=in:st=6:d=1.5:alpha=1 [fadeIn2];
    [final1][fadeIn2] overlay=x='if(lte(-w+(t)*1065,300),-w+(t)*1065,300)':y=300:enable='between(t,6,7.5)':shortest=1 [slideIn2];
    [2:v] format=pix_fmts=yuva420p,scale=765:1083,fade=out:st=9.5:d=1.5:alpha=1 [display2];
    [slideIn2][display2] overlay=300:300:enable='between(t,7.5,14.0)':shortest=1 [fadeOut2];
    [fadeOut2] drawtext=alpha='if(lt(t,6),0,if(lt(t,7.5),(t-6)/1.5,if(lt(t,9.5),1,if(lt(t,11.0),(1.5-(t-9.5))/1.5,0))))':fontcolor=ffffff:fontsize=64:text=Card 2:x=200:y=200 [final2];

    # The transition in this block don't work too, only fade-in
    [final2] drawtext=alpha='if(lt(t,12),0,if(lt(t,13.5),(t-12)/1.5,if(lt(t,17.5),1,if(lt(t,19.0),(1.5-(t-17.5))/1.5,0))))':fontcolor=ffffff:fontsize=64:text=Title2:x=100:y=100 [cardset2];
    [3:v] format=pix_fmts=yuva420p,scale=765:1083,fade=in:st=12:d=1.5:alpha=1 [fadeIn3];
    [cardset2][fadeIn3] overlay=x='if(lte(-w+(t)*1065,300),-w+(t)*1065,300)':y=300:enable='between(t,12,13.5)':shortest=1 [slideIn3];
    [3:v] format=pix_fmts=yuva420p,scale=765:1083,fade=out:st=15.5:d=1.5:alpha=1 [display3];
    [slideIn3][display3] overlay=300:300:enable='between(t,13.5,20.0)':shortest=1 [fadeOut3];
    [fadeOut3] drawtext=alpha='if(lt(t,12),0,if(lt(t,13.5),(t-12)/1.5,if(lt(t,15.5),1,if(lt(t,17.0),(1.5-(t-15.5))/1.5,0))))':fontcolor=ffffff:fontsize=64:text=Card 3:x=200:y=200 [final3];

" -pix_fmt yuva420p -map "[final3]" output.mp4

I've tried several thing, but nothing helped. So i hope somebody here can help me :)

time ...(t-6)*1065...(t-6)...

@БаярГончикжапов thank you, that worked!

@БаярГончикжапов - can you please post your comment as a fuller answer. Then Nimderp can accept it, it'll get upvotes and future visitors will be able to easily see the answer.

authors: Баяр Гончикжапов


text:
Change Colours of Composition
So, I downloaded an after effects file with animated boxes, lets suppose for example there are three boxes , all 3 boxes are in three different composition. when I change colour of the box in one composition the color changes from all composition, I deleted expression value and disabled expression still somehow its all connected.

Can you share the after effects file, or add some screenshots? It's possible they're connected by some other expressions, or that one comp is being used to drive the other comps, but it's hard to say without seeing more

The reason for this is most likely that there is a single Box precomposed in its own comp. This comp is likely used in all the other comps, which is why every comp changes when changing the box at one place.
This is often the case in After-Effects presets or animation-packs, so that you can preview each comp with your footage without having to place it into each and every comp.
To circumvent that, locate the composition that contains the box. Press TAB and you will all the compositions in which this box-comp is used. Most likely, it will show many/all comps. Now copy the box (the layer, not the comp), go up one into the comp you want to render, delete the comp containing the box and paste the layer. It will now be separated since its outside the precomp.


text:
How can one upload a video of over 12 hours on YouTube?
https://support.google.com/youtube/answer/71673 states:

The maximum file size you can upload is 256 GB or 12 hours, whichever is less. We've changed the limits on uploads in the past, so you may see older videos that are longer than 12 hours.

However, I saw this recent video https://www.youtube.com/watch?v=JgHRMd-sihk published 4 months ago, which is 24 hours 5 minutes and 28 seconds long. How can one upload a video of over 12 hours on YouTube?


text:
ffmpeg - converting one audio track of a multi-track mp4
I'm having a few mp4 with two audio tracks,
an english one in aac and a french one in dts.
Now I want to convert only the french dts to eac3 with a single ffmpeg command.
I use
ffmpeg -hide_banner -i input.mp4 ^
             -map_metadata -1 ^
             -map 0:0 -c:v copy ^
             -map 0:1 -c:a copy ^
             -map 0:2 -c:a eac3 -b:a 1536k ^
             -metadata:s:a:0 language=eng ^
             -metadata:s:a:0 title="Stereo" ^
             -metadata:s:a:1 language=fra ^
             -metadata:s:a:1 title="Stereo" ^
output.mp4

This works quite nice, but it converts both audio tracks to eac3, instead of leaving the first one untouched ...
What's wrong in the command?
(ffmpeg version 2023-12-23-git-f5f414d9c4-full_build-www.gyan.dev under Windows 10)

-map does new order of streams in output. just ffmpeg -i in -c copy -c:a:1 eac3 -b:a:1 1637k... same as in -metadata:s:a:1

authors: Баяр Гончикжапов


text:
Can you make if/then scripts in ffmpeg?
Is it possible to combine multiple scripts into one in ffmpeg?
What I am trying to do is create one master script that changes commands based on the aspect ratio of the input video.
For example, if the input video is closest to a 16:9 aspect ratio, ffmpeg will automatically convert the video using script "A".
If the input video is closest to a 4:3 aspect ratio, ffmpeg will automatically convert the video using script "B".
Finally, if the input video has a strange aspect ratio, (for example, cell phone videos) ffmpeg will automatically convert the video using script "C".
I am new to ffmpeg and do not understand much. If possible, will you please give a script that I can simply copy and paste into ffmpeg?
I already have scripts A, B, and C ready.
Also, as a side question, can you command ffmpeg to delete the original input video after successfully converting it?
Thanks everyone


text:
Can't Create New Timeline from IN/OUT
I'm trying to create a new timeline from a Mark In and Mark Out segment.  I have the I/O set, I right click in the bin and select New Timline and `Use Selected Mark In/Out.  You can see  the settings in the snip below.  I have two minutes marked out of a 1 hour timeline.
FYI, I also removed the errant cut you see in the timeline.  That didn't resolve anything.

When I click Create it copies the whole 1 hour timeline.  I must be missing something really simple?


text:
How to achieve something like strftime but with rtp frame timstamp
I am trying to record a rtsp stream with ffmpeg, segmented by certain amount of time, and name the file with the start time. I used strftime to expand the output filename with timestamp, but I wonder if there is an option that can expand the filename with rtp timestamp instead of local time.
Below is my current ffmpeg command

ffmpeg -y -i url -f segment -segment_time 60 -segment_format mp4
-segment_atclocktime 1 -strftime 1  -acodec copy -vcodec copy ./%Y/%m/%d/%H/record_%Y-%m-%d-%H-%M-%S.mp4


text:
Removing myself from mirror
I'm going to shoot a real estate type of video of a local fashion/beauty salon (well, not a typical real estate video, I just need to showcase the studio which only has 2-3 rooms, that's it). The problem is, I have just inspected the place and to my surprise, it is full of mirrors, both the ground floor and the first floor. This latter one is especially tricky, because, as you can see, a little pathway leads up to the room. Now generally, the way I would shoot a real estate video, is that in case of each room I would want to walk through the doorstep (as a foreground) to give a feeling of actually entering that room, as if I was touring the house myself (as in here, for example). In my case however, it seems to be impossible without me showing up in the big mirror(s) in front. It's not like I can squat and problem solved, because I'll show up no matter what.
Question: how would you approach this problem professionally?

Should I just try to shoot everything from the mirrors' direction, from the mirrors' point of view and thus potentially skipping any "walk through the doorway" kind of shots?
Or, should I still force these walk through the doorway shots and then somehow try to remove myself from the image in post production (using After Effects I believe)? Or this latter would overcomplicate the issue a ton?

I tried to research the problem and I have only found to relevant posts. This first one mainly focuses on big budget Hollywood solutions (which is obviously not the situation in my case), this second one suggests that the problem could be tackled in After Effects by applying so called clean plates?
Any ideas or insights are highly appreciated.


text:
Cinema 4d lite to After Effects pulling through white
Can someone please help. I am new to Cinema 4d Lite and After Effects, when I am looking to colour tint in After effects its pulling the artwork through all white so I can't change the colour and render it out.
Any ideas of what I am doing wrong?
Thanks
Sam


text:
"top coded first"?
i notice that ffmpeg often provides four different scan modes (for example with -field_order) : top field first ; bottom field first ; top coded first, bottom displayed first ; and bottom coded first, top displayed first.   the first two (tff, bff) i'm familiar with.   does anyone know definitively what the other two are?   i'd assume that they might refer to the way the video is stored within the container ; perhaps the top field is stored first in the stream, but nevertheless the decoder should display it after reading the following field in the stream ?   although frankly i'm not sure, and i've found exactly zero information on this.   does anyone know ?


text:
Old Bell & Howell Filmo 70HR 16mm camera
I have two B&H Filmo 70HR 16mm film cameras that can use 400’ film magazines with the aid of motors to drive the take-up reel. One has a 24v motor and the other has a 110v motor. Both motors use 3 pin XLR female type power supply connectors. I’m comfortable building a cable to run from a 24v/5w power supply to the 3 pin female XLR power input connector, but using a standard “audio” XLR connector for 110v seems unwise because of the possibility of overheating. Is there a safe way to get from 110v Edison power plug to a female 3 pin XLR connector?

Are you sure it's exactly an XLR, or merely similar. I've been struggling to find any on Google now, but back in the 80s we had all our gear converted to use 'power cannons' - very similar to XLR, but not interchangeable. The male jack had a bare earth pin, but sheathed L/N. I don't still have any of that gear to be able to measure or photograph, I'm afraid.

Ah, i found them listed here - https://en.wikipedia.org/wiki/XLR_connector#Obsolete_patterns

If is a standard XLR, then this is a duplicate of https://video.stackexchange.com/questions/24973/use-xlr-for-power. But good catch if it isn't standard!


text:
Easy way of extanding last frame in kdenlive?
Anyone knows a method to extend last frame of clip in kdenlive?
I am aware of the "export frame to project" but if you update the clip, you will have redo this part.


text:
Replicate the behavior of -r option before applying filters
When converting the framerate of a video, ffmpeg offers multiple options
one options is -r:
ffmpeg -i myvideo.mp4 -r 10 my10fpsvideo.mp4

another option is using filters:
ffmpeg -i myvideo.mp4 -filter_complex [0]fps=fps=10[s0] -map [s0] my10fpsvideo.mp4

Using the second option I can apply further filters on the changed fps stream, like selecting a start frame number for exemple select=gte(n,42)
Both these solutions don't return the same frames from the original video:
-r 10 return the frame indexes  0,1,2,4,7,9,12...
-filter_complex returns indexes     1,3,6,8,11...

As you can see -r somehow shift the output video by 2 frames and doesn't return the same frames as -complex_filter
My problem is I need to apply that start frame number filters, but I also need to extract the exact frames from the original video as -r would do
For exemple: If I convert to 10 fps and want to start at frame index 3 I should receive frames 4,7,9,12..., the frame I would have gotten if had changed framerate using -r and skipped the result's first 2 frame
I am constrained to the exact frames returned by -r by legacy data that relies on these specific frames to be returned. I am also constrained by the fact that input can be VFR and I can't precompute what frames I need to extract for a given framerate.
Right now the only solution I've found is to read the entire video and discard all frame up to that frame number, which is long and cost a lot of resources.
Is there any way to do what I'm trying to do ?

Did you just delete an earlier instance of this Q that I answered?

@gyan Yes, another user pointed out that this was out of topic on stack overflow and needed to be deleted and reposted on video.stackexchange, which is what I did

a) you aren't obliged to follow that, b) see your deleted questions and refer to my answer for a solution

You cannot use -r and -filter_complex together. They are different ways of changing the frame rate. -r is an input or output option. -filter_complex is a filtergraph option. They have different logic and behavior.
You may try this command:
ffmpeg -i myvideo.mp4 -vf “select=‘gte(n,3)’,setpts=N/10/TB” my10fpsvideo.mp4

This will skip the first three frames and then change the frame rate to 10 using the setpts filter. It should give you the same result as -r 10 and then skipping two frames. However, I do not know if it works for variable frame rate input. You have to test it yourself.
I hope this helps.

thank you for your answer, unfortunately, it doesn work even in CFR, if I understood correctly, to get X fps and start at frame F, I should enter the command:
ffmpeg -i myvideo.mp4 -vf “select=‘gte(n,<F+1>)’,setpts=N//TB” my10fpsvideo.mp4
When I try your exact example for frame 2 at 10 fps, I get the frames: [3,3,4,4,5,5,5,6,6,7]


text:
Coloring videos to give bright colors
I am new to video editing and would like to know how to color my videos like the professionals do. I can always tell the difference between an amateur video shot with a Handycam and a professional movie, and I think part of that difference is in the coloring. I have a screenshot from a video with beautiful coloring, and I would like to apply it to my family videos. Is there a simple way to do this?

What are you shooting on & currently editing in? Do you have an example still you could show us for comparison? You can do colour grading in most editing suites these days. Personally I think your example shot is a little hyper-real, but at least it looks 'cheerful'.

Can I kind of extract color grading from a sample shot like this?

Mehdi - as Tetsujin asked, what are you using. Hardware and editing platform. Please show us what your current results are, otherwise we cannot help.


text:
Where to find alternative audio tracks for TV series
How can I add several audio tracks with different translations to a series, as film sites do in some series with 10 translations, where can I find them?


text:
Integration of FFMPEG filters into Adobe Premiere?
As Premiere allows to integrate third party plug-ins I wonder if there is an integration of free filters used in ffmpeg / libavfilter?


text:
How to have manageable video size while recording using Android smartphones?
I have Xiaomi smartphone with Android operating system in it. Whenever I record something using the front camera, even if just for a few seconds, the recorded video file size comes out to be very large as compared to the duration of the video. I say this because I have previously downloaded YouTube videos and movies of 1080p and Blu ray quality. Even for videos/movies of such high quality with long durations of a few hours take just 2-3 Gigabytes. However, in my phone, just a few minutes random video (made using 108 mega pixels front camera) can take nearly upto a Gigabyte. This makes making and storing videos difficult. I know many YouTubers make higher quality videos of longer duration and still those videos have very low file size compared to mine. Please suggest how do I record good quality videos and still have reduced file size.
Should I buy a new hardware or install any recording app to help myself?

Check the settings in your app - it must be set to the highest at the moment. If it doesn't let you change it, then you'll want to look at getting an app that can shrink your raw files down to a smaller size while keeping quality reasonable.


text:
RTMP to decklink output using FFMPEG results in eventual "crunchy" audio
I'm using FFMPEG to take an RTMP stream and output it to a Decklink device.  Here's the command I'm using:
ffmpeg -i rtmp://192.168.1.4:1935:/publish/internal -async 1 -r 60 -b:a 320k -aspect 16:9 -vf "scale=1920:-1:flags=bicubic" -f decklink -vcodec v210 "DeckLink Mini Monitor HD"

Occasionally (also randomly) the output will get what I can best describe as "crunchy" audio.  I see this error in the ffmpeg output:
Jan 02 22:47:36 kiri bash[505081]: [decklink @ 0x5653d27e0f00] There's no buffered audio. Audio will misbehave!
Jan 02 22:47:36 kiri bash[505081]: [decklink @ 0x5653d27e0f00] There are not enough buffered video frames. Video may misbehave!

I suspect this is due to a hiccup from the device sending the RTMP stream or the RTMP server, but I'd like to find a way to have ffmpeg handle this situation.  I was hoping that the -async 1 flag would tell ffmpeg to speed up or slow down the audio to catch up to the video, but I still ran into issues doing this.
The full ffmpeg output is here:
Input #0, flv, from 'rtmp://192.168.1.4:1935:/publish/internal':
  Metadata:
    |RtmpSampleAccess: true
    Server          : NGINX RTMP (github.com/arut/nginx-rtmp-module)
    displayWidth    : 1920
    displayHeight   : 1080
    fps             : 60
    profile         :
    level           :
  Duration: 00:00:00.00, start: 6.508000, bitrate: N/A
  Stream #0:0: Video: h264, yuv420p(tv, bt709, progressive), 1920x1080 [SAR 1:1 DAR 16:9], 8192 kb/s, 60 fps, 60 tbr, 1k tbn
  Stream #0:1: Audio: aac, 48000 Hz, stereo, fltp, 327 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> v210 (native))
  Stream #0:1 -> #0:1 (aac (native) -> pcm_s16le (native))
Press [q] to stop, [?] for help
[decklink @ 0x563c7fb34440] Found Decklink mode 1920 x 1080 with rate 60.00
Output #0, decklink, to 'DeckLink Mini Monitor HD':
  Metadata:
    |RtmpSampleAccess: true
    Server          : NGINX RTMP (github.com/arut/nginx-rtmp-module)
    displayWidth    : 1920
    displayHeight   : 1080
    fps             : 60
    profile         :
    level           :
    encoder         : Lavf59.27.100
  Stream #0:0: Video: v210, yuv422p(tv, bt709, progressive), 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 2654208 kb/s, 60 fps, 60 tbn
    Metadata:
      encoder         : Lavc59.37.100 v210
  Stream #0:1: Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s
    Metadata:
      encoder         : Lavc59.37.100 pcm_s16le

Anybody have any ideas of what I can change with my command to better address this?


text:
Calculate rolling shutter or shutter speed based on video footage?
I have made a video where i pan evenly across vertical surface (white door edge) and i can notice rolling shutter happening, how do i calculate exactly the amount of rolling shutter or camera shutter speed based on this video footage?
So far i can tell whole movement from edge to edge of the sensor took 1second video made at 50fps so about 1000ms/50ms = 20ms movement speed between frames.
But how do i get shutter speed out of this?


text:
Why does ffmpeg fail to "convert between the formats" with hevc_nvenc when I'm not doing video filtering?
I'm doing some nvidia GPU hevc transcoding to get stuff done at faster speeds. Most of the ~2000 titles that I'm transcoding work fine, but a handful are failing like
Impossible to convert between the formats supported by the filter 'Parsed_hwupload_cuda_3' and the filter 'auto_scale_0'
[vf#0:0 @ 0x55b72ac9a3c0] Error reinitializing filters!
Failed to inject frame into filter network: Function not implemented
Error while filtering: Function not implemented

I'm aware of the need to hwdownload and hwupload during a filtering pipeline, but when I remove all video filters from the command, it instead says
Impossible to convert between the formats supported by the filter 'Parsed_null_0' and the filter 'auto_scale_0'

Here are a couple of examples of commands producing the errors. With filters and an error mentioning Parsed_hwupload_cuda_3:
"ffmpeg" "-hwaccel" "cuda" "-hwaccel_output_format" "cuda" "-hide_banner" "-y" "-i" \
    "in.mkv" "-max_muxing_queue_size" "1024" "-map" "0" "-c" "copy" "-filter:v:0" \
    "hwdownload,format=nv12,crop=1456:1080:232:0,hwupload_cuda" "-c:0" "hevc_nvenc" \
    "-f" "matroska" "out.mkv"

and without filters and the error mentioning Parsed_null_0:
"ffmpeg" "-hwaccel" "cuda" "-hwaccel_output_format" "cuda" "-hide_banner" "-y" "-i" \
    "in.mkv" "-max_muxing_queue_size" "1024" "-map" "0" "-c" "copy" "-c:0" "hevc_nvenc" \
    "-f" "matroska" "out.mkv"

Note: The quoting in the commands is because I'm generating them with a script and logging them out before running.
I can't find any info about that auto_scale_0 filter. Why is it failing like this?

It's a good idea to link the complete ffmpeg logs.

I think there's no problem with your command line. I had the same issue with the latest FFmpeg snapshot I compiled back in january. Try to recompile it with the latest version with https://github.com/markus-perl/ffmpeg-build-script
For me, the freshly compiled FFmpeg solved the issue.


text:
Setup with two monitors, show overlay on one but not on the other
I am setting up a musical project where our ensemble (5 people) will play live music to a silent movie. We seek the best setup for a live performance where:

the audience sees just the movie (monitor 1), presumably via a beamer or projector in the theater
the musicians see the movie plus an overlay with time stamp, cues, countdowns etc. (monitor 2, signal through a splitter distributing the signal to 5 screens).

We would like to be able to

command everything from one laptop (with two hdmi ports, one connected to the beamer, the other to the splitter, if that’s a good idea?)
have the movie and the overlay in separate files, and mix the two together in real time for the musicians, in order to be able to edit them easily during the rehearsal process
control the settings (resolution, warmth, saturation etc.) of both monitors separately (the beamer will be different for every performance, but the ensemble will use the same screens every time)

I’d think this should be a fairly standard application, but am unable to find the right software to do so.
I hope I explained clearly what we are looking for. All hints that can point me in the right direction are much appreciated. Also tips for user friendly software to create and tweak the overlay (timing is crucial since in some scenes we are really playing in sync with the situations as they happen in the movie – sound effects etc.) are welcome.


text:
ffmpeg broken pipeline error when push stream to rtmp server
I was trying to push stream to a rtmp server. firstly, I use OBS with default settings, it works ok. then I decide to use ffmpeg to do it. below is the command I use.
./ffmpeg -re -stream_loop -1 -i input.mp4 \
 -vcodec libx264 \
 -r 60 \
 -b:v 10000k\
 -vf scale=1920*1080\
 -c:a aac\
 -b:a 160k -ar 48000 -ac 2\
 -f flv\
 -flvflags no_duration_filesize\
 -chunk_size 4096\
 rtmp://txy2.live-push.bilivideo.com/live-bvc/?streamname=live_423756438_27609488&key=***************&schedule=rtmp&pflag=1
  #rtmp://192.168.3.2:1935/live/test

all the options above refer from the network packages catched by wireshark when push video with OBS as the screenshot shows below

but I got some error after the command executed.

I've tried pushing stream to both of the rtmp server(you can see at the end of the command,one is a vedio website and another is local) with OBS and both works well but neither of them works with the same error message thrown as shown in the first image.


text:
ffmpeg pass through video including Dolby Video
Given media that contains a video stream that includes Dolby Vision as one of the HDR metadata, how does one transcode the media and maintain the video stream as is (including the Dolby Vision and any other HDR metadata)?
Sample media mediainfo excerpt:
Video
ID                                       : 1
Format                                   : HEVC
Format/Info                              : High Efficiency Video Coding
Format profile                           : Main 10@L5@High
HDR format                               : Dolby Vision, Version 1.0, dvhe.08.06, BL+RPU, HDR10 compatible / SMPTE ST 2094 App 4, Version 1, HDR10+ Profile B compatible
Codec ID                                 : V_MPEGH/ISO/HEVC
...

-c:v:0 copy drops the Dolby Vision metadata from this and retains only the latter HDR metadata.


text:
Need to connect a Nikon D3200 to a windows laptop and use it as webcam
I need to use a dslr as a webcam on my laptop, windows 11. The dslr that I have is a nikon d3200.
I then want to use the camera on OBS Studio when I am live streaming.
What are the different ways for me to do so?
I tried with digicamcontrol. I connected via the usb port on the camera and the usb on the laptop. But when I used hdmi I couldn't find the camera on my laptop.

What does your manual recommend? And what do you mean by "connected via USB...hdmi couldn't find the camera"?

The first way that I tried to connect my nikon d3200 to my laptop was via it's usb cable. This way worked but not how I wanted it to. The solution was to connect the camera to the laptop with an hdmi cable and a video capture card. The hdmi cable has a mini hdmi male at one end and the other end, an hdmi female. The hdmi was connected to the video capture card and the card connected to the laptop ( usb 3.0 port ). The next issue that we have to tackle now is to connect 2 more cameras to the laptop, that is 3 at the same time.


text:
Noise artifacts when recording HDR videos
I have a Google Pixel 7 smartphone with support for HDR (10 bit) video recording technology in 4k 30 frames. And I was wondering how the environment affects the shooting of this video format. When recording HDR in good daylight, the picture really becomes pleasant and colorful in appearance, but for example, when shooting a single light source in a room (with an average brightness level) at the edges of the video, in places where there is relatively little illumination (the light source in the center of the frame), strong noise begins to appear, which is observed in the form of lots of vertical stripes. At the same time, if I shoot a video with the HDR mode turned off in the same conditions, then this noise will not be noticeable (well, accordingly, the video will be with a smaller range of colors). I tried changing the exposure and noticed that when the exposure is lowered, there is less noise, but dark objects in the photo become less distinguishable as a result.

So, how does using this mode affect the final video and why, under the same conditions, may there be noise from turning on HDR?
When do you think it is worth and not worth using this mode?
What needs to be monitored when using it (settings or objects in the frame)?

I apologize in advance to the professionals, I do not understand this topic well, I would like to learn more in simple and understandable language) Thank you


text:
How to use "youtube-dl + ffplay" to play youtube videos?
When I play the video using the code below, it plays normally.
youtube-dl   "https://www.youtube.com/watch?v=cqEp0Kr2kak"  -o  - | ffplay  -autoexit  -i -
But when I specify the video format to play, it downloads the video to the local instead of playing it. I just want to specify the video format to play the video instead of downloading it.
youtube-dl   -f  "bestvideo[height<=?480]+bestaudio/best"   "https://www.youtube.com/watch?v=cqEp0Kr2kak"  -o  - | ffplay  -autoexit  -
what should I do.


text:
Extreme Latency issues when streaming RTMP with FFMPEG
at the moment some colleagues and myself are working on our end-of-school-project, which is a FPV-Drone, where we're doing the electronics and more importantly the Live-Video ourselves.
For this Video-Transmission we have an analogue Camera, which sends a CVBS Signal over a TBS-Unify Transmitter to a Receiver, from where we then Grab the Videosignal and digitize it via a USB2.0-Videograbber (one like this) and stick it into a USB-Port on our Ground-Station a.k.a a Raspberry PI.
Now the Interesting part, the Device is being detected by linux as a /dev/video0 device. This device then acts as the input for the conversion via FFMPEG to an RTMP-Stream, following that gets distributed and can be accessed via a running NGINX-Server on the same RaspberryPi.
Now the problems, it takes ages to load, is laggy as hell and has a massive amount of latency in the range of 5-30s.
I have tested the video input directly from the USB-Interface using VLC-Player, where it has an acceptable amount of delay of ~1s. So, I come to the conclusion that I'm doing something terribly wrong or misunderstanding the conversion via ffmpeg, since it doesn't seem to be such a major problem for other people.

Sidenote, while vlc runs this RTMP-Conversion we get the following warning:
[video4linux2,v4l2 @ 0x55bddeb710] Dequeued v4l2 buffer contains 827396 bytes, but 829440 were expected. Flags: 0x00002001.
Input #0, video4linux2,v4l2, from '/dev/video0':
  Duration: N/A, start: 1937.166532, bitrate: 165888 kb/s
  Stream #0:0: Video: rawvideo (UYVY / 0x59565955), uyvy422, 720x576, 165888 kb/s, 25 fps, 25 tbr, 1000k tbn

I have come to the conclusion that these missing bytes in the buffer are simply because if the transmission over the air, but I wanted to add it if its important

The FFMPEG Command Line Arguments:
fpv@raspberrypi:~ $ ffmpeg -f v4l2 -standard pal -i /dev/video0 -c:v libx264 -crf 23 -an -strict experimental -preset ultrafast -tune zerolatency -maxrate 3000k -fflags nobuffer -fflags discardcorrupt -r 24 -vf scale=480:320 -f flv rtmp://192.168.0.105:554/live/stream

Here come my questions:

Is there something I'm doing inherently wrong or missing during the conversion from the device to the final RTMP-Stream?
Is it normal  that the Buffer size for a Video of is so unbelivably large (~800000 bytes) / is there some way to compress / reduce that amount
Are all those flags I have found on the internet to speed up the conversion even sensical or are the just thin air, bloating the length of the command?

I really have run out of ideas on how to improve on the current sorry state of our video transmission and would now be greatly appreciative if people more knowledgeable than myself in ffmpeg and video in general could lend me a hand here.


text:
audio not offset with video in PIP using ffmpeg
I am trying to create a pip video from two separate sources while keeping the audio from both clips and delaying the pip video x number of seconds. I have successfully done it but sometimes the pip video is delayed/offset the correct time but the audio from the same clip starts immediately at the beginning. if it was consistent, I could debug it further but half the time it offsets properly, other times it doesn't.
I have tried converting both videos beforehand to various formats to try and eliminate a file/codec issue.
Can someone point me in the right direction?
Here is my command that works part of the time.
I am a novice using ffmpeg so this has been a challenge getting this far.
ffmpeg.exe -y -i "path to main video.mp4" -itsoffset 104 -i "path to pip video.mp4" -filter_complex "[1]scale=iw0.3333:ih0.3333 [pip]; [0][pip] overlay=main_w-overlay_w-5:main_h-overlay_h-5[v];[1:a]adelay=104000|104000[a1];[0:a][a1]amerge[a]" -map "[v]" -map "[a]" -ac 2 -ar 44100 -vcodec libx264 -acodec aac ".\Output video.mp4"
Thanks in advance

if you're using itsoffset, use aresample=async=1:first_pts=0 for audio, not adelay.

I took another look at adelay and altered it and it seemed to work fine but I also switched my itsoffset to tpad based on another suggestion. Thanks for the tip, I will give the aresample a look.
Here is the current command as of right now.
ffmpeg.exe -y -i "main.mp4" -i "pip.mp4" -filter_complex "[1]format=yuva420p,tpad=start_duration=70.5:color=black@0,scale=iw*0.3333:ih*0.3333 [pip]; [0][pip] overlay=main_w-overlay_w-5:main_h/2-overlay_h/2[v];[1:a]adelay=70500:all=true[a1];[0:a][a1]amerge[a]" -map "[v]" -map "[a]" -ac 2 -ar 44100 -vcodec libx264 -acodec aac ".\\Output.mp4"


text:
Algorithm to perform adaptive quality control for videos?
0
I recently had an interview experience that was un-aligned with my software engineering experience, but I still think want to get a better understanding of what the interviewer was asking, which I didn't really understand at the time.
Basically, I was given a design and implementation question where I was supposed to design/scope out the APIs to query a video manifest file, and another set of APIs that controls a video player. In terms of the interview itself, I only had to design what the APIs returned, and didn't have to implement the APIs.
The goal is to achieve adaptive quality control using known network conditions and video playback progress for some live stream/video using the APIs that I designed, and I was supposed to implement the adaptive quality control part.
This was a 45 minute interview and was meant to be an implementation question (which I didn't really get to because I was stuck on the design part due to not having any knowledge of this topic area).
My question is what are the complexities when it comes to implementation such a system? What data structures and algorithms are necessary? I would like to understand better some basic adaptive algorithms as it applies here.


text:
Downloading an HLS stream: ONLY in sync when downloading with ffmpeg. Possible explanations?
I'm trying to download a livestream that is just a plain hls with no encryption. I usually use streamlink, but this site I'm trying to use recently doesn't output a correct video/audio synced output when downloaded with streamlink/yt-dlp/nm3u8dl etc.
The only option that produces the correct output with the audio and video in sync is ffmpeg, but ffmpeg is very user-unfriendly and lacks functionality related to retries when connection is lost, and etc.
This is super weird cuz when I play the hls stream using VLC or any other livestream supported players, they are on sync. But what I do noticed is that when I play them on a player, the audio is mute for a second or two and then plays the audio correctly.
Can anyone possibly explain the cause of this situation and probably a fix? I would love to use streamlink instead of ffmpeg.


text:
FFMpeg: how to split a video, process only parts and merge everything back together
I have a question. Do you think I could do the following with FFMpeg:

split a long video in MP4 format into three parts
alter only the first and the third part, reencode them into MP4
finally, merge everything into a single video

and all this without unnecessary processing the middle part?
I have tested two approaches but in both cases there are issues with audio and video at points of merging. Additional info: I work in Windows 10. I currently export part 1 and 3 into AVI, then encode both files to MP4 before they are merged.
Method 1 - no encoding
I simply created a text file:
# inputs.txt
file `input1.mp4`
file `input2.mp4`
file `input3.mp4`

and run ffmpeg -f concat -i inputs.txt -c copy output.mp4. Unfortunately, the video freezes for a fraction of second with distorted audio at merging points, then continue.
Method 2 - using filter complex
> ffmpeg -i input1.mp4 -i input2.mp4 -input3.mp4 ^
More? -filter_complex "[0:v][0:a][1:v][1:a][2:v][2:a] concat=n=3:v=1:a=1 [outv][outa]" ^
More? -map [outv] -map [outa] output.mp4

The video gets encoded but there are still problems at merge points, possibly less noticeable comparing to the method 1.
I wonder if there is anything else I could do to improve the output video, ideally without any issues.
Thanks


text:
Using FFMPEG for Bidirectional Voice Communication with Symmetric RTP
I am trying to make a voice communication between two peers. The first peer is my local machine which is behind a symmetric NAT. The second peer is my server running on an AWS EC2 device which has a public IP address. I want to use FFMPEG for sending the audio stream through RTP while at the same time listening to a known port to receive the audio stream the remote peer sends to my device. In order to not deal with NAT traversal issues, I want to be able to use the same IP address and port number I use for sending on my local device for receiving. Is this plausible? I'm starting to think that this is not possible and here is my rationale:

If my understanding is correct UDP doesn't allow full-duplex communication; that is, one cannot use one IP:port pair for both sending and receiving data packets at the same time. Is that correct?
If one wants to bind a socket that is already been bound, the function throws a bind error saying "Address already in use.". I figured there is a UDP option to allow binding to the same port or address even if they are in use. These options are namely SO_REUSEADDR and SO_REUSEPORT. However, this page states that it is only possible if the port is in TIME_WAIT state. So this also supports my suspicion.

On the other hand, there is symmetric RTP that clearly states a device can receive RTP streams from an address and port that it simultaneously uses to transmit RTP streams from. With exact words of the RFC:

A device supports symmetric RTP if it selects, communicates, and uses
IP addresses and port numbers such that, when receiving a
bidirectional RTP media stream on UDP port "A" and IP address "a", it
also transmits RTP media for that stream from the same source UDP
port "A" and IP address "a".  That is, it uses the same UDP port to
transmit and receive one RTP stream.

A device that doesn't support symmetric RTP would transmit RTP from a
different port, or from a different IP address, than the port and IP
address used to receive RTP for that bidirectional media steam.

So this is where I get confused. Is symmetric RTP somehow works around the limitations of UDP? How am I getting this wrong?
Now going back to FFMPEG and the use of symmetric RTP, I see there is an rtp option we can use to set it up, the so called localrtpport=n. I can find almost no explanation to what it does and how it's useful though. Can anyone help me with that? As far as I can tell, this option tells FFMPEG to use port "n" as the outbound port when transmitting an RTP stream. So if the receiver transmitted its stream to this port then the problem of symmetric NAT requirement would be resolved. Or so I thought...
To draw you a better picture, here are my FFMPEG commands (I'm trying everything in my local host in these commands):
# My Mac with en0 IP of 192.168.1.64
ffmpeg \
-hide_banner \
-re \
-fflags +genpts \
-f lavfi -i aevalsrc="sin(400*2*PI*t)" \
-ar 8000 \
-f mulaw \
-f rtp -reuse 1 "rtp://192.168.1.72:9193?reuse=1&localrtpport=16386&localrtcpport=16387" \
-protocol_whitelist udp,rtp \
-i rtp://192.168.1.64:16386 \
audio_signal_with_symmetric_rtp.mp3

Here I am simply generating a fixed sound signal and outputting it in mulaw format through rtp. I am using the 'localrtport' option to set my outbound port and I am expecting to receive the remote peer's stream on the same port. This command starts running and and waits for the incoming stream. As soon as I start transmitting the stream from my Raspberry Pi which is on the same wireless network, I get the dreaded "Address already in use." error and the process terminates. Here is the command I use on the Raspberry:
# My Raspberry Pi with wlan0 IP of 192.168.1.72
ffmpeg \
-hide_banner \
-re \
-f lavfi -i aevalsrc="sin(400*2*PI*t)" \
-ar 8000 \
-f mulaw \
-f rtp "rtp://192.168.1.64:16386?reuse=1&localrtpport=16386"

TLDR
The short form of the question comes down to this: How can I make use of symmetric RTP with FFMPEG, receive a stream from the same port I am actively transmitting another stream from? Is what I'm asking impossible? Should I go for an alternate route and try to set up a TURN server for my system? Any help would be appreciated.


text:
ffmpeg fails to load lensfun database
I'm trying to correct lens distortion of a video.
I use below code that I took from here: https://ffmpeg.org/ffmpeg-all.html#Examples-132
(I just change the input and output file paths).
ffmpeg -i input.mov -vf lensfun=make=Canon:model="Canon EOS 100D":lens_model="Canon EF-S 18-55mm f/3.5-5.6 IS STM":focal_length=18:aperture=8 -c:v h264 -b:v 8000k output.mov

But I get this error:
[Parsed_lensfun_0 @ 000002a85a0f7ac0] Failed to load lensfun database from default path
[AVFilterGraph @ 000002a8638fa880] Error initializing filters
Error reinitializing filters!
Failed to inject frame into filter network: Invalid data found when processing input
Error while processing the decoded data for stream #0:0
Conversion failed!

How can I resolve this issue?
I tried to give full path with db_path command as seen below:
ffmpeg -i input.mov -vf lensfun=make=Canon:model="Canon EOS 100D":lens_model="Canon EF-S 18-55mm f/3.5-5.6 IS STM":focal_length=18:aperture=8:db_path=E:\lensfun-master\data\db\slr-canon.xml -c:v h264 -b:v 8000k output.mov

And I get this similar error:
[Parsed_lensfun_0 @ 0000020b955cb7c0] Failed to load lensfun database from E path
[AVFilterGraph @ 0000020b94e2e9c0] Error initializing filters
Error reinitializing filters!
Failed to inject frame into filter network: Invalid data found when processing input
Error while processing the decoded data for stream #0:0
Conversion failed!

Am I doing something wrong?


text:
What causes these black lines in Hi8 video and how can I get rid of them?
I've been digitizing some old (late 90s, early 2000s) Hi8 tapes and I've noticed some short black (sometimes white but very rarely) lines that appear randomly in points where the brightness goes from low to high sharply, including the left edge of the frame. Some tapes have no lines and some have many.

In 2022, I recorded a video on an old tape. When I played it back afterwards, there were very few black lines. But when I played it back 1 year after I recorded it, there were about as many as there were in recordings from the 2000s.
What causes this and how can I remove these lines from the video?

Welcome! I never worked with Hi-8 much, but my best guess is the oxide is coming off the tape. I'm guessing that because you said the tape you recorded in 2022 started out with the artifacts and then they got worse. If that's the case, there really isn't much you can do to fix it, just make sure you are storing the tapes in the best conditions possible. But since the artifacts start in a light area, it might be something else that might be correctable. If you have access to another VCR, try a tape in there for comparison.


text:
FFMPEG - converting interlaced 720x480 MPEG2 to scaled up progressive 1440x1080 HEVC (Nvidia available)
I am trying to improve the video of a ripped DVD. The current file is encoded in MPEG2 interlaced and 720:480. I am trying see if it is possible, with a bit of conversion, for it to look better... possibly upscaling to near-HD if it is possible. My computer does have an Nvida (1050 Ti) card, so I was thinking that may help.
I used
ffmpeg -hwaccel cuda -i "input.mkv" -c:v hevc_nvenc -preset p7 -profile:v 1 -level 0 -tier 1 -tune 1 -vf yadif -vf "scale=1440x1080:flags=lanczos" -c:a aac -c:s srt output.mkv

The "-vf yadif" portion in that was intended to de-interlace, after looking at ideas on de-interlacing but the output still ends up being interlaced. The interlace artifact is quite annoying when viewed on my computer.

Your first filter -vf yadif has no effect. This is only the last filter that will be executed. Put the two together : -vf yadif,scale=1440x1080:flags=lanczos


text:
Difference between crf and cq settings in ffmpeg
What is the difference between -crf and -cq parameters of ffmpeg? I am trying to compress 1080p h264 videos into 1080p h265 videos with high quality and low size. I have noticed that in some guides they use -crf while in others they use -cq + -qmin + -qmax.
I have tried researching the difference and all I could come with is that with -crf the size is a bit lower because it reduces data for scenes with fast actions that the person watching would not notice while with -cq that is not the case. Is that it? Are there any more differences? If I have used a number with -crf would the result be similar if I were to use the same number with -cq?
Thank you.


text:
How to edit multiple videos in bulk?
The tasks are

Trim few seconds from the end of the video.
Add default outro.
Render.

I want this same steps done for a lot of videos. Is there a way to automate this?
p.s. I've seen folks suggesting ffmpeg for similar tasks. But I'm looking for something with user interface; I'm not familiar with command line, and don't have time now to dive into it.

Do you trim exactly the same number of seconds from the end of each video? Or does it vary?

@tomh hi, yes, it's the same for all videos. 1 second and 15 milliseconds. I did try to use ffmpeg, but can't figure out make it count from the end of the video.

I know you don't want to use ffmpeg, so I'm not putting this as an answer, but this get duration of files as a variable: https://superuser.com/questions/650291/how-to-get-video-duration-in-seconds#945604

I know you don't want to use ffmpeg, so I'm not putting this as an answer, but this get duration of files as a variable: https://superuser.com/questions/650291/how-to-get-video-duration-in-seconds#945604

Joining files together with FFmpeg is called Concatenating. See here: https://trac.ffmpeg.org/wiki/Concatenate


text:
What is this video technique called and is there software to automate it?
First time question on this stack
I'm trying to make videos for social media, but find it is incredibly time consuming, I'd like to turn long shots into short snippets that skip to the important bits though (a) I'm not sure what that is called, and (b) if there is a software that can do it and if not (c) is there a tutorial to simplify it?
I have put some examples before, it's quite common in cooking videos or 'satisfying' cleaning videos
Cooking
A https://www.instagram.com/reel/C6RKtZFRZcb/?igsh=eGx2c293djF4MThr
B https://www.instagram.com/reel/C3deIhZOSbn/?igsh=NnZhYWhlcXV2bXdj
Cleaning
A https://www.instagram.com/reel/C6ZDywYoXWp/?igsh=Y21hMWp1bTg3YnBr
B https://www.instagram.com/reel/C409ZbWoyCd/?igsh=MTE2N3QxYjM4aTY2dw==
It's often used for crafting and DIY too
But effectively I have long videos of me doing something that I want to jump cut to be 30 seconds or so just of the main/interesting bits but want to know if this can be automated or if you need to go through and choose c.2-5 second chunks
Thanks in advance,

This technique is called jump-cutting, and while it isn't easily automated it can be done pretty quickly with keyboard shortcuts and pro editing software.
In Premiere Pro, for example:

Scrub through the timeline. Every time you get to a moment you want, use the razor tool to cut the clip (ctrl+k), skip a few frames, and make another cut. Repeat.
Once you've made all your cuts, select every clip and ripple delete (shift+delete) them.

This is also possible in other (free) editing software, such as DaVinci Resolve, but keybindings may be different. A similar process can be used, though.

Thanks Cam, are there any recommended free video editors for this?

DaVinci Resolve is a great option! It has the same/similar features, but the key combinations may be different. It's an incredibly powerful free video editor, I just suggested Premiere because I'm most familiar with it.


text:
Kdenlive, fade out cannot applied on certain clips. why and when?
Lastest Kdenlive 24.02.2 Mac os
I am about to fade in a custom sfx, and fade out original audio; at the same time. Somehow kdenlive yield cannot add effect to the selected clip I really wonder why. and how to overcome this?
I try not to place the fade in and fade out on the same time, but it yield the same.
Presumably, it is possible, someone might explain when this happen?


text:
Can KDEnlive actually crop a video area, like we crop an image?
OBS screen recording filled non-selected area black (that is, the video resolution was 1080p like the monitor, even though I had selected only part of the monitor). I wanted to "crop" it to the actual video area using Kdenlive. A.I. told me to use Edge Crop, but I could not get what I want. In the end, I just used ffmpeg -i proj1.mp4 -filter:v "crop=800:500:0:0" output.mp4 command-line.
Can I get the same result with Kdenlive? Note that the video had two segments (I added a cut in the middle so that I could apply "blur" to only a part of timeline.

Yes of course - use a Transform Effect. If your recorded area was actually 800x500, then the aspect ratio will not match 1920x1080. You could resize the 1920x1080 frame by 1920/800 width and 1080/500 height to get the small video zoomed in, or use 2.4x size if you're fine with top and part being cropped out.