text:
FFmpeg: maximum VHS quality?
I'm digitizing a number of VHS tapes into lossless video files using FFmpeg. How can I optimize my FFmpeg command further in order to come closer to the requested specs below, with the best possible quality?
Target (ideal) lossless specs

File format: MKV/AVI/MOV/MXF
Video Codecs: FFV1/JPG2000 lossless/HuffYUV/Dirac/H.264 lossless
Chroma: 4:2:2
Pixel size: Rec. 601
Aspect ratio: 4:3
Resolution: 720x576
PAL
25 fps
Audio: 48Khz/24-bit PCM 48Khz/16

FFmpeg command
(OS is Ubuntu Studio, CPU has 8 cores)
sudo \
nice --20 \
ffmpeg \
-hide_banner \
-v verbose \
-report \
-err_detect +crccheck+bitstream+buffer+compliant+aggressive \
-fflags +igndts \
-f video4linux2 -thread_queue_size 1024 -i "/dev/video4" \
-f alsa -thread_queue_size 1024 -channel_layout stereo -ac 2 -i "hw:1" \
-vcodec ffv1 -level 3 -threads 8 -coder 1 -context 1 -g 1 -slices 30 -slicecrc 1 \
-acodec copy \
-aspect 4:3 \
-colorspace bt470bg \
-t 00:00:00 \
"NAME_HERE.mkv"

Additional info
Capture device is USB-Live2 from Hauppauge,
using semi-official drivers for Linux compability.
FFmpeg Input streams from capture device:
Input #0, video4linux2,v4l2, from '/dev/video4':
  Duration: N/A, start: 3909.466392, bitrate: 165888 kb/s
  Stream #0:0: Video: rawvideo, 1 reference frame (YUY2 / 0x32595559), yuyv422, 720x576, 165888 kb/s, 25 fps, 25 tbr, 1000k tbn
Guessed Channel Layout for Input Stream #1.0 : stereo
Input #1, alsa, from 'hw:1':
  Duration: N/A, start: 1673622488.857382, bitrate: 1536 kb/s
  Stream #1:0: Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (rawvideo (native) -> ffv1 (native))
  Stream #1:0 -> #0:1 (copy)

FFprobe streams for sample output video file:
 ffprobe -hide_banner sample.mkv
Input #0, matroska,webm, from 'sample.mkv':
  Metadata:
    ENCODER         : Lavf59.27.100
  Duration: 00:00:10.02, start: 0.000000, bitrate: 59168 kb/s
  Stream #0:0: Video: ffv1 (FFV1 / 0x31564646), yuv422p(tv, bt470bg/unknown/unknown, progressive), 720x576, SAR 16:15 DAR 4:3, 25 fps, 25 tbr, 1k tbn
    Metadata:
      ENCODER         : Lavc59.37.100 ffv1
      DURATION        : 00:00:10.000000000
  Stream #0:1: Audio: pcm_s16le, 48000 Hz, 2 channels, s16, 1536 kb/s
    Metadata:
      DURATION        : 00:00:10.016000000

Current command rationalizations
sudo nice --20 ensures that the ffmpeg process is maximally prioritized by the CPU. (Afterwards, I use chown to change ownership of the video file from root.)
err_detect is there to catch any and all errors. Should something come up I restart the digitisation session. Dunno if any of the flags are entirely redundant with one another and/or performance-impacting.
As I understand it, because ffv1 is an "intra-frame" codec and not an inter-frame one, DTS errors should be safe to ignore trough fflags +igndts. (It's fairly common that they pop up during a session and it seems unnecessary to restart because of them.)
Without the excessive thread_queue_size 1024, ffmpeg has a tendency to warn about "Thread message queue blocking"
ffv1 seems to be the most powerful lossless video codec available, and the parameters seems to be the most powerful possible: https://trac.ffmpeg.org/wiki/Encode/FFV1
Input audio is close enough to the target specs (and AFAIK can't be improved anyway) so they're just copied as-is.

we're recently experimenting with FFMPEG (analog) capture too, so we opened this "issue" @ github:
https://github.com/cdgriffith/FastFlix/issues/418
Feel free to join the discussion in order to achieve the best rerults for anyone.
Thanks in advance.

This does not provide an answer to the question. Once you have sufficient reputation you will be able to comment on any post; instead, provide answers that don't require clarification from the asker. - From Review


text:
Is there a video player that allows to reproduce one audio track through left channel and the other through right one?
I hope this is the right place...
I normally use MPC-BE and MPC-HC (which has quite audio processing options including a custom channel mapping, although it doesn't seem to go that far with tracks), but I've also tried many others and never found such level of control over audio tracks and channels. What I'd want is e. g. reproduce a dual video file and can choose send English language audio track to the left channel and the Spanish one to the right, so I can hear both at the same time and in perfect sync.
I don't think so, sincerely... but if one don't ask

source: Stack Exchange

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

sort: votes


text:
Converting MTS to MP4 gives strange artefacts
I am converting video taken with various personal cameras in .MTS format to mp4 in order to reduce the file size. I am getting some strange artefacts and I wonder what simple mistake I am making?
ffmpeg finds this content in the infile:
Program 1
Stream #0:0[0x1011]: Video: h264 (High) (HDMV / 0x564D4448), yuv420p(top first), 1920x1080 [SAR 1:1 DAR 16:9], 25 fps, 50 tbr, 90k tbn, 50 tbc
Stream #0:1[0x1100]: Audio: ac3 (AC-3 / 0x332D4341), 48000 Hz, stereo, fltp, 256 kb/s
Stream #0:2[0x1200]: Subtitle: hdmv_pgs_subtitle ([144][0][0][0] / 0x0090), 1920x1080
I used:
ffmpeg -i infile.MTS -c:a copy -c:v libx264 -r 25 -b 8M outfile.mp4

I set the frame rate in order to keep the original frame rate, otherwise I get 50 fps, but even at 50 fps the artefacts are there.
See attached screen grab (a small crop) for the artefacts, followed by the original.

The source is interlaced. Deinterlace it by adding -vf yadif

That was it! Thanks @Gyan!

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


text:
Why, in FFmpeg with libx265 the timestamp tbn parameter is always 1k even when it seems not logical?
I encode with ffmpeg and noticed that when I encode a y4m video in 29,97 FPS into a h265 video with libx265, the parameter of the two videos are the following :
original y4m :
29.97 fps, tbc : 29.97 tbr 29.97 tbn : 29.97
H265 converted file :
29.97 fps, tbc : 29.97 tbr 29.97 tbn : 1k
I noticed the problem when I tried to compare the two videos with metrics like VMAF or SSIM, it says that the timestamp are 30000/1001 in one case and an other thing in the other case and the metric result is clearly false.
As far as I understand, tbn mean the internal time interval used by the codec to place the images and it should be a number that can help to get the FPS easily, but I don't see how 1k will help in any way to place images at precise 29.97FPS (30000/1001). Or I miss something ? On the net it seems that classical number is more or less things like 90k, which seem more logical ...
My main question :
This is, here a simple conversion with default parameter, why this default parameter is used in this case ?
Subsidiary questions :

I guess it is possible to force the tbn to another factor during conversion, but is it costless or have this an impact on the quality or size of the compressed video ?

Why in the y4m, the tbn is simply the FPS (29,97) what does it means ?

Thanks you ;)

Share your full command.

I have found an answer on this in SuperUser :
https://superuser.com/questions/1764716/why-in-ffmpeg-with-libx265-the-timestamp-tbn-parameter-is-always-1k-even-when-i/1764722?noredirect=1#comment2747058_1764722


text:
How to achieve this liney camcorder effect on Premiere Pro or After Effects?
I've been looking for a way to achieve
this effect but it doesn't seem to work accurately well.

This is an artefact from de-interlacing.
You can simulate it using things like the Bad TV or Holomatrix plugins.
You can get some way towards it using the free Venetian Blinds plugin in After Effects (or by interlacing and de-interlacing some footage).


text:
How can I pause selected objects in a motion scene?

Hey guys, the question I'm asking can easily be understood by just watching the video via the above link, if anyone knows what this effect is called, I'll much appreciate it, bless up!

It's like a freeze frame effect.  I reckon they've just asked all the actors to hold still, and for the few shots that can't work in real life (the baseball, the spilling coffee etc) they've tracked the camera movement and added in a 3D version of the objects (eg this coffee demo in Blender).  You can see the actors moving in some of the scenes, eg his eyes move at 2m11, back of the had at 0m36, etc..

None of the people in that video moved a inch except for the two, watch closely, nothing else moved except for them... Thanks for your help anyway, I appreciate it

I think maybe the director merged two different clips, froze one and kept the other in motion? The question is how'd that happen...

https://youtu.be/9-h7ltwACLs here's another video with the same concept, kindly view it

These aren’t massive productions - I reckon they’re just holding still. To do what you’re suggesting you’d need to use motion control across both scenes. Easier to just tell actors to freeze and use fast edits.

I hear you, thanks for the ideas

Yep - this video has very little trickery at all. I'm not convinced the baseball is 3D tracked either - I think it's old school.


text:
Kdenlive Effect Section is White
Kdenlive is displaying a white window in the effect section instead of the expected list of effects, as seen in the accompanying image. I encountered this issue on both Fedora 36 and Fedora 37, using Kdenlive version 22.12.2.
I would greatly appreciate any help or suggestions in resolving this issue. If there is any additional information I can provide to help diagnose the problem, please let me know.

don't know if still actual, ran into the exact same problem and solved it with
apt-get install -y qml-module-org-kde-kcm


text:
ffmpeg - inacurate overlay position
I am trying to add two overlays using ffmpeg as below:
[v0][1:v] overlay=21:24:enable='between(t,0.000, 1.135)' [v1];
[v1][2:v] overlay=120:24:enable='between(t,0.000, 1.135)' "

These two images [1:v] and [2:v] are below pngs:

The first png is 99px wide and I want to place it on x=21
The second png I want to place right behind the first one x=21+99=120
But I am getting the output as below: It seems that there is 1px gap between them and I have no idea where is it coming from.

How can I ensure it is pixel perfect and there is no gap?
Also I noticed that if the image is 98px and I use:
[v0][1:v] overlay=21:24:enable='between(t,0.000, 1.135)' [v1];
[v1][2:v] overlay=119:24:enable='between(t,0.000, 1.135)' "

then suprisingly it is fine, same for 100px wide and next images x=121
The whole command to give more context (remove newlines to execute):
.\bin\ffmpeg.exe -ss 0 -to 5.681
-i C:\Users\Radoslaw\Videos\ttt.mp4
-i .\tempAssets\player1.png
-i .\tempAssets\serving.png
-filter_complex
[0:v] select='between(t,1.247,2.550)+between(t,4.181,5.681)', setpts='PTS-STARTPTS-((gt(T,2.550)*1.630))/TB' [v0];
[0:a] aselect='between(t,1.247,2.550)+between(t,4.181,5.681)', asetpts='PTS-STARTPTS-((gt(T,2.550)*1.630))/TB';
[v0][1:v] overlay=21:21:enable='between(t,0.000, 2.803)' [v1];
[v1][2:v] overlay=120:21:enable='between(t,0.000, 2.803)'
Untitled.mp4

@Gyan your answer helped for the mentioned simple scenario but if I change the order:
[v0][2:v] overlay=120:24:enable='between(t,0.000, 1.135)':format=auto,format=yuv444p [v1];
[v1][1:v] overlay=21:24:enable='between(t,0.000, 1.135)' "

then I get the 1px gap again. Any suggestions?

Looks to be related to chroma subsampling of the base video. Share full command.

updated the question with the full command

Change base video to full chroma sampling and try.
[0:v] select='between(t,1.247,2.550)+between(t,4.181,5.681)', setpts='PTS-STARTPTS-((gt(T,2.550)*1.630))/TB',format=yuv444p[v0];
and
[v0][1:v] overlay=21:21:enable='between(t,0.000, 2.803)':format=auto,format=yuv444p [v1];
[v1][2:v] overlay=120:21:enable='between(t,0.000, 2.803)'

Yes, that helped. Thanks a lot!
Also after experimenting - turns out that it is enough to add :format=auto without specyfing the chroma sampling.
Do you think it is enough to add :format=auto to each png overlay or should I add that chroma too?

You shouldn't add auto format to the last overlay. The format after the first overlay may be removed.

hmm but if i change the order so [2:v] goes first and then [1:v] and put :format=auto,format=yuv444p on the first one (2:v) then the problem remains as before


text:
Equipment for making closeup object videos
Equipment for making closeup object videos. I want to do a video like this:

Would my Galaxy s22 Ultra take such a close-up video?
Also what Bluetooth microphone would you recommend?

I would very much doubt you'll do this with a phone.
Macro photography is not easy; macro videography is harder still; videography with a zoom lens is not only hard, but expensive.
Let's run through what you need…

A tripod. You cannot shoot macro hand-held unless you have an extremely steady hand. No-one has a steady-enough hand to shoot macro video. It might be possible with a good gimbal - not something I've ever tried.

A lot of light. It just comes with the territory, you're asking for the amount of light from a tiny object to be sufficient to get a decent exposure - you're going to have to add light to do this. More light still if you're shooting high frame-rate for slo-mo. [The picture of the bud further down took two kino-type flat panels for the subject & 2 strobes for the background - that's all the more reason your example video didn't attempt to light a background too.]

A macro lens or a very long telephoto. True macro lenses can not only focus from very close, but they also have a high magnification factor; they can bring the object 1:1 on a full frame camera.
A long telephoto can do without the extreme closeup capability, but needs sufficient magnification to compensate. It's a trade-off.

Here's a very quick [& a bit blurry because I shot it hand held so focus drifted a little] picture of a lightning connector, done on a cheap macro-capable 300mm lens on a crop-frame stills camera [still a far larger sensor than a phone].

Click for larger size
As you can see, we're not close enough yet, even on a 300mm lens. This was minimum focus distance. Also note, if you view it larger, how noisy the image is - this is because I only had some weak sunlight diffused through voile curtains, so I had to ramp up the camera's ISO quite a long way to get exposure time down far enough to not have camera-shake. I also shot at f/11 which is this particular lens's optimum between depth of field & diffraction blur.
To get closer, on an interchangeable lens camera you either buy a 'proper' macro lens, or you put extensions between the body & lens. This shortens the close-focus point [& simultaneously prevents it from focussing to infinity.]
That can get you close enough.
Here's one I did earlier…

Now we're close enough. This entire bud is 2mm long. But this is not a single exposure, this is focus-stacked… something you cannot do on video.
I did a brief explanation of using extension tubes for macro here - https://photo.stackexchange.com/a/128915/57929

The toughest one of all - the zoom at the head of the video's macro shots. This is partly faked in post, so I can't tell how much was really done with a zoom lens… but regular stills lenses change focus if you change zoom. This is a cost-cutting exercise, but stills cameras don't really need to be able to keep focus whilst zooming; it's an expensive luxury. You can get a good stills zoom for $£€ 1,500 - 3,000 depending on length.
A good video zoom, however, with parfocal capability [focus does not change as you zoom] can be anywhere from maybe $£€20,000 - 50,000. Few people buy this stuff, they rent it.

By the time you'd bought that, you'll realise how cheap your lighting was, by comparison;)
The lighting for the bud was under $£€ 1,000.
Having said all that - you can get macro & telephoto adapters [diopters] for phones. They are by comparison dirt cheap - couple of hundred bucks.
You could always give it a go & let us know how you get on…

Diopters are a more affordable alternative to a macro lens.

@MichaelLiebman - that's pretty much your only option on a phone; something that modifies the existing lens. tbh it didn't occur to me to mention them by name, I've added to the answer. I can't say I'm a fan of them on a decent lens; aberration, reflections...

You can't get that close, and it would be tricky to do it for video, but if your phone doesn't have a macro lens, a drop of water on the lens can serve as a makeshift macro lens:

(I wouldn't do this unless your phone is waterproof, and you'll need lots of light).


text:
Setting dpi flag in image files generated using ffmpeg
We're using ffmpeg to batch out some TIFF images that are being resized and having white borders created to fit specific paper sizes.
The resulting images default to 72dpi, even when the source is 300dpi. Is there a way to set the dpi flag in the output file?
Many thanks :-)
Edit:
I have managed to answer my own question:
for %%a in ("*.tif") do ffmpeg -i "%%a" -vf "scale=6974:4919:force_original_aspect_ratio=decrease,pad=7016:4961:(ow-iw)/2:(oh-ih)/2:color=white,format=rgb24" -dpi 300 "%%~na A2 poster 594x420mm-Border.tif"

