text:
DaVinci Resolve 18 not importing footage into media library
I am trying to use DaVinci Resolve 18.6 on Linux Mint 21.3 but I am having a rather peculiar issue when trying to add footage to the media storage.  I had rather lengthy footage in *.mp4 format that wasn't even recognized by Resolve (most likely because I am on the free version).  I converted this to *.mov format using ffmpeg and the result (even larger than the mp4) could be imported.
However, it was impractical to work with this huge file. It didn´t seem able to even generate proxies in spite of the resolution of my *.mov files being 720p.
I then resorted to extracing the various segments I was interested in using this ffmpeg incantation:
ffmpeg -v quiet -y -i 2015_0101_000056_008.MP4 -c:v dnxhd -vf "scale=1280:720,fps=60000/1001,format=yuv422p" -b:v 110M -c:a pcm_s16le \
-ss 00:01:16 -t 00:00:22 -sn -an -dn footage08_001.mov \
-ss 00:02:07 -t 00:00:30 -sn -an -dn footage08_002.mov \
-ss 00:02:42 -t 00:00:06 -sn -an -dn footage08_003.mov \
-ss 00:32:40 -t 00:00:21 -sn -an -dn footage08_004.mov \
-ss 00:38:43 -t 00:00:32 -sn -an -dn footage08_005.mov \
-ss 00:39:34 -t 00:00:46 -sn -an -dn footage08_006.mov \
-ss 00:40:53 -t 00:00:35 -sn -an -dn footage08_007.mov \
-ss 00:41:42 -t 00:00:11 -sn -an -dn footage08_008.mov

I have confirmed that I can watch each of these shorter clips both in VLC and Celluloid.
Now comes the issue: when I try to import these clips (by either dragging&dropping or using the contextual menu "Import Media") only the first one is imported.  I even tried removing the clip that was imported and then manually selecting just the second one but that didn't work. Re-importing the first one again worked fine.
I dumped the metadata for the first two clips but I cannot see anything that would explain why the first one can be imported but none of the others:
$ ffprobe -show_data -hide_banner footage08_001.mov
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'footage08_001.mov':
  Metadata:
    major_brand     : qt
    minor_version   : 512
    compatible_brands: qt
    encoder         : Lavf58.76.100
    comment         : DEMO1
    comment-eng     : DEMO1
  Duration: 00:00:22.01, start: 0.000000, bitrate: 219975 kb/s
  Stream #0:0(eng): Video: dnxhd (DNXHD) (AVdn / 0x6E645641), yuv422p(tv, bt709/unknown/unknown), 1280x720, 219980 kb/s, SAR 1:1 DAR 16:9, 59.94 fps, 59.94 tbr, 60k tbn, 60k tbc (default)
    Metadata:
      handler_name    : VideoHandler
      vendor_id       : FFMP
      encoder         : Lavc58.134.100 dnxhd
$ ffprobe -show_data -hide_banner footage08_002.mov
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'footage08_002.mov':
  Metadata:
    major_brand     : qt
    minor_version   : 512
    compatible_brands: qt
    encoder         : Lavf58.76.100
    comment         : DEMO1
    comment-eng     : DEMO1
  Duration: 00:00:30.00, start: 0.000000, bitrate: 7791 kb/s
  Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1280x720, 7785 kb/s, 60 fps, 60 tbr, 15360 tbn, 120 tbc (default)
    Metadata:
      handler_name    : VideoHandler
      vendor_id       : FFMP
      encoder         : Lavc58.134.100 libx264

As a matter of fact, I have several original footage that I broke down in the manner described above.  When importing media, only the first clip is ever imported.  So, I could see:

footage01_001.mov
footage02_001.mov
footage03_003.mov

Imported correctly but never:

footage01_002.mov
footage02_002.mov
footage03_002.mov

I searched blackmagic's forum and stackexchange for something vaguely similar to no avail.
It may well be something very silly but I would be really greateful if someone could shed some light in this mystery.

Could it be that Resove thinks these are the same clip? Maybe also have a look at Supported Formats and Codecs.

U. Windi is probably correct.
I was trying to use DaVinci Resolve on Debian/bookworm using the zip/run file install method.
This was with an mkv h.264 video from OBS Studio, that being the default format.  But the Linux Resolve doesn't support this on the free version, you need DaVinci Resolve Studio for that.
Switching OBS to record in mp4 format instead has actually allowed me to import the video into Resolve.
I will say that there was absolutely zero error reporting from Resolve about this.  It just did ... nothing.  I couldn't see anything relevant in the log file I found either.


text:
How to achieve this raising text with shadow in AE?
I've been sent this video (image attached) by a client and I'm trying to recreate it so I can add some extra wording to the animation. The text raises word by word, with the 3d shadow extending up with it. I've managed to get the black outline and 3d shadow by adding Stroke and then Repeater with 55 copies at a 0.3 angle. The words are converted from text to shape. I just can't for the life of me figure out how to extend the letters HIGHER. When I add more copies to the Repeater, it extends the shapes backwards (away from the viewer) instead of pushing the letter towards the viewer.
Hope I'm making sense. Thank you for your help!

Add a text layer to a comp.
Make the text layer 3D.
In the Composition Settings, change the 3D render to Advanced 3D

Duplicate your text layer
Make the top layer text a bright colour, and the lower text layer black
Set the black text layer Geometry Options to have an Extrusion Depth:

Adjust the 3D rotation or orientation of both text layers so the text is slightly angled from your view:

Precomp both layers, choosing "Move all attributes into new composition".
In your master comp that now only contains a single pre-comped layer, make sure the pre-comp layer is 2D not 3D, otherwise the next step won't work.
Right click on your pre-comp layer and choose Outer Glow from the Layer Styles.  Make the Blend Mode Normal, Spread to 100%, and adjust the Size to taste.  Put a bright background layer behind it.

If anyone has a technique for adding a 2D stroke or outline to a 3D comp without having to pre-comp, I'd love to know

source: Stack Exchange

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

sort: votes


text:
How to concat several video clips with different property using ffmpeg
I want to concat several videos using ffmpeg.
I have 1.mp4 2.mp4 3.mp4 files
I used this command
ffmpeg -y -i 1.mp4 -i 2.mp4 -i 3.mp4 -filter_complex "[0:v]trim=0:10,scale=1920:1080,setsar=1[v0];[1]trim=0:10,scale=1920:1080,setsar=1[v1];[2:v]trim=0:10,scale=1920:1080,setsar=1[v2];[v0][v1][v2]concat=n=3:v=1[outv]" -map "[outv]" -g 12 -c:v libx264 output.mp4

I expected the output.mp4 to be 30 seconds but it was 20 seconds long and the third video wasn't concatenated correctly.
If I try to concat using the same video like this
ffmpeg -y -i 1.mp4 -i 1.mp4 -i 1.mp4 -filter_complex "[0:v]trim=0:10,scale=1920:1080,setsar=1[v0];[1]trim=0:10,scale=1920:1080,setsar=1[v1];[2:v]trim=0:10,scale=1920:1080,setsar=1[v2];[v0][v1][v2]concat=n=3:v=1[outv]" -map "[outv]" -g 12 -c:v libx264 output.mp4

It worked.
Please help me solve this.
Thanks

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


text:
FFmpeg CRF causing glitches on fade-ins
I'm transcoding some high bitrate h264 5K videos which start with a fade in, at CRF 22 H264 mp4 using FFmpeg via MyFFmpeg. The fade ins are all causing some blocky glitching for a few frames. It's not visible on my powerful pc but played back on a Meta Quest 3, I'm seeing them every time. The videos are otherwise perfect - are there any settings I can tweak to maintain quality during this fade in, whilst not having to significantly increase file size throughout the whole video? Thanks for the advice.


text:
How to concat videos and images with ffmpeg
I have videos and images. I want to concatenate them. And I want the images to be displayed for specific duration, say 10 seconds.
If I first convert image to video and concate, it works
ffmpeg -y -loop 1 -t 10 -i missing.png -c:v libx264 -pix_fmt yuv420p 7.mp4

ffmpeg -y -i 5.mp4 -i 7.mp4 -i 2.mkv -filter_complex "[0:v]trim=0:10,scale=1920:1080,setsar=1[v0];[1:v]trim=0:10,scale=1920:1080,setsar=1[v1];[2:v]trim=0:10,scale=1920:1080,setsar=1[v2];[v0][v1][v2]concat=n=3:v=1[outv]" -map "[outv]" -c:v libx264 -r 30 output.mkv

But I want to do it with one ffmpeg command.
for example
ffmpeg -y -i 5.mp4 -loop 1 -t 10 -i missing.png -i 5.mp4 -filter_complex "[0:v]trim=0:10,scale=1920:1080,setsar=1,format=yuv420p,fps=30[v0];[1]format=yuv420p,scale=1920:1080,setsar=1,fps=30[v1];[2:v]trim=0:10,scale=1920:1080,setsar=1,format=yuv420p,fps=30[v2];[v0][v1][v2]concat=n=3:v=1[outv]" -map "[outv]" -c:v libx264 -r 30 -pix_fmt yuv420p output.mkv

I expected above command to be working but it didn't. It only concate the first video and 10 seconds of image. Only a few frames of the  third video were added and the duration of output video was only 20 seconds. I expected it to be 30 seconds.
Please help me what is wrong or provide me such ffmpeg command
Thanks


text:
Really struggling to record video + sound on PC, can anybody steer me in right direction?
This is what I'm trying to acheive:
Record myself playing guitar with 3 microphones. They are USB condenser microphones plugged into my PC
One channel for voice in the middle, and 2 channels for right and left guitar (1 microphone on sound hole and one pointing at the neck)
This is for classical guitar, so no direct input into PC
After the recording is done, I want to be able to adjust the balance on the left and right guitar so it's mixed evenly in stereo.
I have OBS studio and Audacity, but will get whatever software I need.
How can I acheive this?

After the recording is done - with OBS you won't be able to change anything in the resulting video file. You can do this while recording with OBS, but if you want to edit separate recordings from each source, OBS is not the right tool.

Ok thanks, so what kind of tools should I use to acheive this?

There are already questions about video editing software: https://video.stackexchange.com/questions/14820/free-video-editing-software


text:
How do I change the color format of a video in ffmpeg?
I have upscaled an old DVD to 4K through various samples and appended the files producing the following x265 file within an .mkv container:

My TV can't directly play the video, though, usually able to play x265 encoded videos without any problems whatsoever. I believe the problems lies in the color formatting being yuv420p(tv, gbr/reserved/reserved).
Comparing the values with another 4K video also x265 encoded yields the only difference being the color format here being yuv420p(tv).
How do I convert one color format to another in ffmpeg and do I have to re-encode the video (same encoding format, different color format)?


text:
Vertical edges appear shaky while the camera moves horizontally
I have noticed that in the video

the vertical edges of the rock (I mean the rock that is a kind of a monument just behind the subject) seem to jump back and forth while the camera is steadily panning left.
This phenomenon is particularly noticeable when the playback speed is set to 0.5.
The author of the video says it was shot with a gimbal, but I’m unsure if this particular part was as well.
What could be causing this issue?


text:
How to create a box shadow effect when overlaying an image on a video using FFmpeg?
I'm working on a video project where I need to overlay an image on a background video. I've managed to achieve the basic overlay using the following FFmpeg command:
ffmpeg -i background.mp4 -i image_video.mp4 -filter_complex "[0][1]overlay=(W-w)/2:(H-h)/2" -c:v libx264 -crf 23 -preset veryfast output.mp4