You might want to add imagemagick to the pipeline to set the dpi, I don't think there's anything in ffmpeg that deals with DPI at all.

Many thanks stib - I'd been looking at ImageMagick. It seems like that is the way to go!


text:
Which software/s to create a video like this - 3d explainer video
I'm trying to create a 3d animated video link this
https://www.veed.io/view/b19fbccb-2f97-405e-bb64-3d8ffc5e9401?sharingWidget=true&panel=share
I've researched and found the following:
Blender: Can be used for 3d modelling but it's more geared towards artists to create 3d artwork.
Solidworks: Parametric design software used for manufacturing.
I did like what I saw in solidworks but found out it's to model products and used mostly for manufacturing.
I understand there could be multiple softwares (like After Effects, Premier Pro) involved in making a video like this but I'm starting now and want to make a videos like these 6 months to 1 year for now. I don't want to learn a tool only to realise I need to learn something else.

This could definitely be made using Blender. The text and lines could have been added using After Effects afterwards (Blender can do this too), but the 3D modelling would all be rendered in a 3D tool like Blender.
It's free, you should give it a go.  Start by building a donut - it's a great set of free tutorials.

I think also that Blender is the best for making similar explainer videos. This will be the best universal DIY solution in view of the ease of learning and the budget. You can, of course, try, for example, Autodesk Maya or Unity. These are also reletively not very complex tools enabling you create similar 3D models. The question may be the price and time to get used to them.
Depending on how much detailed modeling is required and what skills you have, a similar task can be implemented with one of the Best 3D Modeling Software list.  You need to try and experiment. This will take time. Although, there are options, when refining the task.
If I understood the question correctly, the task for the next 6-12 months is to create several videos explaining the assembly of certain objects, without specifying their technical characteristics, but giving a visual representation of the process and sequence. At the same time, the budget is limited and by the end of the project there are no plans to create any more videos in the future. Right?
Under such task conditions, I think it worth to get understanding of the animation pipeline in order to choose the optimal solution for such tasks. After all, 3D modeling is still a skill that needs to be mastered. What is not included in your plans for the future, as I understand it, right?
Then, with a limited budget, you can simplify the decision, how to choose a different type of animation with ready-made templates and any other explainer video software. Or save time by ordering ready reels from those who understand the processes of creating such videos.
Well, if, nevertheless, you want to DIY, then I would recommend proceeding from what you already know and can do. If you are already familiar with the blender, then try to do the maximum with it and look at the materials recommended above by Tomh


text:
Why has transport stream (TS) a much bigger file size than mkv?
When I remux the transport stream (.ts file) of a satellite recording to mkv, file size shrinks considerably.
Why is that ?
What is inside the .ts container that gets "lost" during remuxing ?
For testing purposes, I recorded a few seconds of a TV satellite broadcast, resulting in a 4 MB .ts file. I then remuxed this file to .mkv, keeping all streams (1 video stream + 2 audio streams) and got a 3 MB .mkv file.
What accounts for the -25% difference in file size ?
I can attach the files if needed.
No reencoding takes place.

Is the video stream re-encoded during remux ?

@ audionuma: no. I updated the question. Thank you.

The short answer: container overhead.
MKV (and to a lesser extent, MP4/ISOBMFF) are very "flexible" containers, and basically adapt to whatever you're trying to shove into them, provided the muxer knows how to handle it and the demuxer at the other end is expecting it.
MPEG-TS is a rigid dinosaur meant to behave exactly the same way, every single time; on discrete hardware, in software, over the air, in cables under the ground, over cellular networks, etc. It can be more resilient as a result, but that comes at a cost - usually padding bytes and wasted packets.

While it's from an "Internet video infrastructure" company's blog, this article from a Mux engineer gave the nicest explanation I could find for you. Mux - Quantifying packaging overhead

TS has some strange properties. It was built for a pre-ethernet world and includes features such as lost and out of order packet detection and remote time synchronization. These features are required for digital over-the-air broadcasts...TS also uses a fixed packet size of 188 bytes with each packet starting with a sync byte to identify the start of a packet...The downside of not using these features is that they still take up space in the file.
Each 188 byte TS packet has a 4 byte header. This header contains the sync byte, some flag bits, a packet id (or PID, which identifies a unique audio or video stream), and a continuity counter (used to identify missing or out of order packets). Every frame then has a prepended Packetised Elementary Stream (PES) header. The PES header is a minimum of 14 bytes, (or 19 bytes if the frame decode time does not match the presentation time, i.e. B frames) and encodes the frame timestamps among other things. Therefore, the first packet has at most 170 bytes available while subsequent packets have 184 bytes available. If a frame is less than 170 bytes, it must be padded to consume the full packet. If a frame is 171 bytes, a second packet is required and thus 376 bytes (188x2) is needed to transmit the 171 bytes of payload, more than doubling the required bandwidth. In reality, frames under 170 bytes are not very common. However at bitrates under 1Mbps, a 10% or more overhead is not uncommon.

Mux

You'd likely see a similar size reduction remuxing to .mp4. Since this is a satellite TS, there could be more than one video, audio, or subtitle track, but I'll assume you preserved them all when remuxing. There might also be other satellite specific "program data" that is discarded when you remux to MKV. e.g. MPEG-TS packet IDs 16–31/0x0010-0x001F are used for DVB metadata. MKV muxers toss that out if they don't know what to do with it, but it's likely of little use to you, especially if it is repeated with every single packet.

Some transmission schemes, such as those in ATSC and DVB, impose strict constant bitrate requirements on the transport stream. In order to ensure that the stream maintains a constant bitrate, a multiplexer may need to insert some additional packets. The PID 0x1FFF is reserved for this purpose. The payload of null packets is all zeroes, and the receiver is expected to ignore its contents. 15

They could also be null/padding packets - like I mentioned above for ATSC/DVB, or you might sometimes see with a .ts/series of .ts files used for MPEG-DASH or HLS internet streaming at a strict constant bitrate. TS overhead for internet use usually comes down to how many "extra" nearly empty frames are required depending on your bitrate, not strict CBR padding.
https://en.wikipedia.org/wiki/MPEG_transport_stream#Null_packets
Use MediaInfo to look at your source .ts and you might be able to get a better idea if there's any extra program data or not.

"a 10% or more overhead is not uncommon." In my tests a typical DVB-S recording of, say, 4GB remuxes to a 3GB .mkv file with mkvmerge (keeping all streams). I understand why there is overhead. I could even imagine 10%. But 25% ?? That doesn't seem explainable to me by overhead alone. What I would be interested in is a source explaining this big overhead. I'm not sure your answer (which I otherwise like) really provides that ?