This command overlays the image on the background video, centered. However, I would like to add an effect similar to a CSS box shadow, where the overlaid image has a shadow that gradually fades out, giving it a sense of depth.
I've tried various combinations of FFmpeg filters, such as boxblur, gblur, and drawbox, but I can't quite achieve the desired effect.
I'm attaching two images to illustrate what I have and what I'm trying to achieve:
The current result of my FFmpeg command : https://i.imgur.com/3uK79jP.png
An example of the desired box shadow effect : https://i.imgur.com/KaIq7VI.png

if resolution of image.png 312x420, create shadow +10px
ffmpeg -lavfi "
color=black:322x430,format=rgba,
geq=lum='p(X,Y)':a='
if(gt(abs(W/2-X),W/2-20)*gt(abs(H/2-Y),H/2-20),
if(lte(hypot(20-(W/2-abs(W/2-X)),20-(H/2-abs(H/2-Y))),20),
lerp(0,255,(10-hypot(20-(W/2-abs(W/2-X)),20-(H/2-abs(H/2-Y))))/10),0),

if(lt(X,  20)*between(Y,20,H-20),lerp(0,255,   X /10),
if(gt(X,W-20)*between(Y,20,H-20),lerp(0,255,(W-X)/10),
if(lt(Y,  20)*between(X,20,W-20),lerp(0,255,   Y /10),
if(gt(Y,H-20)*between(X,20,W-20),lerp(0,255,(H-Y)/10),
0)))))'
" -frames 1 shadow.png

then overlay shadow (shifted to 3px down) and rounded image by 10px on background video
ffmpeg -i bg.mkv -i shadow.png -i image.png -lavfi "
[2]geq=lum='p(X,Y)':
a='if(gt(abs(W/2-X),W/2-10)*gt(abs(H/2-Y),H/2-10),
if(lte(hypot(10-(W/2-abs(W/2-X)),10-(H/2-abs(H/2-Y))),10),255,0),255)'[p];
[0][1]overlay=(W-w)/2:(H-h)/2+3[v];
[v][p]overlay=(W-w)/2:(H-h)/2
" out.mp4

bash script:
#!/bin/bash

IMG="image.png"
IFS=, read WID HEI <<< $(ffprobe -v 0 -select_streams v:0 -show_entries stream=width,height -of csv=p=0 "$IMG")
echo $WID $HEI
# margin, change it:
LOW=10
(( RAD=2*$LOW ))
(( SHW=$WID+$LOW ))
(( SHH=$HEI+$LOW ))

ffmpeg -i bg.mkv -i "$IMG" -lavfi "
color=black:${SHW}x${SHH}:d=0.01,format=rgba,
geq=lum='p(X,Y)':a='
if(gt(abs(W/2-X),W/2-${RAD})*gt(abs(H/2-Y),H/2-${RAD}),
  if(lte(hypot(${RAD}-(W/2-abs(W/2-X)),${RAD}-(H/2-abs(H/2-Y))),${RAD}),
  lerp(0,255,(${LOW}-hypot(${RAD}-(W/2-abs(W/2-X)),${RAD}-(H/2-abs(H/2-Y))))/${LOW}),0),
if(gt(abs(W/2-X),W/2-${RAD})*between(Y,${RAD},H-${RAD}),lerp(0,255,(W/2-abs(W/2-X))/${LOW}),
if(gt(abs(H/2-Y),H/2-${RAD})*between(X,${RAD},W-${RAD}),lerp(0,255,(H/2-abs(H/2-Y))/${LOW}),
0)))'[s];

[1]geq=lum='p(X,Y)':
a='if(gt(abs(W/2-X),W/2-${LOW})*gt(abs(H/2-Y),H/2-${LOW}),
if(lte(hypot(${LOW}-(W/2-abs(W/2-X)),${LOW}-(H/2-abs(H/2-Y))),${LOW}),255,0),255)'[p];

[0][s]overlay=(W-w)/2:(H-h)/2+${LOW}/3[v];
[v][p]overlay=(W-w)/2:(H-h)/2
" out.mp4

ffplay out.mp4


text:
Color histogram transfer with ffmpeg
I don't know if this is even possible, and I'm new to this, but I'll try and ask anyway:
I have two videos that are largely the same; they are recordings of the same thing. However, in one of them, the colors are wrong. What I want is to in some way transfer or carry over the information about the colors, the brightness, saturation, etc. from the good version to the poor version. Is this at all possible and if it is, how would I achieve this with ffmpeg or some other similar open source software?


text:
Transporting Video Signal Over Optical Fiber
I have stumbled upon an issue while doing an application. In this application there is an existing multimode fiber which is installed. We will be using Sony PXW-Z90 and QuestTel's optical extenders. My application exceeds a one kilometer distance which is not supported by multimode fiber. Since changing multimode to singlemode fiber is not an option, I would like to know if there is an option that exists that doesn't require me to change the existing infrastructure to boost the optical signal.
I am truly looking forward to a good response,
John


text:
How to access a video as *apm file in OBS?
I'm an OBS newbie and completely screwed up by mistakenly saving my video output as an *.apm (audio) file. I tried to extract the file from the apm wrapper using GIMP (Mac) and Image Converter Plus (Windows) but without success.
What options, if any, do I have?
Thanks for your time and help.
J.


text:
How to create animated gif from images files?
i tried this command line
D:\Captured>ffmpeg -framerate 1/2 -start_number 1 -i "D:/New folder (76)/Image%d.png" -loop -1 D:/test.gif

but getting error
[image2 @ 00000000026324a0] Could find no file with path 'D:/New folder (76)/Image%d.png' and index in the range 1-5
D:/New folder (76)/Image%d.png: No such file or directory
here is a screenshot image of my folder with the images and i want to get only the images type png that start with the name Image

I can see you have the problem with the path. Try this one.
D:\Captured>ffmpeg -framerate 1/2 -start_number 1 -i "D:\New folder (76)\Image%d.png" -loop -1 "D:\test.gif"


text:
How to view Audio and Video of an on-going RTMP stream?
I have looked, and may be missing this question if it already has been asked.
It is possible to view the video/audio (or audio alone) in a RTMP stream. The workflow goes as follows:
Video Encoder -> ASR Cloud Captioning Platform -> Final Destination Platform.
The ASR Cloud service is using the RTMP Push method of giving the Video Encoder a URL and Key to stream to. Then using the URL and Key from the Final Destination it sends the stream, with the closed captions.
What I am seeing is if anyone knows how to grab, or pull, the RTMP stream audio before it gets sent out to the Final Destination? The purpose of this is to give the audio to a 3rd Party so they can transcribe.
I have tried to send the ASR Cloud URL to VLC with no avail. The error code basically comes down to "unknown".
I also cannot have the ASR Cloud send the stream to a broadcaster, like OBS or Restream, due to the latency of audio vs. captions. Once the Final Destination receives the stream it needs to receive the closed captions within two seconds.
Thank you for any help!


text:
What layer adjustments were added to this short film?

Hi everyone, looking for some pointers toward what sort of (colour, light,..) editing was done to create the effect in this video?


text:
How to remove text from video
I tried many techniques and ai tools to remove text from my video but I still can't get desired results so can anyone help me
*Text is at centre so can't crop it

How did the text get into your video?

The centre of your video is usually the most important part of your image. Any attempt to 'fix' it is going to be more noticeable than fixing something near the edges.
I would try Content Aware Fill in After Effects - mask the text, expand and feather the mask slightly, make a 'clean plate' as much as you can, then use this to repair the shot.
One of the AI tools like Runway may get closer, but you're still going to be recreating lost information - nothing is likely to look perfect. If you can add a still or clip of the video to the question, you're likely to get a better answer.


text:
AFX: 3D extruded shape layer – add texture or opacity to front?
I have a shape layer, render changed to “cinema 4d”, extrude the layer in 3d space.
I can add solid colors to “front, back, side” etc. How can I either add a texture to the front (glass or something), change the material of the whole layer (like in cinema 4 itself) or at least change the opacity of the front only (not the other sides), so it would become some kind of “glass/transparent” box (but still looks 3d)?
I could split up into 2 layers (one just top flat surface, one 3d for behind) but is there another way?
Thanks!


text:
How to keyframe a slider control in After Effects
Lets say i want to animate a number using a slider control and I want the number to be "1" on the first keyframe and on frame number 20 i want it to be "2". Now if I place a keyframe on frame number 20, the number will change instead on frame number 10 as it is the halfway point. Intuitively I was expecting the animation to start counting the decimals after the first keyframe and finally on the last, after reaching 1,9 it would turn into 2 exactly on frame number 20. However it seems this isn't the case. I'm trying to use this method for animating a date counter on a historical video and it's important the date, lines up exactly with what's happening on the video. And constantly moving keyframes up and down will take a long time. Is there any other solution, or am I missing something.

The value of the text will recalculate on every frame, based on the value of your slider at that time, so if you've set the following values:
frame = 1  slider = 1
frame = 20 slider = 2

then the value of the slider at frame 10 will be 1.5
On frame 19 it will be 1.95 as that is the correct linear calculation of that value at that time.
It might be easier if you make a new answer explaining exactly what you want to achieve.
If you want only a single decimal place, you could do that like this:
slider = (effect("Slider Control")("Slider").value);
output = (Math.round(slider * 10))/10;
SourceText = output

The Math.round function (note the annoying capital 'M'), causes the number to round to the nearest whole number. Because you want decimal places, we multiply it up by ten inside the function, do the rounding, then divide it again after the rounding. Think of the number of zeroes in that line as the number of decimal places you want, ie if you wanted two decimal places, change the '10' values both to '100'.
This will give you:
Frame = 1  text = 1.0
Frame = 10 text = 1.5
Frame = 19 text = 1.9
Frame = 20 text = 2.0

If you wanted to keep the value rounded down until you hit frame 20, use Math.floor like this:
slider = (effect("Slider Control")("Slider").value);
output = (Math.floor(slider));
SourceText = output

Which gives:
Frame = 1  text = 1
Frame = 10 text = 1
Frame = 19 text = 1
Frame = 20 text = 2

Or if you wanted to keep it rounded down to one decimal place:
slider = (effect("Slider Control")("Slider").value);
output = (Math.floor(slider *10))/10;
SourceText = output

Gives:
Frame = 1  text = 1.0
Frame = 10 text = 1.5
Frame = 19 text = 1.9
Frame = 20 text = 2.0

You can also use the Toggle Hold function in your keyframes by right clicking a keyframe, and selecting 'Toggle Hold', which will hold your slider at a specific value if you need to.
In general, every time I'm working with sliders for text expressions, I start with this expression:
slider = (effect("Slider Control")("Slider").value);
tidying = (Math.round(slider * 100))/100;
SourceText = "$" + tidying + "bn" +"\r" +"DEBTS";

Which usually gets me close to what I need - it allows for rounding to two decimal places (the 100 values do this), text before the value (in this case a dollar sign), text after the value ("bn"), and a new line (created using "\r"), and text on the line beneath it ("DEBTS").
I think there are neater ways to do this now - take a look at these rounding techniques, but this is the way I usually do it.

This answers and explains it beautifully thank you. In the end I ended up adding one decimal point so that the number wouldn't round up prematurely. And to hide the decimal I just used a mask. My problem in this case is that my video is about a historical event and in my animation, I need the date to turn from 1520 to 1521 at an exact point in the animation. So when I put the keyframe in the exact location the number changes too early. Unfortunately the 'Numbers' effect doesn't help me because I can't set it back in time earlier than 1910. I'm gonna look into the things you sent.

use two hold keyframes on the two frames where you need them to switch - ie one at 1520, and one at 1521


text:
What is this video dithering effect called + how can i achieve this?
I'm going to make a vlog using this effect since I was looking for a LQ, Nokia-ish footage! What is this effect called and can it be achieved via After Effects? Thank you!