for legacy DVB-S, CBR (constant bitrate) is a requirement. If the actual bitrate drops below that value, the muxer at their end literally adds zeros to fill space up lol. How many individual streams are contained within the TS container? That might have something to do with it.


text:
How would I wiggle only on the y-axis when using wiggle with the slider expression control?
How would I use the wiggle expression only on the y-axis?
I'm using two sliders. The first for the frequency and the second for the amplitude.
Here's my expression so far. This works but wiggles on both the x and y axis. I just want the y only. How would I ammend the expression below?
wiggle(effect("Slider Control")("Slider"),effect("Slider Control 2")("Slider"))

update:
the following seems to work:
[position[0],wiggle(effect("Slider Control")("Slider"),effect("Slider Control 2")("Slider"))[1]]

any advice is still appreciated
thanks.

amp = effect("amplitude")("Slider");
freq = effect("frequency")("Slider");
wiggle(freq, amp, octaves = 1, amp_mult = .5, t = time)

Add sliders to the layer you want to wiggle. Call them "amp" and "freq".
Right click on the position control on the layer you want to wiggle.
Select "separate dimensions".  The x and y controls will now be seperate.
Apply the expression above to whichever dimension you want to control.


text:
How to dynamically set the color of a box using rgba in 'drawbox' in ffmpeg?
I tried to run the following code, but it didn't work.
ffmpeg -i input.mp4 -filter_complex [0:v]drawbox=x=100:y=100:w=100:h=100:color='r=66-ceil(48*Y/H):g=74-ceil(59*Y/H):b=199-ceil(72*Y/H)':t=fill -c:a copy output.mp4

Please teach me how to overlay a rectangular shape with a vertical gradient onto a video, with a constant duration.
I mean that I want to place an image similar to the one shown below over a video.

geq, overlay
ffmpeg -i input.mp4 -lavfi "
color=black:size=100x100,geq=r=0:g=0:b='lerp(255,127,Y/H)'[o];
[0:v][o]overlay=100:100:shortest=1
" -y out.mp4

drawtext, geq, overlay
ffmpeg -i "in 1.mp4" -lavfi "
color=black@0:size=1280x720,
drawtext=text='Some text'
:box=1
:boxborderw=30
:boxcolor=blue
:borderw=5
:bordercolor=red
:fontsize=h/4
:fontcolor=white
:x=(w-text_w)/2
:y=(h-text_h)/2,
format=rgba,geq=
r='if(eq(r(X,Y),0)*eq(g(X,Y),0)*eq(b(X,Y),255),0,r(X,Y))'
:g='if(eq(r(X,Y),0)*eq(g(X,Y),0)*eq(b(X,Y),255),0,g(X,Y))'
:b='if(eq(r(X,Y),0)*eq(g(X,Y),0)*eq(b(X,Y),255),lerp(63,255,Y/H),b(X,Y))'
:a='if(eq(r(X,Y),0)*eq(g(X,Y),0)*eq(b(X,Y),0),0,255)'[t];
[0][t]overlay=(W-w)/2:(H-h)/2
" -c:a copy out.mp4 -y

Thank you! It works!

Actually, I want to use the box above as a background for the text. Is it possible to resize the box to fit the width of the text?

added drawtext. not tested as well

Thank you very much! You have just made it possible for me to achieve exactly what I wanted to do.

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


text:
Making an After Effects layer follow another one at constant speed
I have the following expression on the position of a layer that makes it follow another layer(FollowNull). Basically, I set an initial position with a PointController and the expression does it's magic.
s = effect("Speed")("Slider");
p1 = effect("InitialPosition")("Point");
p2 = thisComp.layer("FollowNull").transform.position;
d = (length(p1,p2))/s;
t = (time - inPoint)%d;

linear(t, 0, d, p1, p2);

The problem is when I actually start moving (keyframing) the FollowNull layer, the speed changes. I'm assuming it is because the distance between both layers is only calculated once, so the travel time stays the same, even if one layer is going away from the other.
Any idea how I can fix this behaviour?
Thanks!

https://www.youtube.com/watch?v=n4j0vqUCBDM

From this tutorial, if you parent one layer's position to another's position, you can use an expression like this to follow the first layer:
thisComp.layer("red star").transform.position.valueAtTime(time-0.5)

That would work great if I wanted them to follow the exact same path, but that's not quite what I'm looking for. The following layer should be moving towards the layer being followed independent of that actual layer's movement.


text:
Less color and detail visible when videos are played in VLC (Linux, NVIDIA)
When I watch videos from my GoPro, the colors look much better in Dragonplayer (stock player with KDE).  This is the case for both x264 videos:

With HEVC there is also a difference, although I think it is less clear which one I prefer (Dragonplayer seems to have brighter colors though):

I am on Linux, but I see similar issues mentioned on Windows (related to NVIDIA cards), such as in this video:

Unfortunately the NVIDA control panel in Linux does not seem to have this "Adjust video color settings" section that the Windows one has.
I tried changing the hardware decoder in Preferences > Input/Codecs, but nothing changed whether I have it set to automatic, VA-API, VA-API w DRM, VDPAU, and disabled.
VLC was built with the following USE flags:
+X +a52 +alsa +aom +archive +aribsub -bidi -bluray -cddb -chromaprint -chromecast +cpu_flags_x86_mmx +cpu_flags_x86_sse +dav1d +dbus -dc1394 -debug +dts +dvbpsi +dvd +encode -faad +fdk +ffmpeg +flac -fluidsynth +fontconfig +gcrypt +gme -gnome-keyring +gstreamer +gui -ieee1394 +jack +jpeg +kate +libass -libcaca +libnotify +libsamplerate +libtar +libtiger -linsys -lirc +live +lua +lua_single_target_lua5-1 -macosx-notifications +mad +matroska -modplug +mp3 +mpeg +mtp +musepack +ncurses +nfs +ogg -omxil -optimisememory +opus +png +projectm +pulseaudio -rdp -run-as-root +samba -sdl-image -sftp -shout -sid +skins -soxr +speex +srt +ssl +svg +taglib -test -theora -tremor +truetype +twolame +udev -upnp +v4l +vaapi +vdpau -vnc +vpx +wayland +x264 +x265 +xml -zeroconf -zvbi

Dragon was built with just:
-debug
+handbook

My questions are two:

What else might I try to get VLC color looking like Dragon?

How might I re-encode these videos such that I can be reasonably sure that most people will see them the way I do (in Dragon)?

Edit: I found the dynamic range settings in the Linux version of NVIDIA settings, but they were already set to full, so I guess that wasn't the problem. For anyone trying to find them though, they are here:


text:
FFmpeg with m3u8 playlist: Invalid data found when processing input
I get the following error when I try to open a playlist with FFmpeg:
ffmpeg version 2023-03-05-git-912ac82a3c-essentials_build-www.gyan.dev Copyright (c) 2000-2023 the FFmpeg developers
  built with gcc 12.2.0 (Rev10, Built by MSYS2 project)
  configuration: --enable-gpl --enable-version3 --enable-static --disable-w32threads --disable-autodetect --enable-fontconfig --enable-iconv --enable-gnutls --enable-libxml2 --enable-gmp --enable-bzlib --enable-lzma --enable-zlib --enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth --enable-sdl2 --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-libaom --enable-libopenjpeg --enable-libvpx --enable-mediafoundation --enable-libass --enable-libfreetype --enable-libfribidi --enable-libvidstab --enable-libvmaf --enable-libzimg --enable-amf --enable-cuda-llvm --enable-cuvid --enable-ffnvcodec --enable-nvdec --enable-nvenc --enable-d3d11va --enable-dxva2 --enable-libvpl --enable-libgme --enable-libopenmpt --enable-libopencore-amrwb --enable-libmp3lame --enable-libtheora --enable-libvo-amrwbenc --enable-libgsm --enable-libopencore-amrnb --enable-libopus --enable-libspeex --enable-libvorbis --enable-librubberband
  libavutil      58.  3.100 / 58.  3.100
  libavcodec     60.  6.100 / 60.  6.100
  libavformat    60.  4.100 / 60.  4.100
  libavdevice    60.  2.100 / 60.  2.100
  libavfilter     9.  4.100 /  9.  4.100
  libswscale      7.  2.100 /  7.  2.100
  libswresample   4. 11.100 /  4. 11.100
  libpostproc    57.  2.100 / 57.  2.100
playlist.m3u8: Invalid data found when processing input

Command I use:
ffmpeg [-allowed_extensions ALL] [-protocol_whitelist file,http,https,tcp,tls,crypto] -i playlist.m3u8 -c copy -report playlist.mp4

Playlist file:
#EXTM3U
#EXTINF:-1,0
https://20230515.s3.eu-central-1.amazonaws.com/output0000f.mp4
#EXTINF:-1,1
https://20230515.s3.eu-central-1.amazonaws.com/output0001f.mp4
#EXTINF:-1,2
https://20230515.s3.eu-central-1.amazonaws.com/output0002f.mp4

The playlist plays fine in VLC player
Report:
ffmpeg started on 2023-05-15 at 13:23:08
Report written to "ffmpeg-20230515-132308.log"
Log level: 48
Command line:
"F:\\Applications\\ffmpeg-2023-03-05-git-912ac82a3c-essentials_build\\ffmpeg-2023-03-05-git-912ac82a3c-essentials_build\\bin\\ffmpeg.exe" -allowed_extensions ALL -i playlist.m3u8 -c copy -report playlist.mp4
ffmpeg version 2023-03-05-git-912ac82a3c-essentials_build-www.gyan.dev Copyright (c) 2000-2023 the FFmpeg developers
  built with gcc 12.2.0 (Rev10, Built by MSYS2 project)
  configuration: --enable-gpl --enable-version3 --enable-static --disable-w32threads --disable-autodetect --enable-fontconfig --enable-iconv --enable-gnutls --enable-libxml2 --enable-gmp --enable-bzlib --enable-lzma --enable-zlib --enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth --enable-sdl2 --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-libaom --enable-libopenjpeg --enable-libvpx --enable-mediafoundation --enable-libass --enable-libfreetype --enable-libfribidi --enable-libvidstab --enable-libvmaf --enable-libzimg --enable-amf --enable-cuda-llvm --enable-cuvid --enable-ffnvcodec --enable-nvdec --enable-nvenc --enable-d3d11va --enable-dxva2 --enable-libvpl --enable-libgme --enable-libopenmpt --enable-libopencore-amrwb --enable-libmp3lame --enable-libtheora --enable-libvo-amrwbenc --enable-libgsm --enable-libopencore-amrnb --enable-libopus --enable-libspeex --enable-libvorbis --enable-librubberband
  libavutil      58.  3.100 / 58.  3.100
  libavcodec     60.  6.100 / 60.  6.100
  libavformat    60.  4.100 / 60.  4.100
  libavdevice    60.  2.100 / 60.  2.100
  libavfilter     9.  4.100 /  9.  4.100
  libswscale      7.  2.100 /  7.  2.100
  libswresample   4. 11.100 /  4. 11.100
  libpostproc    57.  2.100 / 57.  2.100
Splitting the commandline.
Reading option '-allowed_extensions' ... matched as AVOption 'allowed_extensions' with argument 'ALL'.
Reading option '-protocol_whitelist' ... matched as AVOption 'protocol_whitelist' with argument 'file,http,https,tcp,tls,crypt'.
Reading option '-i' ... matched as input url with argument 'playlist.m3u8'.
Reading option '-c' ... matched as option 'c' (codec name) with argument 'copy'.
Reading option '-report' ... matched as option 'report' (generate a report) with argument '1'.
Reading option 'playlist.mp4' ... matched as output url.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option report (generate a report) with argument 1.
Successfully parsed a group of options.
Parsing a group of options: input url playlist.m3u8.
Successfully parsed a group of options.
Opening an input file: playlist.m3u8.
[NULL @ 00000256fef51600] Opening 'playlist.m3u8' for reading
[AVIOContext @ 00000256fef59fc0] Statistics: 249 bytes read, 0 seeks
playlist.m3u8: Invalid data found when processing input

FFmpeg requires one of the following 3 tags to immediately follow #EXTM3U at the beginning.
#EXT-X-STREAM-INF
#EXT-X-TARGETDURATION
#EXT-X-MEDIA-SEQUENCE

You can work around the probe failure by adding -f hls before -i.
Also, #EXTINF values should be non-negative, which is not the case here.


text:
How to get the number of options in a drop-down list (After Effects script)?
I'm trying to create a script that randomly selects an option from a drop-down list.
For that I use a randomly generated number as the index of the set value. The issue is that if it tries to select an item that doesn't exist (like, if the randomly generated number is 6 and the list only has 5 options), the script stops and doesn't run the rest of the code.
So it needs to generate a random integer in the range from 1 to the exact number of options. For now I have hard coded the range in the script, so it works ok in this specific case, but I would like it to work for whatever number of options the drop-down may have, so it continues working if the number of options is changed.
So I would need to get the number of options in the drop-down to set as the maximum value of the range to generate a random number from.
But I can't find anywhere a way to get the "size" or "length" of the drop-down options. How do I do that?

I ended up making a custom function that gets the number of values in a dropdown effect. I have no idea if this is a good way of doing it but it worked for me! :)
function getDropdownLength(dropdownMenu) {
    var length = 1;
    var originalValue = dropdownMenu.value;
    dropdownMenu.setValue(1);

    while (true) {
        try {
            dropdownMenu.setValue(dropdownMenu.value + 1);
            length++;
        }
        catch (e) {
            break;
        }
    }

    dropdownMenu.setValue(originalValue);
    return length;
}


text:
Premiere Pro media linking with illegal filenames
I was working on a video project with some classmates and after our class ended I asked our editor if I could have the footage. She everso-nicely renamed the files so they are human-readable, however, included / in many of the files. For example, scene2_shot17_take1-OTS/chairs.MP4 is the name of a file. Mac, for some reason, is able to read the /. Windows, however, reads it as scene2_shot17_take1-OTSchairs.MP4.
For Premiere Pro, when I load up the project, it asks me to locate all of the files. It says the last path was Path/to/file/scene2_shot17_take1-OTS:chairs.MP4. So instead of replacing / with , it replaces it with : which is also an illegal character to have in filenames!
I've used Advanced Renamer to rename all the files that contain  to _. My only question now is how to inform premier pro that I have made that change. I have almost 100 files that had / in them and I would not like to have to manually link them all. Thanks

After some STRUGGLE. I found this worked (strap in for a ride). Here's the step-by-step:

(Since I was in a group) have your project open and go to Edit>Team Project>Convert Team Project to Project.

The Premiere Pro project file (.prproj) is actually a compressed XML file. Exit Premiere Pro and then rename your project file from YourProject.prproj to YourProject.zip

unzip the file. It wouldn't work on my computer unless I used 7-zip to unzip it.

open the file titled YourProject in a text editor (I used VSCode)

Access the find and replace functionality (here's where it gets complicated)

Some text/code editors have an option like regular expression or use regex. You will need to enable this.

input ([a-zA-Z0-9\s_\\.-]+):([a-zA-Z0-9\s_\\.-]+)\.MP4 for the find field. this finds any .MP4 file that contains :

input $1_$2.MP4 in the replace field. $1 is all the text before : and $2 is all the text after up until .MP4.

Hit replace all and save the file- make sure to add the .prproj extension to it.

Load it up!

remember to always make a backup of your project file as I've only tested this a little bit. It worked for me!


text:
ffmpeg: How to decimate frame rate without recompressing, for I-Frame only video, like ProRes?
I use a capture device from Atomos to capture video in ProRes format over HDMI. The issue is, this device will only capture video in the exact same frame rate as the HDMI signal's refresh rate. So a 60hz signal MUST capture to a 60fps file. There's no way to capture in 30fps mode, and no way to do IVTC for 24fps capture either, unless the source is 1080i (which is not useful for 4K capture).
Since ProRes is an I-Frame only video format, I would imagine it should theoretically be possible to simply drop the unnecessary duplicated frames, spitting out a video that contains bit-identical frames, but uses much less storage. I capture both 30fps and 24fps content using this method, so it would be especially useful to me to be able to transfer that to my computer in a reduced file size, without any loss in quality.
So how would I go about doing this? I plan to create a small app that will allow me to do this for every 30/24 fps capture I make, but my experience with ffmpeg is too limited to figure out exactly what command line to use for this problem.
Note that the output frame rate should be exactly 50% of the input frame rate for 30fps sources, and exactly 40% of the input frame rate for 24fps sources . I can't work with variable frame rates, or frame rates that are slightly off from the standard rates. So ffmpeg should not be dropping any more extra frames than that, even if it decides they're duplicates.

See https://stackoverflow.com/q/71029418/

@Gyan that looks promising, but I'm reading the documentation for those filters and I am really confused at how they work. Could you help suggest command line usage for my examples?


text:
Cut start and end of video file if audio is silent or contains noise
I've tried using the following ffmpeg command :
ffmpeg -i path/to/input.ts -af silenceremove=start_periods=1:start_silence=0.1:start_threshold=-50dB,areverse,silenceremove=start_periods=1:start_silence=0.1:start_threshold=-50dB,areverse path/to/output.ts

The command worked and generated a file except it only cut the audio stream and not both the audio stream and video stream.
Is there a way to make it cut both with ffmpeg or it's javascript equivalent fluent-ffmpeg ?

Have you seen more or less the same question at superuser? https://superuser.com/q/990357/141595

@SaaruLindestøkke Nope i hadn't seen it. Thank you for pointing it out. Sadly, all those solutions won't work for me. I need an ffmpeg command line that can be converted to fluent-ffmpeg.

Thanks, can you please [edit] your question to include that kind of requirements?


text:
How to add a afade effect to a complex filter (In this case volume)?
Here is my current command :
ffmpeg -i [videoFilepath] -i [musicFile] -stream_loop -1 -shortest -filter_complex "[1]volume=0.15:enable=between(t\,4\,10)+between(t\,14\,20)[a1];[0:a][a1]amix=inputs=2" -map 0:v:0 [outputFilepath]

What it does :

Takes a video file as an input
Takes a music file as an input
Loops the music if it is shorter than the video duration
If the music is longer, outputs a file the duration of the video
Reduce volume by 85% between 4 and 10 seconds as well as between 14 and 20 seconds
Mixes the 2 audio streams so we have both the original video audio non-filtered and the music with the volume filter
Outputs a video file

I want the volume filter to ease-in and ease-out for a duration of 1 second, instead of abruptly changing. Is this possible ?

A quick, maybe imperfect solution – use an expression in the volume filter, e.g. for linearly decreasing volume from 1 to 0.15 in the time interval between 4th and 5th second:
volume=1-0.85/(5-4)*(t-4):eval=frame

For time  t=4, the volume will evaluate to 1, for t=5 it will be 0.15:
for t=4:    1 - 0.85 / (5-4) * (4-4) = 1 - 0.85 / (10-4) * 0 = 1 - 0 = 1
for t=5:    1 - 0.85 / (5-4) * (5-4) = 1 - 0.85 = 0.15

You may use (nested) if functions for evaluating the volume value in different time intervals of your audio stream.
For example, to keep the value 1 for the first 4 seconds you may extend the previous formula
              1-0.85/(5-4)*(t-4)

with the help of the lt (less than) function into
if(lt(t\,4),1,1-0.85/(5-4)*(t-4))

and then – for keeping the value 0.15 after 5th second – into
if(lt(t\,4),1,if(lt(t\,5),1-0.85/(5-4)*(t-4),0.15))

And so on, always rewriting the last item with a new if function.
Of course, the resulting expression is not the optimal one, but the procedure is pretty straightforward.

Hi. Thank you for your answer @MarianD.
From your question i came up with this function to decrease the volume : 1 - [ (1 - percentage) / ( stop - start) ] * ( time - start)
And this is for the linearly increasing the volume : 1 - [ (1 - percentage) / (stop - start) ] * (stop - time)
My question is now : I want the volume to decrease to 15% over 1s then stay at the same level between 2 times and finally increase back up to 100% over 1s. How would i go about doing that ?

@Nobunaji, I extended my answer to show you how to progressively build the expression for your particular need.

finally: ffmpeg -f lavfi -i "aevalsrc=sin(440*2*PI*t)" -af " volume='if(lt(t,4)+between(t,10,14)+gt(t,20),1, if(between(t,4,5),1-0.85*(t-4), if(between(t,9,10),0.15+0.85*(t-9), if(between(t,14,15),1-0.85*(t-14), if(between(t,19,20),0.15+0.85*(t-19), 0.15)))))':eval=frame " -b:a 320k -t 23 -y /tmp/out.mp3

@БаярГончикжапов, nice, you are a smart man – why not to put it as another answer and gain some reputation points?

@MarianD Why in your expression you put if(lt(t\,4),1,if(lt(t\,5),1-0.85/(5-4)*(t-4),0.15)) and not if(lt(t, 4), 1), if(lt(t, 5), 1-0.85/(5-4)*(t-4),0.15)) ? This makes more sense to me than to have one if inside of another.

@БаярГончикжапов Can any of you two tell me what is wrong with the edited section of my original question ?

Nobunaji, 1. Yes, your expression seems better than mine. — 2. Please consider accepting my answer, if it is useful for you (click on the check mark near its start). — 3. Your edited part is another question, please let us at first finish the original one. Put the edited part in the form of another, new question, please.

It's done @MarianD. Here is a link to the new question : https://video.stackexchange.com/questions/36556/error-initializing-complex-filters-using-volume-filter-in-fluent-ffmpeg

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


text:
After Effects crashing Mac Book Pro 2019
I'm having issues with my After Effects freezing my whole laptop and having to press the shutdown button to restart it. I have talked to two Adobe Agents and screen shared with them and neither of them could figure out what the problem was. Apparently I have sufficient memory and one of them has installed a cleaner application of some sort. I have also reinstalled After Effects. I have also cleared cache in After Effects preferences so am wondering what else I can do so that it doesn't do this. Wondering if buying more ram would work to speed up the laptop? I am not heavily dependant on this App I was just trying tutorials and wanting to have an additional skill I mostly use Illustrator and InDesign. So not to keen on investing a lot of money in something that I just want to learn at a fairly basic level.
It freezes on certain tutorial files the ones that have more keyframes but its a beginners tutorial so the animations aren't that complex so when Im editing the keyframes thats when it usually freezes.
I tried a mac desktop at work which is actually older than my laptop and it did freeze when I opened one of the files up in my tutorials it took longer but eventually happened.
Have also opened in Safemode and it still crashed, went through a series of troubleshooting things with the Adobe Agents.
This is the memory I have so far on my laptop

Does it freeze or crash at a specific time or with a specific plugin? Have you opened AE in safe mode? Have you tried the same project on another Mac without issue?

@tomh have updated description :)