You can get close to this effect using Red Giant Shine and Glow plugins on the text, add a Lens Flare in the middle, then add an adjustment layer over all of it, with a Posterize plugin to reduce the number of colours used (about level 22 should do it), then a mosaic effect to reduce the effective resolution
not in any way perfect, but getting there, needs more noise and atmospheric light, mabye a lux plugin etc etc..


text:
In which order do `-itsscale` and `-itsoffset` apply in my FFmpeg command?
I want to use both -itsscale and -itsoffset in my FFmpeg command, but couldn't find any information in the docs https://ffmpeg.org/ffmpeg.html or elsewhere, if the order, in which they're mentioned in the command, matters, or in which order they will generally be applied to the video.

I decided to just try it out with an example video file and then compare the results I'm getting for each command.
First, we generate an example 5 seconds video file example.mp4 for testing, counting from 1 to 5, showing each number for 1 second:
for n in $(seq 1 5); do
  magick convert -size 200x200 xc:black -fill white -draw "circle 100,100 100,200" \( -background white -fill black -pointsize 200 label:"$n" -trim -resize 100x100 \) -gravity Center -composite "$n.png"
  ffmpeg -loop 1 -i "$n.png" -pix_fmt yuv420p -r 25 -t 1 "$n.ts"
done
ffmpeg -i "concat:$(printf %s.ts\| $(seq 1 5))" -c copy example.mp4
for n in $(seq 1 5); do
  rm "$n.png"
  rm "$n.ts"
done

Next, we generate reference videos by applying the timestamp modifications sequentially, via an intermediary file:

Applying an offset of 3 seconds, first, will lead to skipping numbers 1, 2 and 3 and remaining numbers 4 and 5 will be scaled to length of 3 seconds each:
ffmpeg -itsoffset -3 -i example.mp4 -c copy itsoffset.mp4
ffmpeg -itsscale 3 -i itsoffset.mp4 -c copy itsoffset_itsscale.mp4

Scaling to 3 seconds per number and subsequently adding an offset of 3 seconds will skip only number 1 in the final output:
ffmpeg -itsscale 3 -i example.mp4 -c copy itsscale.mp4
ffmpeg -itsoffset -3 -i itsscale.mp4 -c copy itsscale_itsoffset.mp4

Finally, we can run the two different variants of the command to find out which output we're getting:
  ffmpeg -itsoffset -3 -itsscale 3 -i example.mp4 -c copy test_itsoffset_itsscale.mp4
  ffmpeg -itsscale 3 -itsoffset -3 -i example.mp4 -c copy test_itsscale_itsoffset.mp4

Both commands lead to identical output files, which means that the order, in which they're mentioned in the command, doesn't matter. Furthermore, the resulting video shows that offset will be applied first, then scaling.


text:
How to delay beginning of audio without re-encoding?
I have a file containing both video and audio stream. I want to delay the audio by 5 seconds relative to the beginning of the video, without having to do any re-encoding.
The command I tried was:
ffmpeg -i input.mp4 -itsoffset 5 -i input.mp4 -map 0:v -map 1:a -c copy output.mp4

But it doesn't seem to have any effect.
Interestingly enough, the opposite shift, advancing audio by 5 seconds, works fine:
ffmpeg -i input.mp4 -itsoffset -5 -i input.mp4 -map 0:v -map 1:a -c copy output.mp4

What could be the reason for this behavior? What do I need to change?

Depends on player.

You're writing that VLC player should honor the delay, but VLC player is what I'm using. Also, is there no way to "edit" the "timestamps" in-place? Or to permanently apply the editlist?

If 'advancing' works, does it work for the video stream? Same effect as retarding the audio, if so.


text:
Same FFmpeg command produces different Matroska MKV output file checksum
The following exemplary FFmpeg command takes an MP4 file, doesn't do any re-encoding, but simply writes the output to an MKV file:
ffmpeg -i input.mp4 -c copy output.mkv

If I run the same command twice, with two different output files:
ffmpeg -i input.mp4 -c copy output1.mkv
ffmpeg -i input.mp4 -c copy output2.mkv

The resulting files will have differing checksums:
aa46d308197cb08d71f271c61d5412ad  output1.mkv
8b48c3ebdbf2384705fcb78e864d12e3  output2.mkv

This difference disappears if I convert them back to an MP4 container:
ffmpeg -i output1.mkv -c copy output1.mp4
ffmpeg -i output2.mkv -c copy output2.mp4

For differing MKV input files I'm getting the same checksum for the MP4 output files:
24e92b3e228db780b5feab14255870e4  output1.mp4
24e92b3e228db780b5feab14255870e4  output2.mp4

So obviously the video itself hasn't been modified and there's some metadata in the MKV container that's responsible. What data is it and how do I prevent this data from being added?

See answer for the same question.

Original question has been closed and when voting to close, it seems like migration from StackOverflow to here isn't an option. I've already messaged Gyan to post their answer here again. However, feel free to post an answer yourself. :) For example, I'm still wondering if -bitexact has further implications, other than avoiding random track ids.


text:
What exactly do FFmpeg options `-itsoffset` and `-itsscale` do?
If I understand correctly, the answer at Lossless A/V delay with ffmpeg seems to suggest that option -itsoffset leads to additional metadata, called "editlist", being added to the video file. It's then the video player's responsibility to honor this metadata and shift the stream accordingly.
Is it possible to display this metadata to find out if a video file has been edited this way?
What about -itsscale? Does it work the same way?

Is it possible to display this metadata to find out if a video file has been edited this way?

In the MPEG-4 parlance, it is not metadata — it is an edit list table inside an edit list box.
Note: My previous links point to the QuickTime file format (MPEG-4 is derived from it, and it is almost the same), and what is called an atom in this format, is called a box in the MPEG-4.
You may see the edit list table(s) in any hexadecimal viewer — search for the elst string, then

skip 4 bytes (version and flags of this edit list atom, probably 00000000).
In the next 4 bytes is the number of entries in subsequent edit list table — probably it will be 00000001 or 000000002 — see red boxes in my 2 pictures of 2 similar .mp4 files.

After it follow edit list table itself - 12 bytes for every entry.
In every of these 12-bytes long entries:

you may skip the first 4 bytes (the duration of this edit list segment),
in the next 4 bytes (green boxes in my pictures) is the starting time of this edit list segment (in media timescale units) — the value FFFFFFFF means that this is an empty list (so you may completely ignore this entry)
in the last 4 bytes (blue boxes in my pictures) is the media rate of this edit list segment in the so-called fixed point number format:

in the first 2 bytes is the integer part,
in the last 2 bytes is the fractional part
(in the hexadecimal number base, i.e. the first hexadecimal digit represents the number of sixteenths, the next number of 1/256, etc.).

Notes:

elst is the box type value of the edit list atom.
I used the internal viewer of Total Commander (in the hexadecimal mode), but you may use any other.
I doubt that the current versions of FFmpeg use edit lists for processing -itsoffset and -itsscale input options.


text:
Automatically blending low motion frames to speed up a video
I have a long video clip of driving that I would like to speed up. The video is a mix of driving (where there's a lot of movement in the scene) and waiting at stoplights (where there is almost no movement). What tool or technique could I use to blend frames with low motion to speed up the video? ffmpeg mpdecimate comes close, but it drops frames instead of blending them.

How much of a speedup do you need? And what does 'blending' mean to you? Collapsing a longish section of video into a shortish one, no matter how you do it, will involve dropping some frames. Consider keeping a (say) five second 'handle' on the end of one action clip, and similar at the beginning of the next. Then delete everything in between and do a two-second dissolve between the clips. Or whatever durations look appealing to you.

Thanks for the reply. I ended up writing a Python wrapper around ffmpeg that identifies frames with a low amount of change between them that then blends (averages) those frames instead of dropping them like ffmpeg mpdecimate does. It ends up being kind of a cool effect.


text:
FFMPEG drawText with fontSize scale "bounce" animation
I'm trying to add a "bounce" animation on a section of text from a known startTime and endTime
My initial approach has been to split the start and end times into a first half ( scale up ) and second half (scale down)
const start1 = start;
const start2 = start + (end - start) / 2;
const end1 = start + (end - start) / 2;
const end2 = end;

And then combine 2 ffmpeg filters
First
fontsize = 25 + (10 * (t - ${start1}) * (${end1} - ${start1}) / (${start1} - ${end1}) + ${start1})
Second
fontsize = 25 + (10 * (1 - (t - ${start2}) ) * (${end2} - ${start2}) / (${end2} - ${start2}) + ${start2})
My math could be off but both commands appear to render the text at an initial size, and scale down further than I want.
Is this possible?
Thanks!

try sinus: :fontsize='25+30*if(between(t,$start,$end),sin(PI*(t-$start)/($end-$start)),0)'

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


text:
Converting Sony x.v.Color / xvYCC video into format supported by Apple devices
My Sony camera is producing video in 8 bits/channel H.264 with a color space that Get Info in macOS Finder doesn't have a textual name for but just lists as (1-11-1). ffprobe says yuv420p(tv, bt709/bt709/iec61966-2-4, progressive), which indicates that transfer function 11 means https://en.wikipedia.org/wiki/XvYCC . Searching apple.com for information about xvYCC, x.v.Color, or IEC 61966-2-4 does not result in indication of support, which one might expect given that Finder doesn't know about the CICP triple.
What software can I use to convert these videos into a wide-gamut format that Apple devices with Apple playback software support without clipping the gamut to sRGB?


text:
Channel mapping in FFmpeg conversion of Dolby 7.1 mlp file to 8 channel wav file
I have a mlp file with 7.1 audio with the following channel mapping (viewed using MediaInfo): L R C LFE Ls Rs Lb Rb
I want to convert it to an 8 channel riff64 wave file, so I'm using the following command:
ffmpeg.exe -i "input.mlp" -rf64 auto -c:a pcm_f32le "output.wav"

When I do this, the channel mapping in output.wav changes to (viewed using MediaInfo): L R C LFE Lb Rb Ls Rs
I'm not sure if this is just a label that gets slapped on there, or if it actually changes the channel positions (i.e., rear surround comes out of side surround speakers and vice versa).
Is there a better command I should be using to ensure that the channel mapping is not altered?

try to extract channels to separate files: ffmpeg -i Nums_7dot1_24_48000.wav -filter_complex "channelsplit=7.1[a][b][c][d][e][f][g][h]" -map '[a]' 1.wav -map '[b]' 2.wav -map '[c]' 3.wav -map '[d]' 4.wav -map '[e]' 5.wav -map '[f]' 6.wav -map '[g]' 7.wav -map '[h]' 8.wav change 7.1 to actual layout, maybe 7.1(wide)

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


text:
How to properly specify font file for ffmpeg as it's always defaulting to Arial?
When calling ffmpeg it keeps defaulting to Arial-MT / Arial-BoldMT even when specifying a font. How do you correctly specify the fontfile?
When specifying any font it will always default back:
[Parsed_subtitles_0 @ 000001915a83f800] fontselect: (DosisBold, 400, 0) -> ArialMT, 0, ArialMT
I am calling ffmpeg with the following command:
ffmpeg -i input.mp4 -vf subtitles='subtitle.srt':force_style='FontName=DosisBold,Alignment=10,Fontsize=24' output.mp4 -loglevel debug
I have a file called "DosisBold.ttf" in the same folder as ffmpeg. I have already tried FontName=DosisBold.ttf and it also doesn't work. All files are in the same folder as the ffmpeg.exe.
I have converted the .srt file to .ass and specified the font file but it still defaults back to ArialMT.
Format: Name, Fontname, Fontsize {...}
Style: SubStyle,DosisBold,24 {...}

I am using "ffmpeg-n7.0-latest-win64-gpl-7.0", I have tried different versions of ffmpeg (e.g. "ffmpeg-master-latest-win64-gpl") and still no change. Also tried different fonts / font files and it always defaults back to Arial.

try this :
ffmpeg.exe -i "filename"  -filter_complex "subtitles=filename.ass:fontsdir=./fonts:force_style='FontName=Arial Rounded MT Bold,PrimaryColour=&H0000FFFF,SecondaryColour=&H000000FF,OutlineColour=&H00000000,BackColour=&H20000000,BorderStyle=4,Fontsize=17'" -c:v libx264 -crf 20 "$filename.mp4"
With a font directory with your font (here : ./font/ARLRDBD.TTF) and the name of your font not ttf file name (here : Arial Rounded MT Bold).
Enjoy


text:
Subtitle word scaling with ASS file causing line shifting
0
I'm trying to make my subtitles scale one word at a time, but I'm running into an issue with the whole line shifting. Is there a way I can scale a word, and make the other words not move sue to the scale effect? Here is the ASS File
[Script Info]
ScriptType: v4.00+
PlayResX: 384
PlayResY: 288
ScaledBorderAndShadow: yes
[V4+ Styles]
Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, OutlineColour,
BackColour, Bold, Italic, Underline, StrikeOut, ScaleX, ScaleY, Spacing, Angle,
BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, Encoding
Style: Default,Arial,18,&H00FFFFFF,&H00FFFFFF,&H00000000,&HFF000000,-1,0,0,0,100,100,0,0,3,1,0.6,5,10,10,10,0
[Events]
Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text
Dialogue: 0,0:00:0.00,0:00:1.00,Default,,0,0,0,,{\an5\pos(192,144)\alpha&HFF&}And so my fellow Americans,
Dialogue: 0,0:00:0.00,0:00:02.50,Default,,0,0,0,,{\an5\pos(192,144)\fscx90\fscy90\t(0,2500,\fscx120\fscy120)}And{\fscx100\fscy100} so my fellow Americans,
Dialogue: 0,0:00:2.50,0:00:05.00,Default,,0,0,0,,{\an5\pos(192,144)\fscx120\fscy120\t(0,2500,\fscx100\fscy100)}And{\fscx100\fscy100} so my fellow Americans,

this shows the video output.
https://youtube.com/shorts/d4VaoWqTMtQ?feature=share
Thanks in advanced.

You can split text to 2 lines: Dialogue: 0,0:00:0.00,0:00:02.50,Default,,0,0,0,,{\an5\pos(50,14)\fscx90\fscy90\t(0,2500,\fscx120\fscy120)}And
Dialogue: 0,0:00:0.00,0:00:02.50,Default,,0,0,0,,{\an5\pos(200,23)} so my fellow Americans,. Change \pos() values to fit. Why PlayResX PlayResY is not 720 1280?

This is a good idea, but measuring the text is very tricky.  Any suggestions for how to accurately measure the letters, and spaces to match where it naturally goes?  The PlayResX and PlayResY are being set by stable-ts, which is generating the ass file.  Maybe these are just defaults, but you're right, I will update to the input video.

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


text:
FFmpeg RTSP Recording: Video Timestamp Does not Match With Recorded MP4 File Timestamp
I'm currently testing by streaming a 30 fps example flv video using a local Happy-Time RTSP server.
This is the flv file i am streaming with RTSP:

I recorded the video with below ffmpeg command:
ffmpeg -i rtsp://127.0.0.1:6555/test30fps.flv -c copy test30fps.mp4

The resulting video appears visually satisfactory, yet there's a discrepancy between the displayed time on the video and the actual duration of the video file. Although the MP4 file duration is correct (endRecordingTimeMs-startRecordingTimeMs= mp4 file duration), the time displayed within the video does not synchronize precisely with the file's time. Notably, this disparity escalates as the video progresses.
I anticipate the time text overlaid on the video and the file's time to align seamlessly. However, a few seconds of divergence are noticeable, gradually expanding over the video's duration.

Why does this occur and is there any way to fix this?


text:
What is Pan tool for in AE?
As I see it, Pan in AE simply moves the object (like the Selection Tool). By the way, the Pan Under Cursor Tool and the Pan Camera POI Tool work exactly the same.

What does Pan actually do in AE (the Selection Tool and Pan cannot perform the same functions)? And what is the difference between the Pan Under Cursor Tool and the Pan Camera POI Tool?


text:
What term is used to refer to audio filters that take two source tracks, one of which mutes the other?
I'm trying to recreate an audio effect that was shown to me in OBS (though this was shown too long ago for me to remember how to do this) in post production, but I simply don't know the actual term for it. Essentially, I'm playing around with two separate audio tracks of the same points in time, where each of which have important information for different periods. One track is a crisp & clean audio track coming from a headset, and the other is from a noisier ambient microphone that captures a lot of things. I'm trying to combine these two audio tracks in a way that can actually keep the best versions of each track, and the plan here is to prioritize the headset audio when it's on, but fallback to the ambient audio when it's not. What's the term that I can look for to apply a filter that makes this headset track "mute", or at least suppress the other track, temporarily?

The term you're looking for is "audio ducking". Most editing software has an automated way to do it, for example here's a tutorial on how to do it in premiere.


text:
Ffmpeg dynamic cropping for every frame
I have different crop parameters for every frame. I was using sendcmd but apparently, that is not working.
This is the format of my sendcmd file
0.00 crop 'w=466:h=432:x=1373:y=336';
0.02 crop 'w=324:h=382:x=277:y=693';
0.03 crop 'w=304:h=332:x=1364:y=794';
0.05 crop 'w=348:h=448:x=1500:y=966';
0.07 crop 'w=466:h=412:x=794:y=193';
0.08 crop 'w=390:h=502:x=1425:y=813';

And I am running this command
ffmpeg -ss 0 -t 1 -i Demo.mp4 -filter_complex "[0:v]sendcmd=f=crop_parameters.txt[video]" -map "[video]" output_%03d.png

These are the logs coming from FFmpeg
[Parsed_sendcmd_0 @ 0x6000016709a0] [expr] interval #0 start_ts:0.000000 end_ts:9223372036854.775391 ts:0.083367
[Parsed_sendcmd_0 @ 0x6000016709a0] [expr] interval #1 start_ts:0.040000 end_ts:9223372036854.775391 ts:0.083367
[Parsed_sendcmd_0 @ 0x6000016709a0] [enter+expr] interval #2 start_ts:0.080000 end_ts:9223372036854.775391 ts:0.083367
[Parsed_sendcmd_0 @ 0x6000016709a0] Processing command #0 target:crop command:w arg:147
[Parsed_sendcmd_0 @ 0x6000016709a0] Command reply for command #0: ret:Function not implemented res:
[Parsed_sendcmd_0 @ 0x6000016709a0] Processing command #1 target:crop command:h arg:258
[Parsed_sendcmd_0 @ 0x6000016709a0] Command reply for command #1: ret:Function not implemented res:
[Parsed_sendcmd_0 @ 0x6000016709a0] Processing command #2 target:crop command:x arg:928
[Parsed_sendcmd_0 @ 0x6000016709a0] Command reply for command #2: ret:Function not implemented res:
[Parsed_sendcmd_0 @ 0x6000016709a0] Processing command #3 target:crop command:y arg:102
[Parsed_sendcmd_0 @ 0x6000016709a0] Command reply for command #3: ret:Function not implemented res:

It resulted in no cropping of the video, it just gives the exact same frame


text:
Audio issue with pcm_bluray when creating BD-Video using ffmpeg, tsMuxer and Xorriso

ffplay and VLC can playback HDV.m2t source camcorder clips joined with cat. That is video and audio seamingly works with this ffplay output:
ffplay -hide_banner HDV01.m2t
[mpegts @ 0x7f82c4000cc0] Could not find codec parameters for stream 2 (Unknown: none ([160][0][0][0] / 0x00A0)): unknown codec
Consider increasing the value for the 'analyzeduration' (0) and 'probesize' (5000000) options
[mpegts @ 0x7f82c4000cc0] Could not find codec parameters for stream 3 (Unknown: none ([161][0][0][0] / 0x00A1)): unknown codec
Consider increasing the value for the 'analyzeduration' (0) and 'probesize' (5000000) options
Input #0, mpegts, from 'HDV01.m2t':
Duration: 01:02:20.32, start: 0.440000, bitrate: 26168 kb/s
Program 100
Stream #0:0[0x810]: Video: mpeg2video (Main) ([2][0][0][0] / 0x0002), yuv420p(tv, bt709, top first), 1440x1080 [SAR 4:3 DAR 16:9], 25000 kb/s, 25 fps, 25 tbr, 90k tbn
Side data:
cpb: bitrate max/min/avg: 25000000/0/0 buffer size: 7340032 vbv_delay: N/A
Stream #0:1[0x814]: Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz, stereo, fltp, 384 kb/s
Stream #0:2[0x815]: Unknown: none ([160][0][0][0] / 0x00A0)
Stream #0:3[0x811]: Unknown: none ([161][0][0][0] / 0x00A1)
23.04 A-V: -0.022 fd=   0 aq=   47KB vq= 3588KB sq=    0B f=0/0

The HDV.m2t camcorder sources are itself mpeg2 BD-video compliant and can be copied as is without re-encoding. The MP2 audio needs to be transcoded using pcm_bluray in my case and ffmpeg 6.1 on openSUSE Leap 15.5.
ffmpeg -hide_banner -i HDV01.m2t -c:v copy -c:a pcm_bluray -mpegts_m2ts_mode 1 HDV-01.mts

Also this BD-compliant mts stream playback fine with ffplay
ffplay -hide_banner HDV-01.mts
[mpegts @ 0x7f2174000cc0] stream 1 : no PTS found at end of file, duration not set
Input #0, mpegts, from 'HDV-01.mts':
  Duration: 01:02:38.24, start: 1.440000, bitrate: 27883 kb/s
  Program 1
    Metadata:
      service_name    : Service01
      service_provider: FFmpeg
  Stream #0:0[0x1011]: Video: mpeg2video (Main) ([2][0][0][0] / 0x0002), yuv420p(tv, bt709, top first), 1440x1080 [SAR 4:3 DAR 16:9], 25000 kb/s, 25 fps, 25 tbr, 90k tbn
    Side data:
      cpb: bitrate max/min/avg: 25000000/0/0 buffer size: 7340032 vbv_delay: N/A
  Stream #0:1[0x1100]: Audio: pcm_bluray ([128][0][0][0] / 0x0080), 48000 Hz, stereo, s16, 1536 kb/s
   7.79 A-V: -0.023 fd=   0 aq=  221KB vq= 3161KB sq=    0B f=0/0

The mts files are accepted as input in tsMuxer to create BD-Video iso, which next is used to burn the BD-video structure to BD-R disks with Xorriso.
tree -sh /run/media/terje/HDV-01+02+03_BD
/run/media/terje/HDV-01+02+03_BD
├── [ 520]  BDMV
│   ├── [  40]  AUXDATA
│   ├── [ 288]  BACKUP
│   │   ├── [  40]  BDJO
│   │   ├── [  92]  CLIPINF
│   │   │   └── [141K]  00000.clpi
│   │   ├── [ 120]  index.bdmv
│   │   ├── [ 290]  MovieObject.bdmv
│   │   └── [  92]  PLAYLIST
│   │       └── [ 402]  00000.mpls
│   ├── [  40]  BDJO
│   ├── [  92]  CLIPINF
│   │   └── [141K]  00000.clpi
│   ├── [ 120]  index.bdmv
│   ├── [  40]  JAR
│   ├── [  40]  META
│   ├── [ 290]  MovieObject.bdmv
│   ├── [  92]  PLAYLIST
│   │   └── [ 402]  00000.mpls
│   └── [  92]  STREAM
│       └── [ 37G]  00000.m2ts
└── [  88]  CERTIFICATE
└── [  40]  BACKUP
14 directories, 9 files

ffplay and VLC does also playback video and audio ok directly from the BD-Video disc
ffplay -hide_banner /run/media/terje/HDV-01+02+03_BD/BDMV/STREAM/00000.m2ts
[mpegts @ 0x7fbbf0000cc0] stream 0 : no PTS found at end of file, duration not set
[mpegts @ 0x7fbbf0000cc0] stream 2 : no PTS found at end of file, duration not set
[mpegts @ 0x7fbbf0000cc0] stream 3 : no PTS found at end of file, duration not set
[mpegts @ 0x7fbbf0000cc0] stream 5 : no PTS found at end of file, duration not set
Input #0, mpegts, from '/run/media/terje/HDV-01+02+03_BD/BDMV/STREAM/00000.m2ts':
Duration: 01:02:30.04, start: 4200.000000, bitrate: 83837 kb/s
Program 1
Stream #0:0[0x1011]: Video: mpeg2video (Main) (HDMV / 0x564D4448), yuv420p(tv, bt709, top first), 1440x1080 [SAR 4:3 DAR 16:9], 25000 kb/s, 25 fps, 25 tbr, 90k tbn
Side data:
cpb: bitrate max/min/avg: 25000000/0/0 buffer size: 7340032 vbv_delay: N/A
Stream #0:1[0x1012]: Video: mpeg2video (Main) (HDMV / 0x564D4448), yuv420p(tv, bt709, top first), 1440x1080 [SAR 4:3 DAR 16:9], 25000 kb/s, 25 fps, 25 tbr, 90k tbn
Side data:
cpb: bitrate max/min/avg: 25000000/0/0 buffer size: 7340032 vbv_delay: N/A
Stream #0:2[0x1013]: Video: mpeg2video (Main) (HDMV / 0x564D4448), yuv420p(tv, bt709, top first), 1440x1080 [SAR 4:3 DAR 16:9], 25000 kb/s, 25 fps, 25 tbr, 90k tbn
Side data:
cpb: bitrate max/min/avg: 25000000/0/0 buffer size: 7340032 vbv_delay: N/A
Stream #0:3[0x1100]: Audio: pcm_bluray (HDMV / 0x564D4448), 48000 Hz, stereo, s16, 1536 kb/s
Stream #0:4[0x1101]: Audio: pcm_bluray (HDMV / 0x564D4448), 48000 Hz, stereo, s16, 1536 kb/s
Stream #0:5[0x1102]: Audio: pcm_bluray (HDMV / 0x564D4448), 48000 Hz, stereo, s16, 1536 kb/s
4222.27 A-V: -0.000 fd=   4 aq=  205KB vq= 3160KB sq=    0B f=0/0

However, playback the disc in a standalone Blu-ray video player, doesn't find the audio.
Is here possibly a mapping problem that can be solved during transcoding 2) above?