text:
How to export only the Viewport in After Effects?
I'm experienced with Illustrator though very new to After Effects and having big trouble with the most basic of things.
What I'm trying to do is that basically I have a huge HD map and I want to show a path in part of this map. I've successfully got it scrolling just where I want it in the Viewport that I see, however when I export the entire map is exported, not just the section I was zoomed into.
The question is, how do you extract only part of an image in After Effects with the rest being considered out of bounds?
In doing this, I don't actually want to reduce the image resolution and the rest still has to 'exist' as the path will scroll there.

Precompose the map layers, then in your Main composition scale up the Precomposition to show what you want exported (and keyframe Position if that's what you are doing to keep the path in view). Your Main composition only needs to be the size of the exported video - not the size of the HD Map (the Precomposition should be the size of the HD Map).


text:
ffmpeg timecode added does not match the ones I can read in Premiere
I used this command to burn the timecode inside my video.
While everything looked fine, when I open my video inside Premiere it seems that my timecode doesn't match.

My fear is that the timecode processed by ffmpeg was the original of the input file but when recompressed via h264 the number of frames changed giving precedence to the h264 compression algorithms.
How can I fix it? Or better how I can have an output video that match exactly the duration and the frames of the original input file?
Sadly my input file was already an h264 mp4 stream.
The command I used is the following:
ffmpeg -i "file.mp4" -c:v libx264 -x264-params "crf=17" -preset fast -c:a copy -c:s copy -copyinkf -filter_complex "drawtext=fontfile=font.otf: timecode='00\:00\:00\:00':rate=24: text='': fontsize=56: fontcolor=white@0.9: borderw=3: bordercolor=black: x=50-text_w/2:y=50" "file2.mp4"

The full console output is the following:
ffmpeg version N-82500-g52da3f6 Copyright (c) 2000-2016 the FFmpeg developers
  built with gcc 4.9.3 (GCC)
  configuration: --arch=x86_64 --target-os=mingw32 --cross-prefix=/root/opt/ffmpeg-cross-compile/sandbox/cross_compilers/mingw-w64-x86_64/bin/x86_64-w64-mingw32- --pkg-config=pkg-config --disable-w32t
hreads --enable-libsoxr --enable-fontconfig --enable-libass --enable-libbluray --enable-iconv --enable-libtwolame --extra-cflags=-DLIBTWOLAME_STATIC --enable-libzvbi --enable-libcaca --enable-libmodpl
ug --extra-libs=-lstdc++ --extra-libs=-lpng --enable-decklink --extra-libs=-loleaut32 --enable-libmp3lame --enable-version3 --enable-zlib --enable-librtmp --enable-libvorbis --enable-libtheora --enabl
e-libspeex --enable-libopenjpeg --enable-gnutls --enable-libgsm --enable-libfreetype --enable-libopus --enable-bzlib --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libvo-amrwbenc --ena
ble-libschroedinger --enable-libvpx --enable-libilbc --enable-libwavpack --enable-libwebp --enable-libgme --enable-dxva2 --enable-avisynth --enable-gray --enable-libopenh264 --enable-netcdf --enable-l
ibflite --enable-lzma --enable-libsnappy --enable-libzimg --enable-gpl --enable-libx264 --enable-libx265 --enable-frei0r --enable-filter=frei0r --enable-librubberband --enable-libvidstab --enable-libx
avs --enable-libxvid --enable-libmfx --extra-libs=-lpsapi --extra-libs=-lspeexdsp --extra-cflags='-mtune=core2' --extra-cflags=-O3 --enable-static --disable-shared --prefix=/root/opt/ffmpeg-cross-comp
ile/sandbox/cross_compilers/mingw-w64-x86_64/x86_64-w64-mingw32 --enable-nonfree --enable-libfdk-aac --enable-runtime-cpudetect
  libavutil      55. 40.100 / 55. 40.100
  libavcodec     57. 66.103 / 57. 66.103
  libavformat    57. 57.100 / 57. 57.100
  libavdevice    57.  2.100 / 57.  2.100
  libavfilter     6. 67.100 /  6. 67.100
  libswscale      4.  3.101 /  4.  3.101
  libswresample   2.  4.100 /  2.  4.100
  libpostproc    54.  2.100 / 54.  2.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'file.mp4':
  Metadata:
    major_brand     : iso5
    minor_version   : 512
    compatible_brands: iso6mp41
  Duration: 00:51:27.38, start: 0.000000, bitrate: 3246 kb/s
    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709), 1920x1080 [SAR 1:1 DAR 16:9], 2988 kb/s, 24 fps, 24 tbr, 12288 tbn, 48 tbc (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 256 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
[libx264 @ 0000000003746020] using SAR=1/1
[libx264 @ 0000000003746020] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
[libx264 @ 0000000003746020] profile High, level 4.0
[libx264 @ 0000000003746020] 264 - core 148 r2708 86b7198 - H.264/MPEG-4 AVC codec - Copyleft 2003-2016 - http://www.videolan.org/x264.html - options: cabac=1 ref=2 deblock=1:0:0 analyse=0x3:0x113 me=
hex subme=6 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=12 lookahead_threads=2 sliced_threads=0 nr=0 dec
imate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=1 keyint=250 keyint_min=24 scenecut=40 intra_refresh=0 rc_lookah
ead=30 rc=crf mbtree=1 crf=17.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to 'file2.mp4':
  Metadata:
    major_brand     : iso5
    minor_version   : 512
    compatible_brands: iso6mp41
    encoder         : Lavf57.57.100
    Stream #0:0: Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], q=-1--1, 24 fps, 12288 tbn, 24 tbc (default)
    Metadata:
      encoder         : Lavc57.66.103 libx264
    Side data:
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
    Stream #0:1(und): Audio: aac (LC) ([64][0][0][0] / 0x0040), 48000 Hz, stereo, fltp, 256 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
Stream mapping:
  Stream #0:0 (h264) -> drawtext
  drawtext -> Stream #0:0 (libx264)
  Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
frame= 2105 fps= 36 q=-1.0 Lsize=   41555kB time=00:01:27.58 bitrate=3886.8kbits/s dup=2 drop=0 speed=1.49x
video:38775kB audio:2719kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.145290%
[libx264 @ 0000000003746020] frame I:11    Avg QP: 7.99  size: 70608
[libx264 @ 0000000003746020] frame P:761   Avg QP:13.37  size: 28331
[libx264 @ 0000000003746020] frame B:1333  Avg QP:14.85  size: 13030
[libx264 @ 0000000003746020] consecutive B-frames:  2.0% 40.1%  1.9% 56.1%
[libx264 @ 0000000003746020] mb I  I16..4: 49.6% 36.9% 13.5%
[libx264 @ 0000000003746020] mb P  I16..4:  9.6% 15.5%  2.1%  P16..4: 20.5%  7.4%  3.1%  0.0%  0.0%    skip:41.8%
[libx264 @ 0000000003746020] mb B  I16..4:  2.5%  3.7%  0.4%  B16..8: 17.6%  7.0%  0.8%  direct: 7.7%  skip:60.4%  L0:50.5% L1:44.4% BI: 5.1%
[libx264 @ 0000000003746020] 8x8 transform intra:56.0% inter:56.8%
[libx264 @ 0000000003746020] coded y,uvDC,uvAC intra: 37.2% 61.9% 19.6% inter: 6.6% 19.9% 0.8%
[libx264 @ 0000000003746020] i16 v,h,dc,p: 51% 24% 14% 10%
[libx264 @ 0000000003746020] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 36% 18% 29%  3%  3%  3%  2%  3%  3%
[libx264 @ 0000000003746020] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 39% 23% 15%  4%  4%  4%  3%  4%  3%
[libx264 @ 0000000003746020] i8c dc,h,v,p: 45% 18% 29%  7%
[libx264 @ 0000000003746020] Weighted P-Frames: Y:5.8% UV:3.0%
[libx264 @ 0000000003746020] ref P L0: 77.3% 22.7%
[libx264 @ 0000000003746020] ref B L0: 87.0% 13.0%
[libx264 @ 0000000003746020] ref B L1: 97.2%  2.8%
[libx264 @ 0000000003746020] kb/s:3621.54

I re-ran it to obtain the output and closed it after some seconds with [q] option ;)
EDIT: ran again keeping the video only!
ffmpeg version N-82500-g52da3f6 Copyright (c) 2000-2016 the FFmpeg developers
  built with gcc 4.9.3 (GCC)
  configuration: --arch=x86_64 --target-os=mingw32 --cross-prefix=/root/opt/ffmpeg-cross-compile/sandbox/cross_compilers/mingw-w64-x86_64/bin/x86_64-w64-mingw32- --pkg-config=pkg-config --disable-w32t