Another second issue I discovered just now without exploring it more yet:
Three mts files were loaded as input to tsMuxer, resulting in the
[ 37G]  00000.m2ts stream above.
But so far I didn't succeed to access more than the first 12G stream....?
Any ideas what has happened here ?


text:
Unable to add text box with background color in ffmpeg
I have a video on which I want to have a text box on top of the video for this purposes I am using ffmpeg's following code `import subprocess
def byte():
video = "assets/byte/bite.mp4"
command = [
"ffmpeg",
"-i", video,
"-filter_complex",
"[0:v]drawtext=text='name of the person':fontcolor=black:x=20:y=20:enable='between(t,0,10)'[text];"
"color=white:s=2000x50:d=10[bg];"
"[bg][text]overlay=10:10:enable='between(t,0,10)'",
"-map", "0:v",
"finalbite.mp4"
]
subprocess.run(command)
return "finalbite.mp4"
byte()
`
But the code is returning a video file containing just a white stripe with video frame dimensions as of that white line and video duration of input video
I am wondering what might be wrong ?

You draw text on video and overlay on color=white. Change chains to: ...complex "color=white...,drawtext=...[text]; [0:v][text]overlay.... And remove -map 0:v

still not working. the code is producing a video with only a white horizontal bar in the whole video with the sound of the video and a black background.

try this filter chain: color=white:s=2000x50:d=10, drawtext=text='name of the person':fontcolor=black:x=20:y=20:enable='between(t,0,10)'[text]; [0:v][text]overlay=10:10:enable='between(t,0,10)'

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


text:
Add custom Poster Frame to a movie with ffmpeg by combining two commands with a pipe
I can export a frame as .png from, say 1.2 seconds from the beginning of the movie (=1 second and 5 or 6 frames with 25 or 30 fps input):
ffmpeg -ss 1.2 -i input.mp4 -frames:v 1 image.png

And then losslessly use that .png as a custom Poster Frame in that movie:
ffmpeg -i input.mp4 -i image.png -map 0 -map 1 -c copy -disposition:v:1 attached_pic output.mp4

Question: how can I pipe those two commands together?

Generate the poster frame in the same command:
ffmpeg -i input.mp4 -ss 1.2 -i input.mp4 -map 0 -map 1:v:0 -c copy -c:v:1 png -filter:v:1 trim=end_frame=1,setpts=0 -fps_mode:v:1 passthrough -disposition:v:1 attached_pic output.mp4

Thanks, that works with ffmpeg 6.1.1 with .mp4 and .m4v.
But that does not work with .mov: macOS 14 QuickTime Player.app displays the old Poster Frame and exiftool does not report any ItemList:CoverArt in the output .mov. With .mov input and .mp4 or .m4v output it works. Apple's Compressor.app 4.7 can insert Poster Frame also to the re-encoded .mov but that is lossy.
p.s. thanks for the info about that workflow with ffmpeg. I am still curious how to pipe such commands. My attempts to do so produced at best only the output of the 1st command, which I could not pipe to the 2nd command.

A workaround for .mov is to extract .png and insert it with exiftool:
ffmpeg -ss 1.2 -i input.mov -frames:v 1 image-%03d.png and exiftool -P -overwrite_original '-CoverArt<=image-001.png' input.mov With 4K 10-bit HLG .mov the exported .png might be too large (~44 MB) but that should be patched in exiftool 12.85. Is it possible to reduce the size ffmpeg exports? Or maybe use .jpg instead? link

png bloats the movie so it might be better to use 'mjpeg' instead 'png' in the Gyan's and my commands above. For example, in one movie the 44 MB 3840x2160 Deep Color png could be substituted by just 0.5 MB 3840x2160 True color jpg. Apple's Compressor 4.7 also uses .jpg in its CoverArt Poster Frames.


text:
How do I slow down audio in ffmpeg by more than half (*NO* tempo correction)
I have video that I want to slow down to 1/4 speed using ffmpeg. Unfortunately, I can't figure out how to get the audio to slow down without any attempt to maintain pitch. Everything I find by searching is about how to use the atempo feature to slow down audio while maintaining pitch. I want the opposite.
The best I figured out was to use "asetrate=44100/2", but the sound wasn't as good when I play it slow in VLC (also without tempo correction). I'd like to do this all in one command if possible. All I want to do is change the PTS of the audio just like the video.
Simply setting a PTS on the audio did not work either (invalid argument)
Isn't this kind of slowdown the most technically simple? It's literally just playing it slower with adjustment of any kind. Surely ffmpeg can do this?


text:
Configuring ffmpeg HLS demuxer buffering strategy
Are there options to configure the buffering strategy of ffmpeg's HLS demuxer in a scenario where I use it to pull a HLS stream as input and I re-stream that?
I am looking for options that would allow me setting the number of pre-fetched TS segments / or the prefetched duration for instance.


text:
Seeking Tool(s) to Restack Frames from an MP4 Video of a Total Solar Eclipse to Keep the Sun Always Centered
I would like to take a video that I recorded of the 2024 Total Solar Eclipse edit it to keep the center of the Sun in the center of the video. I used a SkyGuider Pro tracking device but was not able to get the device properly aligned with the north celestial pole in broad daylight before the eclipse began and there were at least two (maybe three) times I had to re-adjust the camera to keep the Sun within the frame of the video.
I have used the FFMPEG application to export 1 frame ever 2 seconds which resulted in ~5500 individual image files from the video itself. I realize that as the moon eclipses the sun, the shape of the sun changes which can be problematic when it comes to holding a reference point in a frame and I'm dreading the thought of having to manually stack them one by one in a video editor but if that is what must be done, then so be it.
If there are any softwares or tools that can be used to automate such a task, I would greatly appreciate suggestions/recommendations?
Thanks.

You need video stabilization. Ideally, you would do it in an app like After Effects where you can manually tweak the keyframes after running the stabilizer once. But for a first attempt, you can try the vidstab filters in ffmpeg:

Start by converting your images into a video. Based on your question, I'm assuming you either have done this or know how to do it.
You can then take your file into After Effects, and use a stabilizer there. There's a few ways to approach this. The first, which may be worth a shot, is just to slap a warp stabilizer on it. Depending on your footage, this may or may not work (more than likely it won't).
So, if that doesn't work, time to try something else. If you're open to learning a more in-depth piece of software, Mocha AE is really good at tracking, but it has a bit of a learning curve. With mocha, you'd be able to place a circular mask around the sun and track it that way, and you'd likely get a solid result. It's too involved to write a full tutorial here, but here's a checklist to get you started:

Take your footage into Mocha. It's free and comes with AE.
Use an internet tutorial to track the sun. Something like this might get you going in the right direction.
Once you have your tracking data, you can export it back to AE. This is the process by which Mocha sends keyframe data to some object in AE, you'd probably want to use a null. Again, this is something you could find details about online.
You can then parent a camera to that null, so the camera always points at it. This would have the effect of stabilizing your footage.

If you want a slightly less involved approach, you can just use the built in AE tracker. It's less precise and may or may not work as well, and you'd probably have to do tweaking, but it'd help at least a little. The process would be similar, track to a null and parent a camera to the null.
If you don't have access to AE or don't want to buy it, DaVinci Resolve is excellent and free, and I believe it would achieve your goal, but I don't have as much experience with it.
Good luck!


text:
How can I convert H.264 to NTSC for analog video transmission?

For a UAV project we're using an Nvidia Jetson Nano as our mission computer on a fixed wing for object recognition purposes and we agreed that analog video transmission, widely popular with fpv drones, could be the solution to live video feed from the drone to our GCS (due to low cost, simplicity and light weight) but we couldn't figure out how to convert the processed H.264 video output from Jetson to NTSC or PAL to be send to the analog video transmitter.

Is there any way for us to achieve such decoding-encoding process?

I managed to find certain video converters with HDMI input and RCA outputs that I though could be useful but they don't work out either while we won't have a GUI on Jetson to be displayed using HDMI.

Anyone knows a way or equipment for such purposes? Also I'm quite new to the topic thus apologies for any false statements.

I don't think analog video transmission is widely popular with fpv drones. All of DJI's drones transmit FPV using digital video signals now. The best place to get answers to a question about drones would be a drones forum like  https://www.dronevibes.com

@tomh - analogue transmission is widely popular among certain types of drones. Most of my drones are analogue. It is much lower bandwidth, but much lower latency, which is essential for racing drones etc


text:
ffmpeg - Trouble using if statement with overlay
I would like to apply a .png on two frames of my input video but
I'm having trouble using an if statement to determine the location of the overlay.
Expected:
Frame n°7 -> Frame n°7 + overlay.png with pos(300,700)
Frame n°12 -> Frame n°12 + overlay.png with pos(0,0)
Frame n°?? -> Frame n°??
Here is the ffmpeg command found on this post with similar use-cases: How to have an overlay move to specific points at specific frames using ffmpeg
ffmpeg -i input.mkv -i overlay.png -filter_complex "[0:v][1:v]overlay=x='if(eq(n,7),300,0)':y='if(eq(n,7),700,0)':enable='eq(n,7)+eq(n,12)'[out]" -map [out] output.mkv

But in my case, the if condition x='if(eq(n,7),300,0)' and y='if(eq(n,7),700,0)' always return false and I do not understand why this is happening.
Thanks!

...:enable='eq(n,6... in x y → n starts from 1? in enable → n starts from 0?

@БаярГончикжапов
It works! Thank you very much!

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


text:
ffmpeg - set dynamic pts on video
I try to set pts for each frame of the input video.
Here is the command I use to slowdown frame 1 and speed up frame 2:
ffmpeg -i input.mkv -filter_complex "[0:v]setpts='PTS*2*eq(N,0)+PTS*0.5*eq(N,1)+...'[out]" -map [out] output.mkv

I am new to ffmpeg and I can't figure out why my output duration is longer than my input.
If I make the 1st frame 2x slower and the 2nd frame 2x faster the output should have the same duration as the input ?
Thanks !

No, if you had 2 frames and your original frame duration was 1 second, then total duration would be 2 seconds. If you changed frame 1 duration to 2 seconds and frame 2 to 0.5 seconds, then total duration would become 2.5 seconds, which is longer.

Now, what your setpts expr actually does is multiply the presentation timestamp directly. That does not do what you intend. PTS have to be monotonic i.e. always increasing, so if frame 20 has original pts 20 seconds, and frame 21 has 21 seconds, then with your expr, frame 20 will have new pts 40 and frame 21 will have new pts 10.5. That's not valid and ffmpeg will adjust the pts of 21 to be larger than frame 20.

Ok, it's clear now. I was confused because I thought that PTS was the starting point of the current frame (taking into account the pts of the previous frame) but if I understood correctly, it is that of the entry without consideration of the previous frames and their pts. Thank you very much for your time! Your answer is well explained !


text:
How do I align many images of a specific landmark?
Every day, on my commute to school, I took a picture of a tall building in the distance from the same place. Now that the school year's over, I'd like to make a video containing all the photos in order. However, there are slight deviations in the photo's angle, resulting in the building moving around a lot in the video.
Here are three sample photos. The tall building in the middle is what I want all the photos to be aligned by.

Can anyone provide guidance on how I should approach this problem?

If you've already turned your pictures into a video, you can just use a point tracker in After Effects.
The process is rather involved but is the sort of thing you can figure out with a few YouTube videos. A summary of what you need to do:

Bring your video into AE and add a point tracker
In the point tracker menu, you'll probably want to check position, rotation, and scale unless all your photos were taken level from the same distance, but I'm assuming they weren't
Choose two easy to follow points on the building, like the top corners and some other point (such as a window)
Step through each frame, adjusting the tracker as necessary
Once you've tracked each frame, create a null and set it as the track target
Create a camera, and parent it to the null so the motion is copied over
Adjust the camera's positioning to your liking

If you want more details, the word for what you're trying to do is "hyperlapse". You can find tons of tutorials on the internet, like this one.


text:
Can I morph my Trim Path "form" into an object?
I am new to After Effects, and I am trying to make an Animation that is a bit hard for my poor skills. I made a Trim Path, and now I want to transform the "form" that follows it into an ellipse shape. Is that possible?

This is quite a tricky one, because one shape is open and the other (the ellipse) is closed.  Usually I would take one shape, turn it into bezier curves, add a keyframe to it, then do the same to another shape, then copy one keyframe from the first shape into the other shape to allow it to morph between the two.  But with one open and one closed shape that won't work.
So in this case, I think I would make a guide ellipse shape first, and make it a different colour to my spiral shape.
Then make the spiral shape on a new layer, above the ellipse.
Set the spiral shape to bezier, and make sure both shapes have a shape position transform of 0,0.
Then add a keyframe to the spiral shape, and a second keyframe later on, which we'll use to match the ellipse.
Go to the second keyframe, and add some guide rulers to exactly line up where the centre of each ellipse point is, as shown:

Make sure Snap to Guides and Lock Guides are both enabled in the View menu.
Then lock your ellipse layer, and select your spiral layer.
Go through one by one, making sure the points manually are positioned to hide the ellipse layer:


text:
Cartoon styled stroke effect?
I want to get this stroke style in After Effects:

Is like it's a little little bit deformed, isn't it? Or is the filter? It seems like in some tracks is 2.5px and 2.3 in anothers... Compare with my current stroke:

Mine is more defined and 'perfect'. I need to apply these old cartoon effect in stroke.
Any idea? Thanks

"Roughen edges" effect applied to the stroke layer - play with the settings.
Then "Add Grain" effect as an adjustment layer, as shown below:
Also see this answer if you need to animate the stroke with roughen edges applied to it.

Yeahhh that's the solution I wanted to. Thank you so much!!


text:
How do I fix dash proportions on After Effects?
I want to have a circle with dashed stroke line. But I don't want them to have these proportions, I want to have it as straight line. Here's what I have on AE:
And here's what I want to achieve:

I need the dashes to stay a straight line, regardless of the gap I will add (because the gap will be animated).

I would try doing this using a text layer.
Type some text dashes "-------".
Add a circular mask path to the same layer.
Turn the mask off.
Set the text to follow Along the Path (in the Path Options twirl down).
Using the Animation triangle thingy, click on Rotation to apply per-character-rotation.
Add more dashes if you need them.
Adjust the thickness using the "horizontally scale" control in the Character Panel.
Adjust the tracking in the Character Panel to adjust the distance between the dashes.
It gives you loads of flexibility, and the ability to make really nice animations too.

As explained in more depth here by @KylasaurusRex:
https://kylehamrick.com/textperiments-1

Like a charm! thank you so much!


text:
ffmpeg recording audio / video sync issues
I'm using ffmpeg to record NTSC analog video on Linux Fedora 36 using a Blackmagic Intensity Pro 4K for video and a Scarlett 2i2 for audio. I'm using a TBC to avoid dropped frames and to ensure a constant S-Video Y/C framerate on the analog end.
The problem I'm running into is that on playback the audio will start out relatively in sync with the video at the beginning of the captured file but will eventually run ahead of the video eventually becoming many seconds off.
Nothing I do seems to change this or change the degree to which it happens. The audio and video stay in sync throughout the entire video as I'm monitoring the source so I don't understand how they can diverge so much once encoded into a digital file?
Here is the command I am using:
ffmpeg -hwaccel cuda -fflags +igndts -format_code ntsc -f decklink -raw_format auto -vsync passthrough -rtbufsize 1500M -thread_queue_size 512 -i 'Intensity Pro 4K' -f pulse -rtbufsize 500M -thread_queue_size 512 -i 'Scarlett 2i2 Camera Analog Stereo' -c copy -map 0:1 -map 1:0 "/tmp/ffmpeg-raw/file-raw.avi"

here's the ffprobe output from one of my files:
Input #0, avi, from 'test2-raw.avi':
  Metadata:
    software        : Lavf59.33.100
  Duration: 00:11:42.87, start: 0.000000, bitrate: 169341 kb/s
  Stream #0:0: Video: rawvideo (UYVY / 0x59565955), uyvy422, 720x486, 167801 kb/s, 59.94 fps, 59.94 tbr, 59.94 tbn
  Stream #0:1: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 48000 Hz, 2 channels, s16, 1536 kb/s

As you can see in my code snippet, I've been throwing things at the wall for a bit. I've tried different rtbufsizes, adding -copyts, and going through the different -vsync options. I've tried it with and without hardware acceleration ( I do have a NVIDIA card), +igdts did get rid of a warning but did not help with the sync, as did changing the thread queue sizes.
OBS can do this, why can't I?

Don't save to AVI - use MKV or NUT.

Tried MKV and NUT and both have the same issue.

I figured it out, I just needed to add -video_pts reference to change the timestamp source. I also needed to add -itsoffset -0.4 to remove the constant delay between the video and audio.


text:
Interlaced or progressive for YouTube?
For shooting a YouTube videos as a talking head I'm choosing a camera.
The shooting will be indoors. Everything will be calm, no fast movements.
That is talking and occasionally to write something on the whiteboard. Educational videos.
I need Full HD 1080, this is understandable. The question is whether I can shoot as interlaced or progressive is a must?
In other words for the abovementioned purposes must the minimum be 1920x1080/30p or 30i is also possible?

IMHO, there is no reason to shoot interlaced in this digital world. Use P.
Also, if you do not need 30FPS, you could use 24 FPS, that way in your indoor setting, you could use a tiny bit of slower shutter speed, allowing your images to be a bit brighter.
I don't know if you are asking because of some budget constraints on the two models of cameras you are comparing, but 30p will look better than even 60i.


text:
ffmpeg - how do i crop different values from top and bottom
i have a mkv file and its resolution is 1280x720. when i calculated the crop using Handbrake, it shows that i need to crop 40 from top and 30 from bottom.
So far i know how to crop equal amount from top and bottom, but i cannot understand how to specify that the crop values for top and bottom are different
so far i tried crop=in_w:in_h-80 which cuts 40 from top and 40 from bottom, but i want to cut only 30 from bottom
thank you

I find it weird that you marked the answer by WYSIWYG as the right answer when it should have been https://video.stackexchange.com/a/36794/38948 by TDGalea which works and is easier to understand as well.

@HarryMcKenzie I disagree and feel that the accepted answer adequately explains the solution. Also, the other answer provided 1) uses Perl so makes assumptions about language and 2) explains the answer similarly, albeit with less information.

@HarryMcKenzie - the OP accepted WYSIWYG's answer, which means it is the best one for them. You may prefer the other one, but it isn't your call to make

After two days of looking for an answer to this question, I found out the logic behind it and I'll share it here, because this topic looks as the best place for it, I hope it helps people understand it more easily through my explanation than through all the other explanations I found with Google on many sites and forums.
So I wanted to crop different number of rows - 20 from the top and 10 from the bottom - of a video file, and I used this command:
ffmpeg -i input.file -vf crop=iw:ih-30:0:10 -c:v av1_nvenc -c:a copy output.file

The logic of the crop=iw:ih-30:0:10 is as follows:

iw - input width of the video, which stays the same as the original

ih - input height of the video, which we want to cut

30 - the total number of rows we want to remove

0 - I don't know why we have to input this, but we just have to

10 - the number of rows, which we want to cut from the bottom

This being the first result I got from searching, I decided to use WYSIWYG answer and write a bash script that simplifies this significantly (at least for me):
#!/bin/bash
if [[ -z $6 ]];then
        printf "Usage:\n"
        printf "        $0 [input file] [output file] [top crop] [bottom crop] [left crop] [right crop]\n"
        printf "Any edges you do not want to crop, enter 0.\n"
        printf "For example, to crop 10 pixels from the top, 11 from the botom, none from the left and 8 from the right:\n"
        printf "        $0 input-file.jpg output-file.jpg 10 11 0 8\n"
        exit 2
fi

inpFile=$1
outFile=$2
tCrop=$3
bCrop=$4
lCrop=$5
rCrop=$6
let xCrop=$lCrop+$rCrop
let yCrop=$tCrop+$bCrop

ffmpeg -i $inpFile -vf crop=iw-$xCrop:ih-$yCrop:$lCrop:$tCrop $outFile
exit $?

Run this script without any arguments to get a how-to printout.
When you specify your crop values for each edge, it does the math for you.  Saves you from having to add up your top & bottom / left & right crops.
A full explanation for the ffmpeg's crop formatting is below. Each of these values represent what they should be in the output file.
crop=w:h:x:y
w = width.
h = height.
x = X (horizontal) position the output should start at, from the left. AKA how many pixels to lose from the left.
y = Y (vertical) position the output should start at, from the top. AKA how many pixels to lose from the top.
As you can see, width and height support "iw" and "ih" respectively to keep those values from the input file. And, you can perform math on those within the command. That's where the "iw-30" comes from in WYSIWYG's answer.

Thank you so much! This one works and is the correct answer!

I love how you break down the different components now you can easily and flexibly set which sides to crop.

Based on https://ffmpeg.org/ffmpeg-filters.html#toc-crop
should it be crop=in_w:in_h-70:0:40

can you please explain how you came to that solution.


text:
Reducing latency with ffmpeg RTSP->HLS->video.js
I am presently using ffmpeg to pull a stream from a camera using RTSP, and then output it as an HLS stream. I also have a webpage with a video.js player, using the example code found on this page.
My full ffmpeg command is as follows:
ffmpeg -rtsp_transport tcp -fflags nobuffer -i rtsp://my_rtsp_url_here -c copy -f hls -hls_base_url http://my_base_url_here/ -hls_time 2 -hls_list_size 8 -hls_flags delete_segments stream.m3u8

(As you can see, I've already done some things in an attempt to reduce latency, such as setting -fflags nobuffer.)
Currently, latency seems to be sitting at at least 12 seconds, though I don't have an exact measure. I would be interested in any suggestions for reducing latency, even if that means switching protocols. The only requirement is that I'd like to be able to serve this stream on a webpage.
I suspect that reducing video.js' buffer might help, but I don't know how to go about doing that.

I've solved my issue by switching webservers. Previously, I was using Python's builtin http.server, which was taking over 2 seconds to serve a single 2-second segment. (Naturally, this caused clientside stuttering and forced it to increase its buffer.)
Now, using Apache (though any other production webserver would probably be just as good) I'm enjoying stutter-free streaming at acceptable latency levels.


text:
Vignetting with Sirui Anamorphic Lens on a Sony A7sii
I just purchased a Sirui 50mm 1.8 anamorphic lens, the Sony E-mount version. It fits on the camera fine as expected. However, there is a lot of vignetting. It happens on both 4k and HD recording modes. Is there some kind of camera setting that will fix this? From what I've read this lens should be compatible with the a7s2.

The lens is built for crop-frame [APS-C] cameras, not full-frame. It cannot fill a full 35mm frame, so you get very heavy vignetting.
Ref: https://cf.sirui.com/Anamorphic-Lens.html
Unless your camera can shoot video in crop-frame, I'd just send it back.
They do make a FF 50mm anamorphic, but it's a lot more expensive. It's a T2.9 - idk how much difference that is going to make to the final image. https://cf.sirui.com/lens/Anamorphic/fullframe?lang=en-us

Dang, an extra $900 for the full-frame version :/


text:
Export multiple clips from timeline in Adobe Premiere Pro
I have a long timeline and want to export multiple clips from it. I know I can set an in point and an out point and export that part. But since I want to export a lot of clips, it quickly becomes tedious to do it one clip at a time. Also, having the in and out of each clips persisted in the project would be great, if I need to export again sometime (using other settings etc).
Ideally I'd like to set multiple in and out points and then just batch export all those clips using the same settings, but I'm not sure if that is possible. I'm of course also open to other solutions to speed up the process.
I've seen guides on how to export multiple clips, but they have all been based on exporting actual clips on the timeline. I need to export parts of the timeline, regardless of the clips in it. That is, the parts of the timeline I need to export may be a part of a clip, or contain multiple clips. I want to set the start and end of each exported part myself.
Maybe there's some way using markers?

Try this:
Make a new sequence. Call it 'Clip 1'.
Drag your original sequence into it.
It will import as a nested sequence.
Set your in and out points on Clip 1.
Duplicate the Clip 1 sequence, and rename it as Clip 2.
Open the Clip 2 sequence, and change the in and out points.
Select the Clip 1 and Clip 2 sequences in your Project window, right click on them and choose 'Export Media'.
The export window will appear.
Make sure that the Range drop down is set to 'Source In/Out'

Choose you export video format.
Click on 'Send to Media Encoder'
Media Encoder should open and export your clips.
If you change the edit your main sequence, Clips 1 and 2 will still export from their In/Out points.
If you need more clips, make additional duplicates of Clip 1 or 2 and adjust their In/Out points as needed.

Thanks @tomh, that will actually do the work! :) I was hoping for some elegant solution using just the sequence I already have, but that seems impossible. I will end up with lots of sequences, but it will satisfy my needs such as being able to batch export and to re-export the same clips again if needed. I think I'm going to use spanned markers in my original sequence to mark and number the clips I want to export. That gives me a better overview, and I can use the markers in the "export sequences" to quickly and exactly set the in and out points. Thanks again! :)

Glad it helped. If you put all your sequences in a bin (adobe’s word for a folder) it will help to keep it all organised.


text:
Mixing multiple streams into one, posible?
How you can I implement a virtual mixer from different streams. When a streamer downloads an obs, it broadcasts the stream directly to the streaming site. Is it possible to make the stream go to another computer, where there will already be a mixing of several streams. I want to do something like 3 people turn on obs or similar software and stream to my computer, where, for example, I mix them in Vmix and send the final image to the streaming service. Is that possible?

The first thing you need is to deploy an nginx-rtmp or nimble streamer server to receive and process the signal from the obs. They can be deployed locally on your computer.(video)
Second in vmix :) read this faq https://www.vmix.com/help24/index.htm?Stream.html
and install VLC_VMIX_MODULE
AND Just srteam.

What you are looking for is a mixer, like the Black Magic ATEM. This type of gear is expensive though and usually only used by TV-studios and professional broadcasting services, so I would think twice before buying one.
An alternative is hard to come by, since you need HMDI or (preferably) SDI inputs that get mixed, which you cannot simply do on a PC or Mac.

I mean not a hardware solution, but a software

The only possible software-solution I can think of is distributing the video and audio to a server. OBS can then grab the data from the URL. However, such services will cost money aswell and you probably won't get around compressing the data, which results in worse quality compared to mixing the signals on an analog mixer.


text:
Understanding YouTube Video Color
When I upload a video to YouTube, the white areas become grey and the colors seem a bit washed out.
This is how it looks locally:

And this is how it looks on YouTube (Screenshot from Firefox):

This happens when uploading the original screen recording (via OBS), as well as when uploading an edited version (edited with Shotcut).
YouTube is clearly able to show "full white" in screen-recorded videos, as seen in this screenshot:

These are my Shotcut export settings:

When I change the "Color range" option from MPEG to JPEG, there is no difference except for Windows Media Player (WMP) showing the colors too bright. VLC Player and YouTube show the same as before.
Changing the codec to libx264rgb made no difference except now WMP isn't able to play the file. Changing the framerate and quality also made no difference.
I just want the video to look the same on YouTube as it does locally. To look the same as the screen that I recorded. And how Shotcut previews it. Why is that just not working? VLC player always shows the video correctly, and even WMP usually does. So why is YouTube different?
Surely I'm just making some stupid mistake here?

Have you got the YouTube link, so it can be double-checked on a colour-managed system?

@Tetsujin https://www.youtube.com/watch?v=ngvQrExjAk0&feature=youtu.be and here is the video file: https://www.dropbox.com/s/fp5j5zxjeme6f8i/electrance.mp4?dl=1

Thanks. Checked. YouTube has re-encoded the video you uploaded. It does look exactly the same if I view it or DL it from YT. Your original video is quite washed out in comparison. Nothing I have here will show it in the 'darker' version from your 2nd pic. YT looks similar to your first pic. I suspect 2 things; your workflow isn't calibrated, causing the mismatch on upload & Firefox is doing its usual 'wonderful' job of failing to translate profiles correctly.  Pic - https://i.sstatic.net/8ysBA.png Left YT, centre YT downloaded to Mac, right Your original from DBox.

See if this will help with FF - https://photo.stackexchange.com/a/124357/57929 - this is how I have mine set & it looks the same as in Safari, Mac on a fully colour-managed system.

@Tetsujin Thank you for your support! I think I'm still confused about how and why videos must include this color information. I applied the about:config settings exactly as you described but it still looks gray-ish on YT for me. I also read that apparently FF does not respect these settings for playing videos. The screenshots from you look correct. I can see "full-white" in other people's videos but not in mine. Another version of the source video, the other one looked fine in VLC but not in WMP (too bright there, JPEG export): https://www.dropbox.com/s/2pub3dhlgtr214j/electrance_old.mp4?dl=1

@Tetsujin Testing in Chromium via the Steam overlay shows the video with correct colors. So it does seem to be related to using Firefox somehow. I don't understand why I can view other videos there just fine and my videos are displayed wrong. Of course I would like the video to be displayed correctly for everyone. So maybe there is some information embedded in the video that shifts the actual colors and makes it display properly elsewhere, but Firefox ignores that? In that case, the other videos seem to not require this, at least from what I can see. I would like my video to be that way too...

@Tetsujin I disabled hardware acceleration and now the video looks correct in Firefox. But again, I didn't have this problem for other videos. Strange.

You 'old' version looks like it has the correct colour - i.e. they match those in YT. I can't even guess at how/why the hardware setting affects the video output - Mac just don't have those settings at all. Windows is completely weird as to how it allows the user to mess up graphics settings without telling them what things do;) Mac has a single, managed, colour workflow.

@Tetsujin Yup, the 2nd, "old" version is the one with Broadcast Limited (MPEG) color range. The one I posted first was JPEG. No idea why the first one looks "overexposed" in some apps. I posted an answer about the hardware accel setting. After that fix, it looks overexposed to me even in VLC, which had it right before. And it's strange to me why there is color management for videos in particular. I, a beginner in video editing, would have expected color management to be system-wide rather than per media item or per media type. Oh well, seems to have been unrelated to video encoding after all.

JPG is a stills format, not video. Video is more likely to be using Rec709 than sRGB. The two are similar but have different gamma curves. I'm afraid I have no understanding as to how Windows decides on its profiling methods… they seem to be 'random' & not properly controlled by the OS. As a Mac user I'm used to the fact that this all 'just works' once your display has been correctly profiled. The OS handles everything after that, only 3rd party browsers have additional settings that will, by default, make poor colour decisions [like those in FF. Chrome has similarly bad default settings].

It seems to be related to NVIDIA Hardware Acceleration, though I don't know why it only affects some videos.
When I disable Hardware Acceleration in the Firefox settings, white areas become white.
(Firefox must be restarted between changes)
When I enable Hardware Acceleration again, they become gray-ish again.
Hardware Acceleration can be enabled but then this option needs to be explicitly set as well in the NVIDIA Control Panel:
Also, the NVIDIA Display Service must be running at all times.


text:
How to make smooth brush strokes in After Effects?
CURRENTLY
I am drawing brush strokes in after effects that will be animated as arrows.
ISSUE
Every time I draw my brush strokes they come out jagged (not smooth).

Is there a way to make smooth brush strokes? or edit existing ones to make smooth?
I know that Illustrator has "Fidelity" option, but I cannot find something similar in After Effects. I couldn't find anything online to solve this problem.

Draw them as paths instead, using bezier curves.
Then add arrows to the paths using this:
https://kylasaurusrex.gumroad.com/l/LNSVU


text:
Image sequence format for working with Blender and Apple Compressor
Previously, I rendered a 3D animation in JPEG-2000 format, thinking that Preview supports it, so apple pro apps must also support it, but it turns out, compressor can't take J2K image sequence and produce a intermediate ProRes QT video.
My options now is limited to Targa, OpenEXR, PNG, and TIFF. I'd like to select one for use in the future, and I'm evaluating these formats in the following dimensions:

Compression ratio: JPEG-2000 was accidentally used because I thought it'd provide better compression using wavelet transform while being lossless. Advanced algorithm achieving good compression ratio is preferred.

Lossless coding: JPEG-2000 has the option of using a bijective lossless coding method, and I'd like to retain the lossless capability in my workflow before final product. However, some loss may be acceptable, for example, instead of macro-block artifect, change in least-significant bits of color channels are acceptable.

10-bit and 16-bit channel depth: This is desirable for color grading, as well as HDR.

Basing on the above criteria, what formats are suited for what purposes?

OpenEXR should be your friend.

Targa doesn't support hi bit depth, and only supports run-length compression encoding.

TIFF supports run-length and DEFLATE compression encoding, but that's no superior to PNG.

OpenEXR on the other hand, does have wavelet-based lossless compression coding, as well as several others to choose from. It even has 32-bit floating-point color channel support.


text:
How to re-encode leaving only every Nth frame in?
I have several hours of CCTV footage that I'd like to reasonably quickly skim. If there was a way to take every say 60th frame from it and put together a video from those frames that would be perfect.
Is there a ffmpeg command that does that in one go? Or do I have to extract the frames first, and then encode a video from them?

See FFmpeg documentation regarding select filter https://ffmpeg.org/ffmpeg-filters.html#Examples-160, so to keep every 60th frame use -vf "select=not(mod(n\,60))"
And this has been already discussed with another example here Using select in ffmpeg to choose frames

What it does is insert every 60th frame 60 times in the result video so that the overall frame count (and length of the video) stays the same. I need every 60th frame only once so that the video is sped up accordingly.

For that scenario try using -vf "select=not(mod(n,60)),setpts=N/FR/TB" which should rebase timestamps according to the filtered frames only.

The result is still botched. The video shows one still frame for the almost entire length of it and then the whole bunch of the rest of the selected frames at the end. No timing balance between the frames. Would you please try this on your own and update the answer with a 100% working solution so that it can be accepted?

It does work fine according to my test with a source that has each frame burned with a timestamp. Applying the filter does what it is supposed to and seeking frame by frame in the result then shows correct frames and the video behaves just fine when played back normally. One thing that comes to mind based on your description: does your source have an audio track as well? In that case it needs to be omitted by using additional parameter "-an" in the commandline or it would have to be filtered and shortened as well, but the result would be then unlistenable.

It was the audio track messing up indeed. Thank you!


text:
Encoding to the same H.264 size as YouTube
I am unable to re-encode an H.264 video that I downloaded from Youtube back to its original size. The MediaInfo is pasted below. The size of the video stream is 20 MB.
I decoded the video into raw YUV (using ffmpeg and JM separately, ensuring that I get an identical file). Then I re-encoded it using the x264 library with a variety of configs. The encoded H.264 videos that I generated are around 40 MB in size.
This is the commandline that I used:
x264 -o out.h264 --input-res 1280x720 --preset slow autl.yuv
Any ideas on what options I might be missing that YouTube would have used to encode the video?
Mediainfo:
General
Complete name                            : autl.h264
Format                                   : AVC
Format/Info                              : Advanced Video Codec
File size                                : 19.9 MiB
Writing library                          : x264 core 155 r2901 7d0ff22

Video
Format                                   : AVC
Format/Info                              : Advanced Video Codec
Format profile                           : Main@L3.1
Format settings                          : CABAC / 3 Ref Frames
Format settings, CABAC                   : Yes
Format settings, Reference frames        : 3 frames
Width                                    : 1 280 pixels
Height                                   : 720 pixels
Display aspect ratio                     : 16:9
Frame rate mode                          : Variable
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Scan type                                : Progressive
Writing library                          : x264 core 155 r2901 7d0ff22
Color range                              : Limited
Color primaries                          : BT.709
Transfer characteristics                 : BT.709
Matrix coefficients                      : BT.709

I was able to produce the same size as Youtube by varying the qp option for x264. The value that worked to approximately the same size was qp=20.


text:
When a GoPro is recording, how can I see whether it is recording a regular video or a timelapse?
I use a GoPro 10. When it is recording, how can I see whether it is recording a regular video or a timelapse?

Reddit user All-Sorts-of-Stuff mentioned that one can look at the red timer to see whether it is recording a regular video or a timelapse:

While the camera is recording, there will be a red timer showing the footage duration on the rear screen. If that timer is ticking upwards slowly - eg., it takes a full minute for each "second" of the timer to increase - then the camera is recording a timelapse. If that timer is ticking upwards in real time, it's recording a video

Other solutions are welcome.


text:
ffmpeg seek position options not working with h264
I can use ss and sseof parameters with mp4 files and stream the result, but I get errors when I use same commands on h264 file (checked that it also works without seek parameters)
here are the commands I have:
1
ffmpeg -re -i xx.h264 -c copy -f rtsp rtsp://localhost:8554/mystream

working fine,
2
ffmpeg -sseof -10 -re -i xx.h264 -c copy -f rtsp rtsp://localhost:8554/mystream

ignoring sseof parameter
error message:

Cannot use -sseof, duration of xx.h264 not known

3
xx.h264: could not seek to position -10.000

not working at all
error message:

xx.h264: could not seek to position -10.000

How can I fix this issue?

.h264 is a raw format. It has no timestamps or metadata storing the input duration. Therefore you need to convert it to mp4 or another suitable format.
You can mux to MP4 and use that.
ffmpeg -i xx.h264 -c copy xx.mp4

ffmpeg -sseof -10 -re -i xx.mp4 -c copy -f rtsp rtsp://localhost:8554/mystream

Why is it not working with h264?

.h264 is a raw format. It has no timestamps or metadata storing the input duration.


text:
FFmpeg v4l2 recording - variable frame rate output
I have a video device and an audio device I'm trying to record from, as below:
$ v4l2-ctl -d /dev/video0 --list-formats-ext
ioctl: VIDIOC_ENUM_FMT
    Type: Video Capture

    [0]: 'MJPG' (Motion-JPEG, compressed)
        Size: Discrete 1280x720
            Interval: Discrete 0.033s (30.000 fps)
        Size: Discrete 960x540
            Interval: Discrete 0.033s (30.000 fps)
        Size: Discrete 848x480
            Interval: Discrete 0.033s (30.000 fps)
        Size: Discrete 640x480
            Interval: Discrete 0.033s (30.000 fps)
        Size: Discrete 640x360
            Interval: Discrete 0.033s (30.000 fps)
    [1]: 'YUYV' (YUYV 4:2:2)
        Size: Discrete 640x480
            Interval: Discrete 0.033s (30.000 fps)
        Size: Discrete 640x360
            Interval: Discrete 0.033s (30.000 fps)
        Size: Discrete 424x240
            Interval: Discrete 0.033s (30.000 fps)
        Size: Discrete 320x240
            Interval: Discrete 0.033s (30.000 fps)
        Size: Discrete 320x180
            Interval: Discrete 0.033s (30.000 fps)
        Size: Discrete 160x120
            Interval: Discrete 0.033s (30.000 fps)

and
$ arecord -l
**** List of CAPTURE Hardware Devices ****
card 0: PCH [HDA Intel PCH], device 0: ALC289 Analog [ALC289 Analog]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

I'm using ffmpeg, with the mjpeg input stream for the video, and hardware acceleration to encode it as h.265, along with flac encoding for the audio:
#!/usr/bin/env bash

input_framerate=30
input_resolution=hd720

v4l2_thread_queue_size=32
alsa_thread_queue_size=8192

ffmpeg -init_hw_device vaapi=my_intel_gpu:/dev/dri/renderD128 \
       -f v4l2 -c:v mjpeg -input_format mjpeg -video_size "${input_resolution}" -r "${input_framerate}" -thread_queue_size "${v4l2_thread_queue_size}" -hwaccel vaapi -hwaccel_device my_intel_gpu -hwaccel_output_format yuv420p -i /dev/video0  \
       -f alsa -thread_queue_size "${alsa_thread_queue_size}" -i hw:0 \
       -vf 'format=nv12,hwupload' -c:v hevc_vaapi -rc_mode ICQ -qp 24 \
       -af 'aresample=async=1000' -c:a flac -compression_level:a 3 \
       "file:output.mkv"

This works well in a well-lit environment, but if I don't have sufficient light, the framerate drops on the camera, but not in the resulting video: the output still plays at the input framerate, speeding up and giving a 'Benny Hill'-style effect.
How do I ask ffmpeg to output a 'constant-speed'/'variable frame rate' recording? I've tried doing video on its own, excluding audio, as well as using unaccelerated hevc, but these suffer from the same issue.
Thanks in advance.

I've since resolved this; the key was replacing the -r "${input_framerate}" in the second line of the ffmpeg invocation with -framerate "${input_framerate}".
The differences between these options is nicely described within this answer.


text:
A video tool or ffmpeg filter to fix slightly shaky films from the 70s and 80s?
Lots of high-grossing older films including some that were released in the 90s have an almost imperceptible shake that is maybe due to the conversion from film to digital. You can only see it in static scenes and it's easier to notice in objects close to the edge of the screen.
For those of us preoccupied with this kind of artefact, is there a tool or a (ffmpeg, vlc, mpv, mpc-hg, ...) filter that can remove this shakiness ? It seems like a very simplified version of the stabilization done by action cameras, since it looks like roughly all frames are always offset by some small amount (2 to 10 pixels or so).

This is most often caused by interlace artifacts as televisions and video devices prior to 1998 used interlace to pass video between them. This included VCR's DVD players TV's (even HDTV's at the time) and capture cards used to digitize content. As the displays were also interlaced at the time the images looked good. Today all displays are progressive so content from that era has to be de-interlaced either at the same frame rate or double if content is film source or very fast motion.
Use this:
ffmpeg -i infile.mp4 -vf bwdif=0:-1:0 -c:a aac -c:v ibx264 outfile.mp4

Or use this for fast action or sports action:
ffmpeg -i infile.mp4 -vf bwdif=1:-1:0 -c:a aac -c:v ibx264 outfile.mp4


text:
ffmpeg-converted video file won't play in Windows Media Player or Movies & TV
I am using ffmpeg-python to convert an hevc mkv file to an h264 mp4. This is the relevant code:
ffmpeg.input(video_file).output(out_name, vcodec='libx264', **{'pix_fmt': 'yuv420p'}).run()

Yet after converting the file, the resulting mp4 will only play in certain media players. Here is the result of running ffprobe on the mp4:

I know this should be possible, so does anyone have an idea of why it isn't playing in older/more standard media players?

Possibly, the 6 channels in the audio. Add the CLI option -ac 2 and check.

@Gyan Wow, this worked! I never would have even thought to try this! If you want to give this as an answer then I'll accept it. Thank you so much!

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

To be clear, the "Movies & TV" app, which was added in Windows 10, also was not able to play the video with 6 audio channels. Either way, thanks a lot for the help :)


text:
Fade transition - fade vs. fadefast vs. fadeslow
In the xfade filter, the speed of transition may be controlled by the duration= parameter – longer duration implies slower transition and vice versa.
So why are there – beside the fade value for the transition= parameter – other 2 values for the same effect, fadefast and fadeslow? What is the difference?

They differ in rate of progression, i.e. fade is a linear progression, so that at half the duration, fade status is 50% i.e. both inputs are equally mixed. For fadefast, it starts fast and then slows down. Opposite for fadeslow.


text:
Can I make a small part of my video frame black and white?
I am editing some video in Kdenlive and I want to make a subsection of my video black & white.
I know that I can make the whole clip black and white by adding a "saturation" effects. But could I (for example) choose a square within the clip and make only that part black and white?