hreads --enable-libsoxr --enable-fontconfig --enable-libass --enable-libbluray --enable-iconv --enable-libtwolame --extra-cflags=-DLIBTWOLAME_STATIC --enable-libzvbi --enable-libcaca --enable-libmodpl
ug --extra-libs=-lstdc++ --extra-libs=-lpng --enable-decklink --extra-libs=-loleaut32 --enable-libmp3lame --enable-version3 --enable-zlib --enable-librtmp --enable-libvorbis --enable-libtheora --enabl
e-libspeex --enable-libopenjpeg --enable-gnutls --enable-libgsm --enable-libfreetype --enable-libopus --enable-bzlib --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libvo-amrwbenc --ena
ble-libschroedinger --enable-libvpx --enable-libilbc --enable-libwavpack --enable-libwebp --enable-libgme --enable-dxva2 --enable-avisynth --enable-gray --enable-libopenh264 --enable-netcdf --enable-l
ibflite --enable-lzma --enable-libsnappy --enable-libzimg --enable-gpl --enable-libx264 --enable-libx265 --enable-frei0r --enable-filter=frei0r --enable-librubberband --enable-libvidstab --enable-libx
avs --enable-libxvid --enable-libmfx --extra-libs=-lpsapi --extra-libs=-lspeexdsp --extra-cflags='-mtune=core2' --extra-cflags=-O3 --enable-static --disable-shared --prefix=/root/opt/ffmpeg-cross-comp
ile/sandbox/cross_compilers/mingw-w64-x86_64/x86_64-w64-mingw32 --enable-nonfree --enable-libfdk-aac --enable-runtime-cpudetect
  libavutil      55. 40.100 / 55. 40.100
  libavcodec     57. 66.103 / 57. 66.103
  libavformat    57. 57.100 / 57. 57.100
  libavdevice    57.  2.100 / 57.  2.100
  libavfilter     6. 67.100 /  6. 67.100
  libswscale      4.  3.101 /  4.  3.101
  libswresample   2.  4.100 /  2.  4.100
  libpostproc    54.  2.100 / 54.  2.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'file.mp4':
  Metadata:
    major_brand     : iso5
    minor_version   : 512
    compatible_brands: iso6mp41
  Duration: 00:51:27.38, start: 0.000000, bitrate: 3246 kb/s
    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709), 1920x1080 [SAR 1:1 DAR 16:9], 2988 kb/s, 24 fps, 24 tbr, 12288 tbn, 48 tbc (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 256 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
[libx264 @ 000000000315f7c0] using SAR=1/1
[libx264 @ 000000000315f7c0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
[libx264 @ 000000000315f7c0] profile High, level 4.0
[libx264 @ 000000000315f7c0] 264 - core 148 r2708 86b7198 - H.264/MPEG-4 AVC codec - Copyleft 2003-2016 - http://www.videolan.org/x264.html - options: cabac=1 ref=2 deblock=1:0:0 analyse=0x3:0x113 me=
hex subme=6 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=12 lookahead_threads=2 sliced_threads=0 nr=0 dec
imate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=1 keyint=250 keyint_min=24 scenecut=40 intra_refresh=0 rc_lookah
ead=30 rc=crf mbtree=1 crf=17.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to 'file2.mp4':
  Metadata:
    major_brand     : iso5
    minor_version   : 512
    compatible_brands: iso6mp41
    encoder         : Lavf57.57.100
    Stream #0:0: Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], q=-1--1, 24 fps, 12288 tbn, 24 tbc (default)
    Metadata:
      encoder         : Lavc57.66.103 libx264
    Side data:
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
Stream mapping:
  Stream #0:0 (h264) -> drawtext
  drawtext -> Stream #0:0 (libx264)
Press [q] to stop, [?] for help
frame=  843 fps= 36 q=-1.0 Lsize=   10386kB time=00:00:35.00 bitrate=2430.9kbits/s dup=2 drop=0 speed= 1.5x
video:10375kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.103293%
[libx264 @ 000000000315f7c0] frame I:4     Avg QP: 5.49  size: 41664
[libx264 @ 000000000315f7c0] frame P:285   Avg QP:12.19  size: 19489
[libx264 @ 000000000315f7c0] frame B:554   Avg QP:13.02  size:  8849
[libx264 @ 000000000315f7c0] consecutive B-frames:  2.6% 28.7%  1.8% 66.9%
[libx264 @ 000000000315f7c0] mb I  I16..4: 65.5% 27.6%  6.9%
[libx264 @ 000000000315f7c0] mb P  I16..4:  9.0% 11.3%  1.3%  P16..4: 15.5%  5.1%  2.2%  0.0%  0.0%    skip:55.6%
[libx264 @ 000000000315f7c0] mb B  I16..4:  2.4%  2.2%  0.1%  B16..8: 11.6%  4.9%  0.6%  direct: 7.1%  skip:71.0%  L0:50.3% L1:45.1% BI: 4.6%
[libx264 @ 000000000315f7c0] 8x8 transform intra:49.4% inter:53.5%
[libx264 @ 000000000315f7c0] coded y,uvDC,uvAC intra: 26.0% 54.6% 16.0% inter: 4.1% 16.1% 0.6%
[libx264 @ 000000000315f7c0] i16 v,h,dc,p: 52% 26% 14%  8%
[libx264 @ 000000000315f7c0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 31% 22% 38%  1%  1%  1%  2%  1%  2%
[libx264 @ 000000000315f7c0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 38% 28% 20%  2%  3%  3%  3%  2%  2%
[libx264 @ 000000000315f7c0] i8c dc,h,v,p: 49% 19% 26%  7%
[libx264 @ 000000000315f7c0] Weighted P-Frames: Y:15.4% UV:8.1%
[libx264 @ 000000000315f7c0] ref P L0: 71.5% 28.5%
[libx264 @ 000000000315f7c0] ref B L0: 84.7% 15.3%
[libx264 @ 000000000315f7c0] ref B L1: 96.2%  3.8%
[libx264 @ 000000000315f7c0] kb/s:2419.57

This is the media info I obtained:

Video
ID                          : 1
Format                      : AVC
Format/Info                 : Advanced Video Codec
Format profile              : High@L4
Format settings, CABAC      : Yes
Format settings, ReFrames   : 2 frames
Codec ID                    : avc1
Codec ID/Info               : Advanced Video Coding
Duration                    : 50s 0ms
Bit rate                    : 2 991 Kbps
Width                       : 1 920 pixels
Height                      : 1 080 pixels
Display aspect ratio        : 16:9
Frame rate mode             : Variable
Frame rate                  : 23.976 (23976/1000) fps
Minimum frame rate          : 12.000 fps
Maximum frame rate          : 24.000 fps
Color space                 : YUV
Chroma subsampling          : 4:2:0
Bit depth                   : 8 bits
Scan type                   : Progressive
Bits/(Pixel*Frame)          : 0.060
Stream size                 : 17.8 MiB (100%)
Writing library             : x264 core 148 r2708 86b7198
Encoding settings           : cabac=1 / ref=2 / deblock=1:0:0 / analyse=0x3:0x113 / me=hex / subme=6 / psy=1 / psy_rd=1.00:0.00 / mixed_ref=1 / me_range=16 / chroma_me=1 / trellis=1 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=-2 / threads=12 / lookahead_threads=2 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / bframes=3 / b_pyramid=0 / b_adapt=1 / b_bias=0 / direct=1 / weightb=1 / open_gop=0 / weightp=1 / keyint=250 / keyint_min=24 / scenecut=40 / intra_refresh=0 / rc_lookahead=30 / rc=crf / mbtree=1 / crf=17.0 / qcomp=0.60 / qpmin=0 / qpmax=69 / qpstep=4 / ip_ratio=1.40 / aq=1:1.00

The console output shows only two duplicated frames. But the output is only 1m27s whereas the source is 51m. So, if there are dropped frames further, this console output won't reveal that. Does Premiere at the 1m27s mark show a 2 frame difference?

@Mulvya sorry I realized that I created a wrong sequence in Premiere with a fps of 23.297 instead 24.. If I create a sequence of 24 fps indeed i have 2 frames off only. How can I get rid of this 2 or more duplicate frames? Is my command good or I have to write it in a better way to have not duplicate or dropped frames for the future encodings ? thanks

Disable the audio and subtitles and encode. Then mux the encoded video with the original audio/subs into a new MP4.

@Mulvya do you think that the problem is a matter of matching with audio and subs? :O I could try..

@Mulvya ok I did it, keeping only the video, however as you can see in console the 2 dup frames are still there :\

Use -vsync 0.

@Mulvya i added vsync 0 and now it doesn't sign duped frames however the time is always off of about 2 frames in the comparison between the timecode and adobe premiere

Wait a minute. It might be this bug.

@Mulvya Fine but disabling B and P frames doesn't just make everything huge? :O

None of the options I suggested there disable P-frames. And B-frames aren't disabled, just limited. Or you could just live with the missing 2 frames :)

You might have variable frame rate media. The time base looks pretty crazy for standard 24p media. I might hit it with MediaInfo (note the Windows GUI includes adware, but the CLI version does not) and post the output from that.

Yes.. it seems so, I tried many transcodings and always it seems change th fps on the fly. How can I obtain a constant output ?

That time base is the standard that ffmpeg produces i.e .framerate x 512.

@Mulvya let me post the info for the last encoded file...

@Mulvya let me reply here so both of you can read, I did many other tests, I also tried to encode only the video in .mov with a proress codec instead of h264.. ffmpeg doesn't show duplicated frames however at the very beginning of the movie there's the black background with white text for the initial credits.. and in this part 00:00:00:03 and 00:00:00:04 are repeated 2 times in premiere leaving Premiere being always +2 frames over the total until the end :( I don't understand why, can it be something bugged about particular scenes like white text on black background?

@user3450548 What you would need to do is manually specify the output frame rate in your encoding tool. So for ffmpeg you would use -r 24000/1001 for 23.976, and for Handbrake there's a dropdown and you would select Constant Frame Rate.

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


text:
Command line approach to taking a 16:9 video and creating a 1080x1920 YouTube short?
Is there a way of using ffmpeg or similar, taking a 1920x1080 video, cut out the middle bit for creating a 1080x1920 YouTube short and then getting it to upscale the middle bit?
EDIT: I think this is it:
ffmpeg.exe -i input.mp4 -filter:v "crop=1080:1080:420:0,scale=1920:1920:flags=lanczos:param0=3,crop=1080:1920" -acodec copy output.mp4

"cut out the middle bit" you mean cropping? Or edit in time?

Cropping, I've edited the question with what looks like the right approach.

And did you have success with this command?

Yeah, I've adopted an approach of converting the whole video with the command above first and then selecting out the 59 seconds I want with a follow up command.  That does the trick.  YouTube is now recognising the videos as shorts.


text:
ffmpeg - Finding the right point to cut
I cut videos using the command below, and I sometimes find that the resulting video has imperfections at the beginning (square artifacts in the image). If I advance the start time parameter value (START_AT_SECONDS) by a few seconds (usually 1..3s), the artifacts go away.
Is there a way to avoid the hit-and-miss, e.g. to know in advance that START_AT_SECONDS=53 works but START_AT_SECONDS=52 will give artifacts? Is there an option that means "START_AT_SECONDS=52, or later as needed to make a good cut"?
ffmpeg -ss START_AT_SECONDS -i "some_file_name.mp4" -t DURATION_SECONDS -c copy "new_name.mp4"

There is a mistake in your ffmpeg command.
The -c option either needs a codec (e.g. -c:v libx264) if you want to encode the video or the special value "copy" if it shouldn't be re-encoded (-c copy).
Using -ss together with -c copy might not be accurate since ffmpeg is forced to only split on i-frames.
But starting on an i-frame should fix the problem with artifacts.

Apologies, I was already using "-c copy new_name.mp4". I have updated the question to reflect that.


text:
How to send av1 encoded stream to a mediamtx server?
I want to test streaming av1 encoded video from the command line but I don't have enough expertise to know if I'm doing something wrong or if it's simply unsupported.
So far I've tried gst-launch-1.0 videotestsrc ! av1enc ! rtspclientsink location=rtsp://localhost:8554/usbcamera and ffmpeg -f v4l2 -i /dev/video1 -c:v libsvtav1 -an -f rtsp rtsp://localhost:8554/usbcamera
Using a file source with ffmpeg works with ffmpeg -re -stream_loop -1 -i av1noaudio.mp4 -f rtsp rtsp://localhost:8554/usbcamera but not with gstreamer gst-launch-1.0 filesrc location=av1noaudio.mp4 ! videoconvert !  rtspclientsink location=rtsp://localhost:8554/usbcamera

For future visitors:
Ffmpeg currently does not support streaming in rtp of av1.
This includes AV1. The line he wrote (ffmpeg -re -stream_loop -1 -i av1noaudio.mp4 -f rtsp rtsp://localhost:8554/usbcamera) transcodes the av1 feed to mpeg4, which is sent to the rtsp server.

I got it working
gst-launch-1.0 filesrc location=Videos/av1noaudio.mp4 ! qtdemux ! av1parse ! rtspclientsink location=rtsp://localhost:8554/usbcamera
I don't know if this is the most optimal solution, but at least it'll help any other newbie coming behind me.


text:
Adobe premier preview window shows (and renders after effects compositions as off-center? (pic attached)

When importing an after effects comp onto premiere, it shows as off-center, wrapping around so that the right edge shows up on the left side, both in the preview window and in render from Premiere.
Here are my sequence/comp settings:

My process:

Import after effects comp into premiere
Premiere shows comp as weirdly off-center. It renders this way too.

Things I've tried:

Creating a new sequence/project in premiere
Importing after effects comp via import option, via copy paste, or via drag & drop
Creating a new after effects comp (just a simple shape layer) and importing that.

Any ideas? Really confused and this is holding up my video production pretty bad right now!

I have no idea why it would be wrapping like that, but can you actually just render the output and then include that in your project.  If you render to a lossless format, it won't have any loss.  Will potentially be a pretty big output, but it should get you unjammed.

Thanks AJ. That's what I'll do I think. Thanks for letting me know about the lossless part; I didn't know that and I was worried about it, but now I'm not thanks to you!

Check your sequence size in Premiere, and your Comp Size in After Effects are exactly the same.
In Premiere:
Make sure your sequence is selected in the timeline, then
Sequence menu. --> Sequence Settings --> Frame Size
In After Effects:
Maker sure your comp is selected and visible, then
Composition menu --> Composition Settings --> Width/Height.
Check pixel aspect ratios are Square too.
Also: make sure you're viewing your full canvas in Premiere and AE.

Checked! Added screenshots above. All looks the same? Thanks so much for the help though.


text:
Noise filtering/cancellation via software while recording voice
While making videos at home, there is a considerable amount of ambient noise throughout the day (e.g. airplanes, cars honking, dogs barking, etc).  I know there are (software) tools that are capable of filtering out such noise while recording voice audio.  For example, Microsoft's "Teams" software has a digital/software filter that, when turned on, causes all of those sounds to be filtered out of the audio that is transmitted to others in the "Team" call. It does a flawless job of this, allowing essentially only voice audio to pass through.
However, I have yet to find what software would do this for a typical home video recording setup.  In my case, the hardware I have is:

Sound: a Professional Scarlett Studio MIC, connected to a Focusrite Scarlett 2i2, which is then connected to a MacBook Pro.  The MacBook is running Ableton Live 11.
Video: A Sony ZV-1F.

Honestly, I have yet to make my first video...but audio tests show that absolutely every ambient sound is mingled with my voice.
I am not looking for a solution of "go to a recording studio".  Also, I am not talking about playback of a recording (I am not looking for a noise-cancellation headset).  I am looking for software, presumably compatible with the above, which filters out the noise while the recording of my voice is in progress.  Any suggestions?

As you're working in mono, this becomes easy, using that dreaded misnomer… AI
Just record your soundtrack as normal, then throw the resulting file at Adobe Enhance (free but requires sign-up). It only takes wav or mp3. It will take stereo but gives you mono back.
Tadahh. Clean audio track.
Honestly, it's nearly put me out of a job :\
There's also a Mic Check tool, which I haven't yet tried.
BTW, the kind of routines that Teams et al use is 'clever' but pretty low bandwidth/complexity. You wouldn't want to use it for broadcast


text:
Is there a math formula computing the size of the video given its video and audio information?

I have a short video of length 11s in mp4 format. As you can see from the screenshot, it is 1080 by 1920 with Data rate 2097 kbps and total bitrade 2208 kbps. Frame rate is 30.00 fps.
The audio bit rate is 111 kbps with two stereo channels and the audio sample rate is 44.100 kHz.

Question: how to compute the size of my video based on the information above?

Observation: Total bitrate = (video) Data rate + (audio) Bit rate = 2097 + 111 = 2208
But I guess 2208kbps * 11s = 24288 kb, while my video size is much bigger, see
What goes wrong here? Or am I using the wrong formula?

What makes you say that “my video size is much bigger”? 24288 kb = 24,288,000 bits = 3,046,000 bytes quite closely matches your given file size (give or take rounding errors, and possibly some headers whose size is not accounted for).

@EmilJeřábek Sorry I took bytes there as bits... there is a 8-times difference...


text:
mp4 video doesn't play on mobile, but it plays locally
I built a mp4 video from jpg images using this command:
ffmpeg -framerate 1 -i img%d.jpg -c:v libx264 -pix_fmt yuv420p -r 1 output.mp4
I can open and play video on my computer (in VLC and in a browser), but I can't play it on mobile (Chrome 116.0.5845.93 on Android 11, the phone is Oppo A73). There's info about duration, I can press the "play" button, but the video doesn't play at all.
It has 1920 × 1280 resolution and 16 seconds length - as expected.
$ ffprobe output.mp4
ffprobe version 6.0 Copyright (c) 2007-2023 the FFmpeg developers
  built with Apple clang version 14.0.0 (clang-1400.0.29.202)
  configuration: --prefix=/opt/homebrew/Cellar/ffmpeg/6.0 --enable-shared --enable-pthreads --enable-version3 --cc=clang --host-cflags= --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libaribb24 --enable-libbluray --enable-libdav1d --enable-libmp3lame --enable-libopus --enable-librav1e --enable-librist --enable-librubberband --enable-libsnappy --enable-libsrt --enable-libsvtav1 --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libspeex --enable-libsoxr --enable-libzmq --enable-libzimg --disable-libjack --disable-indev=jack --enable-videotoolbox --enable-neon
  libavutil      58.  2.100 / 58.  2.100
  libavcodec     60.  3.100 / 60.  3.100
  libavformat    60.  3.100 / 60.  3.100
  libavdevice    60.  1.100 / 60.  1.100
  libavfilter     9.  3.100 /  9.  3.100
  libswscale      7.  1.100 /  7.  1.100
  libswresample   4. 10.100 /  4. 10.100
  libpostproc    57.  1.100 / 57.  1.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'output.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf60.3.100
  Duration: 00:00:16.00, start: 0.000000, bitrate: 1173 kb/s
  Stream #0:0[0x1](und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt470bg/unknown/unknown, progressive), 1920x1280 [SAR 1:1 DAR 3:2], 1172 kb/s, 1 fps, 1 tbr, 16384 tbn (default)
    Metadata:
      handler_name    : VideoHandler
      vendor_id       : [0][0][0][0]
      encoder         : Lavc60.3.100 libx264

How to fix that?

Well what dimensions are the video? You've give us nothing to work with here. ffprobe output.mp4 would help, along with what your phone is!

@KenSharp I updated the description

Try adding -profile main


text:
FFMPEG Concat Demuxer adds more time to output than expected
I am using ffmpeg concat demuxer to join multiple(189) videos together. The videos are originally split from a single video using the following command:
ffmpeg -ss time[2] -vsync 1 -copyts -i inputfile.mp4 -ss time[0] -to time[1] -c:a copy -c:v libx264 -b:v 800k output.mp4

Thereafter I am using the following concat command:
ffmpeg -f concat -safe 0 -i list.txt -c copy output.mp4

The problem is that the sum of the lengths of the input videos is 24:03:520 The output.mp4 video comes out to be 24:05:550. Which is two seconds longer than the constituent video length.
I need the output video to be time accurate. How can I achieve this without reencoding the video?

In my experience -safe 0 with a file with relative paths sometimes messes up the concat command, adding time, in my case, over an hour.
The other thing is that the files might have different timebases.
Check them and make sure they are the same. Premiere for me output the same files using the same codec and compressdifferent timebases.

Tried it. This does not work. All the cut files have identical timebases.
It still adds a lot of time after removing -safe 0


text:
FFmpeg setpts filter produces wrong frame number
Description
I found a strange behavior in setpts filter: sometimes when I use it to speed up a video it inserts more frames than expected.
My ffmpeg version is the following:
ffmpeg version 6.0-static https://johnvansickle.com/ffmpeg/  Copyright (c) 2000-2023 the FFmpeg developers
built with gcc 8 (Debian 8.3.0-6)
configuration: --enable-gpl --enable-version3 --enable-static --disable-debug --disable-ffplay --disable-indev=sndio --disable-outdev=sndio --cc=gcc --enable-fontconfig --enable-frei0r --enable-gnutls --enable-gmp --enable-libgme --enable-gray --enable-libaom --enable-libfribidi --enable-libass --enable-libvmaf --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librubberband --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libvorbis --enable-libopus --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libdav1d --enable-libxvid --enable-libzvbi --enable-libzimg
libavutil      58.  2.100 / 58.  2.100
libavcodec     60.  3.100 / 60.  3.100
libavformat    60.  3.100 / 60.  3.100
libavdevice    60.  1.100 / 60.  1.100
libavfilter     9.  3.100 /  9.  3.100
libswscale      7.  1.100 /  7.  1.100
libswresample   4. 10.100 /  4. 10.100
libpostproc    57.  1.100 / 57.  1.100

Preparation
Use this video as input, taken from FFmpeg Wiki page about changing frame rate:
ffmpeg -f lavfi -i testsrc=duration=10:size=854x480:rate=60 -vf "drawtext=text=%{n}:fontsize=72:r=60:x=(w-tw)/2: y=h-(2*lh):fontcolor=white:box=1:boxcolor=0x00000099" test.mp4

The test.mp4 video has 60 fps, 600 total frames and a duration of 10 s.
Use this command to create a 2x version of the input.
ffmpeg -i test.mp4 -vf "setpts=0.5*PTS" test_2x.mp4

The output should be twice as fast as the input, dropping half the frames to maintain the same framerate in half the duration: it should be still at 60 fps, but have a duration of 5 s and 300 total frames.
Problem
The issue is that the output video has 302 frames, not the exact 300, and consequently it has a duration of 05.033333 s. As the input video has the frame number printed on it, I can see that the first frames are not correctly dropped.
This is what I get:
 input frame:  | 0 | 1 | 2 | 3 | 4 | 5 | 6 |  7 |  8 |  9 | ... |
output frame:  | 0 | 1 | 2 | 3 | 4 | 6 | 8 | 10 | 12 | 14 | ... |

Notice that the first 5 frames are replicated without any drop, while 2 of them (1 and 3) should have been dropped.
This is what I expected:
 input frame:  | 0 | 1 | 2 | 3 | 4 |  5 |  6 |  7 |  8 |  9 | ... |
output frame:  | 0 | 2 | 4 | 6 | 8 | 10 | 12 | 14 | 16 | 18 | ... |

The issue is present also if I use other encoders or containers to create my output file: I tried ffvhuff in an mkv file and raw video in an y4m file, with the same results.
The problem desappears if I add a fps=60 filter after the setps one.

setpts filter only retimes frames; it cannot add or drop frames.
The MP4 format is configured to require constant frame rate, and so ffmpeg's frame management (vsync) logic gets to work. This looks at the output frame rate, and the timestamps of the supplied frames to carry out frame duplication or drop decisions. But it first rebases the timestamps in terms of the output frame rate, and in this case, there seems to be some quirk in the output of that logic.
Instead of debugging it, I suggest you manually drop half the frames before retiming.
-vf "select=mod(n+1\,2),setpts=0.5*PTS"

Yes, sorry for the confusion, I expressed the concept a bit roughly, thank you for the clarification.


text:
Squishing an image from above in Sony Vegas Pro 18
I am using Sony Vegas 18.
I am attempting to squish an image from above, keeping the width and bottom x, y coordinates fully fixed, meaning the image "squishes" while being reducing in the y dimension over time.
Please see this crude image of what I would like to achieve. The orange box is the image I would like to squish with the red arrow indicating from where I want to reduction to take place.

I have attempted to achieve this with the pan/crop tool but it does not provide me with the means to do so. How could I go about doing this?

Create two keyframes, the first with your original size, the second with the cropped size. You should turn off fixed aspect ratio for your case.


text:
Can I reencode losslessly from yuv422p10 to yuv444? Or into a different format?
I have a 10-bit XAVC-HS file encoded with yuv422p10le pixel format and would like to render it out of my NLE, but my GPU does not support this. It does, however, support yuv444p and yuv444p16. Can I encode in either of those without losing information, since 16 bits should just straight up save more information?
I need to reencode in a format that preserves everything because due to workflow we need to chain two different NLEs. This is out of my hands. However, since there are a lot of files, I would rather render for five hours on the GPU than for 50 hours on my CPU.
Additional Details in case they are useful
The input file is straight out of a Sony ILME-FX3 in XAVC-HS 4k 200M 4:2:2 mode, which to my understanding outputs 10-bit h.265 files. I am rendering on an NVIDIA card under GNU/Linux, which severely limits compatibility. The program with which I am exporting gives me the choice between "h.265/HEVC", "ProRes", and "DNxHD". I figured that since I am already in h.265, the former would probably be the best choice for lossless conversion, but I may well be wrong there.
The files are in slog, and LUTs and colour grading are done on the reencoded files, so I really do not want to lose colour information in this step.
Edit: choosing the h.265 yuv444p16le rendering shrinks my test file from 2.3G to 1.5G, which makes me rather suspicious.

No, bit depth reduction always results in information loss, and even the chroma upscaling, while usually reversible with knowledge about the upscaling algorithm and the right algorithm to reverse it, is, without that special knowledge, technically not lossless either.
However, for practical use cases, the perceptual loss in such a conversion can be virtually nonexistent, if dithering is used in the conversion step, as should always be done during bit depth reductions.
But I'm not sure that you actually want lossless encoding, because except for H.265, none of the mentioned formats are able to encode losslessly, and H.265 is not particularly good at lossless encoding. So, be careful how you use that word. If you mean perceptually lossless, don't call it lossless.
For lossy encoding, using the same format as the input format indeed provides advantages, although it's probably not that important here, considering that your camera encoder should have very different behaviour from a proper CPU encoder like the common x265.
H.265 does not support 16 bit, the highest it supports is 12 bits. And every encoder has at least two important parameters that should always be set consciously by the user: effort/speed and quality/bitrate. In this case you want to set the effort/speed parameter "preset" (I highly recommend value "slow"), and the quality parameter "crf" (lower means higher quality). Always make sure to encode in a bit depth of at least 10 when doing lossy encoding, if possible, to prevent ugly banding artifacts.

Shot answer: No, not really.
While 16-bit does allow for a wider range compared to 10-bit, you won't be able to recover the information that has been lost when saving it in 10-bit initially.
Therefore, converting to yub444p16 will involve some form of interpolation/upsampling.
This could introduce some quality differences, but in my experience they are very subtle.
You will have to try for yourself if they are acceptable though.
You can use the following two commands to change the format:
ffmpeg -i input.yuv -pix_fmt yuv444p output.yuv
ffmpeg -i input.yuv -pix_fmt yuv444p16 output.yuv


text:
Is smpte170m Color Space Compatible with 10 bit yuv420p10le? Color Space choice(x265)
I need to encode a smpte170m color space MPEG-2 ("mpeg2video") video to 10 bit x265 (libx265, with FFMPEG).
Hoping to use yuv420p10le, but any suggestions are welcome.
Source video is in smpte170m color space and NTSC:
pix_fmt=yuv420p
level=8
color_range=tv
color_space=smpte170m
color_transfer=smpte170m
color_primaries=smpte170m
chroma_location=left
field_order=progressive

Is smpte170m space even compatible with 10 bit such as yuv420p10le?
Should I keep smpte170m space or convert it to BT907 or other?
Resolution (after scaling) will be approximately 848x304.
Which color space is more widely supported for such resolution?
Can FFMPEG/libx265 perform/compute correct color space conversion or it simply changes symbols in metadata without computing actual color conversion?
Encoded video is purely for personal use and will be played 99% of time on PC/android phones (No HDR screens at present).
Does NTSC standard still apply AFTER encoding to x265 or it becomes irrelevant? (say encoding to Matroska)
The only limitation I have in choosing a destination color space, etc (in encoded/destination video) is so that its play is supported in hardware on modern android phones/tablets/PC.
Thank you!

Is smpte170m space even compatible with 10 bit such as yuv420p10le?

There's no incompatibility - H.265 supports BT601-525 / SMPTE170m tagging. It depends on your player if colours are rendered correctly during playback.
So, first encode without any colorspace onversion and check. Else, convert to BT.709 using colorspace or zscale filter.


text:
How to convert Dolby Vision to SDR/HDR and sustain metadata?
Now I have a Dolby Vison streaming with Filmmaker mode which is from DV cert. lab. I want to convert this streaming file to SDR and HDR. I'm an outdoor for ffmpeg. Who can help me to write a ffmpeg command to reach the target? Very appreciate it.
PS: I use this command, but it only execute successfully when input video file is HDR.
ffmpeg -i HDR.mp4  -vf zscale=t=linear:npl=100,format=gbrpf32le,zscale=p=bt709,tonemap=tonemap=hable:desat=0,zscale=t=bt709:m=bt709:r=tv,format=yuv420p -c:v h264 -crf 19 -preset ultrafast output.mp4
Filmmaker Mode is a standard from the UHD Alliance. It enables the TV to display the content of a movie or
television show precisely as intended by the filmmaker. Filmmaker Mode disables all postprocessing and
preserves the correct aspect ratios, colors, and frame rates.


text:
How can I improve my tracking and manual focusing of fast moving subjects? (using a hybrid mirrorles camera)
Context
I'm a videography beginer. I am an experienced enthusiast photographer.
I am trying to move into wildelife videography as a hobby. My aim at this stage isn't to create full peices but just to get good at capturing high quality, aesthetically pleasing footage of wildlife. As such I'm using photography/hybrid equipment, which I know is probably a stumbling block but it's what I can afford, and also it seems a lot of wildlife videographers use photographic lenses.
Having done some initial research, I have obtained a sturdy tripod, fluid head, and tiny rig that allows me to use a tilta follow focus with my lens.
My lens is a fly-by-wire focussing 100-400mm Fuji zoom, and I'm using a Fuji XH2s.
I have been trying to practice tracking wildlife near me - deer, and also birds in flight at locations near me where there are lots of birds to practice on.
I am having struggling in two major areas, and wanting to know if it is likely that this is principally due to my skill level, or technical factors such as the gear I have, or both, and what i can do to improve.
Panning/tacking smoothly
Even with the Manfrotto fluid-head (MVH 500AH, which has fixed fluid drag for both tilt and pan), I struggle with smooth panning and tracking. My issue is keeping the speed of the movement uniform. I also find it impossible to go from stationary to moving with a noticeable jerk. I have tried adjusting the drag of the head but this doesn't seem to help, nor does turning off the camera & lens stabilisation. I appreciate that the use of a long lens will be making this harder than if it were a wide shot.
Is there anything in my set-up that might be making this more difficult - e.g. could some of the issue down to the performance of my fluid head; would one with variable drag be a lot better?
In terms of my skill, are there any known techniques or practice exercises that I would benefit from knowing about?
Focusing whilst tracking
Whilst the camera has subject tracking, I'm keen to learn to MF as a skill in its own sake, and also because I don't think the tracking is reliable or necessarily pleasing in how it tracks. I appreciate that my lens being fly-by-wire focussing isn't a good start, but I think most longer tele lenses are and the youtuber I've been learning from uses a lens that works this way (and acheives results that nat geo use).
I've fiddled with the settings to require less throw for focusing which has helped. However, one thing I'm struggling with is whether to use focus assist (where the display shows a crop of the overall frame) in addition to peaking. Without this assist, I struggle to see the peaking for further away subjects (e.g. a bird coming towards me - it's at infinity but i need to be able to tell when I'm going to start to need to bring the focus in). However, in the crop focus asssist view, tracking a fast moving bird becomes really difficult, and even for slower subjects obviosuly i can't see what else may have come into frame etc. Furthermore, as one hand is on the pan arm and the other on the follow focus knob, I don't have a third had to operate the button that toggles between full/cropped view. The camera has an option where it switches into the crop view when the focus ring is moved, however it then stays there till a button is pressed so  I have no way to get it back and am stuck in the croped view.
How do people tend to deal with this issue? Do they rely on more video-specific set ups than have function buttons operable from the pan arm or elsewhere? Do other camera systems have more sophisticated manual focus assist systems (e.g. a dual view that works for video capture). Would it help a lot to have a larger LCD or an external EVF, rather than relying on the camera's built in ones?
Or is it more likely that  I just need more practice, and if so, again are there any known techniques or practice exercises that I could look into?

I cannot hope to provide a fully-qualified answer to this, but maybe one or two hints towards the right direction.
For starters, I don't think you're doing anything 'wrong'. You might need a bit more practise, but I think you're doing all the right things, so much as you can. You could experiment with different pan-heads &/or tensions, but I think you're inherently behind the game compared to the pros in terms of gear/technology & 'manpower'.
For background, I'm also an experienced amateur photographer doing a lot of wildlife work & occasional videographer. I have a basic camera rig myself, but I actually work in film/TV [not on camera] so I do see the 'big boy's toys' in action almost daily.
Of course, back in the day, everybody shot on film, everything was manual. Wildlife crews spent days, weeks, months getting enough non-blurry footage to fill an hour's slot. Note the wide/zoom ratio they used to have to use compared to what they can do now.
Today, it's all in the technology. Cranes and gimbals can get closer than people. Cameras can be controlled wirelessly, with the op a safe distance away. A good gimbal can turn the roughest pan into a smooth wonder. Good autofocus can keep the subject pin-sharp at the same time, if they're not running manual, which they usually do; see below.
That's all well and good if you can afford the best gear in the business. I work on productions where they have both a Steadicam or Ronin op & another Ronin on a 20ft crane, every lens you could wish for and cameras that would make your bank manager cry. I couldn't afford those if I sold my house and car, so that's right out of the window.
Stabilisation and auto-focus on dual purpose DSLR/mirrorless cameras is… not great. Stabilisation often is tuned towards stills; some lenses have dual-mode stabilisation for tripod/hand-held use - I didn't check for your lens specifically. [I read on DPReview that the XH2's auto-focus is jumpy, but improves at lower frame-rates, 30 or even 20 fps.]
Manual focussing on a pro rig is usually done by another operator [focus puller, now usually called 1st AC (assistant camera)], the camera op doesn't have to do both jobs at once. The camera op's job is to keep it pointing in the right direction, not keep it in focus. The focus puller can look away from the scene on screen to better judge distances directly, and the calibrated focus ring remote is right there in their hand to see, rather than on the camera body - whereas you can't see the measurements on a lens from behind the camera. They will also quite likely have measured to significant points so they can quickly get to approximate before needing to use peaking or other methods to get pin sharp.
They're using something like this, and whilst the camera is rolling, keeping focus is their entire job.

Click for full size
So, you're trying to do the job of two people, with gear that's not as good as they have.
That's a hill to climb.
Dedicated video cameras are getting down towards affordable now - same price as a decent DSLR/mirrorless multi-function. They have stabilisation in software that makes it feel like you're on a gimbal, even hand-held, that doesn't fight with an in-lens stabiliser. Good focus peaking right there on-screen.
I don't really like recommending specific products, but sometimes they're no-brainers;) If you have an iPhone I'd definitely check out the new Blackmagic Camera app - free, as is their DaVinci Resolve edit suite, for home/semi-pro use. The iPhone app is, as far as I can gather, the 'brains' that is in their new semi-pro Pocket Cinema Cameras.
Having tried the app just on a couple of test scenes, nothing serious, I'm now having a serious debate with myself about going to see the bank manager to get one of the cameras… so I can get proper lenses on the front of that software.
Give the app a try, check out the stabilisation & focus assist - I don't think you can use manual focus on the iPhone & my single lens 28mm equivalent has far too long a DoF to properly test it.
I hope this doesn't come over as a one-man advertising campaign - that was not my intent - but just to show what the technology can add to your arsenal.

Many thanks for your reply, it's really useful information, and very interesting!
I am slightly wondering if sticking with a Fuji system is a mistake given them being generally stills orientated, and fairly behind the curve on video specific features even with their more video orientated models (compared to Sony hybrids, or obviosuly the blackmagic and other video-specific cameras that you mention).
But good to know that I'm not missing something major in terms of my technique, given the gear I have access to. I will have look at the apps you suggest - thank you!

Wish you luck:) Yeah, in terms of 'gear acquisition', for stills you can be up with the pros for the price of a small car. For video, it's the price of a large house. No hope of keeping up with the big boys. Software stabilisation will be our budget route; it's really getting very good these days.