text:
Lossless compression of 16 bit RGB sequences; split into two 8 bit sequences?
I am trying to come up with better ways to losslessly compress 16 bit PNG sequences. I've tried the ffv1 codec in ffmpeg and found that it usually ends up producing a file size that is only slightly smaller than the png sequence itself (for example, reducing 6.38 GB down to 6.25 GB).
ffmpeg -i 16bpc_image%04d.png -c:v ffv1 -coder 1 -context 0 -g 1 -level 3 out_ffv1.mkv
I've also just tried using 7-zip with ultra compression and the largest dictionary size (3840m) and got something similar (6.23 GB).
I think the issue is the lack of interframe compression. I've had good success with libx264rgb on 8 bpc png sequences in the past, but the issue is that it doesn't support a 16 bit pixel format.
I realized I can split the 16 bpc PNGs into two 8 bpc PNG sequences and try encoding each of them using libx264rgb; and sure enough, that actually gave me a good improvement:
ffmpeg -framerate 60 -i high_byte_image_%04d.png -c:v libx264rgb -qp 0 -preset veryslow highbyte.mp4
ffmpeg -framerate 60 -i low_byte_image_%04d.png -c:v libx264rgb -qp 0 -preset veryslow lowbyte.mp4

The lowbyte .mp4 file is 3.80 GB and the highbyte is 0.99 GB, for a total of 4.79 GB, a pretty decent reduction compared to the PNG sequence, the ffv1 codec, and the 7-zip archive.
I created the "high_byte" and "low_byte" images using this Python function:
def split_16bpc_to_8bpc(image_16bpc):
    high_byte = (image_16bpc >> 8).astype(np.uint8)
    low_byte = (image_16bpc & 0xFF).astype(np.uint8)
    return high_byte, low_byte

where the argument is from cv2
image_16bpc = cv2.imread(f'16_bpc_input.png', cv2.IMREAD_UNCHANGED)

While the highbyte image looks and compresses similar to the way an 8bpc image would, I noticed the lowbyte image has a lot of rainbow RGB noise. Here's an example comparison:

Obviously that noise is the reason the low byte compressed file is so much larger than the high byte version.
I suspect there may be a more clever way to approach this. Any ideas on what else I should try?


text:
What can I do about the error message "Prediction is not allowed in AAC-LC"
I have a sound file, which I believe is in MP4 format. At least
file FILENAME

shows the diagnoses
Audio file with ID3 version 2.4.0, contains:ISO Media, MP4 Base Media v1 [ISO 14496-12:2003]
When I query the file with
ffprobe -v error -show_entries 'format=duration' -of 'default=noprint_wrappers=1:nokey=1'

I get the error message
[aac @ 0x7ff588805fc0] Prediction is not allowed in AAC-LC.
Otherwise, the file seems to play fine in i.e. Foobar2000.
Do I have to worry about the error message?

source: Stack Exchange

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

sort: votes


text:
ffmpeg.exe error "There are 2 hardware devices. device cuda0 of type cuda is picked for filters by default"
Two different users (as far) reported this error using my Electron app that has the ability to record the game play and cut replays as highlights:
They have a 4060 and a 3060. I have also a 3060 and (naturally) this error doesn't happen for me.
We have checked also nvidia-smi output and only one NVidia device is registered. One of them tried also to disable the built-in GPU adapter from the CPU but no luck.
The error in particular is: "There are 2 hardware devices. device cuda0 of type cuda is picked for filters by default. Set hardware device explicitly with the filter_hw_device option if device cuda0 is not usable for filters."
Here it the command line and ffmpeg execution log:
[2024-12-18 00:46:10.210] [info]  Executing ffmpeg.exe -nostats -hide_banner -hwaccel cuda -hwaccel_output_format cuda -init_hw_device d3d11va -filter_complex ddagrab=offset_x=0:offset_y=0:video_size=1920x1080:framerate=60 -f gdigrab -framerate 60 -i desktop -f dshow -i audio=@device_cm_{33D9A762-90C8-11D0-BD43-00A0C911CE86}\wave_{2EBD7673-1FDC-4624-B31B-E3850A00954A} -ar 44100 -f dshow -i audio=@device_cm_{33D9A762-90C8-11D0-BD43-00A0C911CE86}\wave_{2EBD7673-1FDC-4624-B31B-E3850A00954A} -ar 44100 -filter_complex [1:a][2:a]amerge=inputs=2[a] -map 0:v -map [a] -colorspace bt709 -color_trc bt709 -color_primaries bt709 -c:v h264_nvenc -b:v 2500k -preset p3 -rc:v vbr -cq 27 -profile:v high -tune hq -rc-lookahead 30 -spatial-aq 1 -bf 2 -g 60 -acodec aac -fps_mode passthrough -f mpegts -
[2024-12-18 00:46:10.472] [info]  [info] [gdigrab @ 00000242f62ea540] Capturing whole desktop as 1920x1080x32 at (0,0)

[2024-12-18 00:46:10.557] [info]  [info] [gdigrab @ 00000242f62ea540] Stream #0: not enough frames to estimate rate; consider increasing probesize

[2024-12-18 00:46:10.559] [info]  [info] Input #0, gdigrab, from 'desktop':
  Duration: N/A, start: 1734482770.491128, bitrate: 3981337 kb/s
  Stream #0:0: Video: bmp, bgra, 1920x1080, 3981337 kb/s, 60 fps, 1000k tbr, 1000k tbn

[2024-12-18 00:46:11.649] [info]  [info] [aist#1:0/pcm_s16le @ 00000242f62f2140] Guessed Channel Layout: stereo
Input #1, dshow, from 'audio=@device_cm_{33D9A762-90C8-11D0-BD43-00A0C911CE86}\wave_{2EBD7673-1FDC-4624-B31B-E3850A00954A}':
  Duration: N/A, start: 107919.758000, bitrate: 1411 kb/s
  Stream #1:0: Audio: pcm_s16le, 44100 Hz, stereo, s16, 1411 kb/s

[2024-12-18 00:46:12.271] [info]  [info] [aist#2:0/pcm_s16le @ 00000242f6364f40] Guessed Channel Layout: stereo
Input #2, dshow, from 'audio=@device_cm_{33D9A762-90C8-11D0-BD43-00A0C911CE86}\wave_{2EBD7673-1FDC-4624-B31B-E3850A00954A}':
  Duration: N/A, start: 107920.393000, bitrate: 1411 kb/s
  Stream #2:0: Audio: pcm_s16le, 44100 Hz, stereo, s16, 1411 kb/s

[2024-12-18 00:46:12.467] [info]  [info] Stream mapping:
  Stream #1:0 (pcm_s16le) -> amerge (graph 1)
  Stream #2:0 (pcm_s16le) -> amerge (graph 1)
  ddagrab:default (graph 0) -> Stream #0:0 (h264_nvenc)
  Stream #0:0 -> #0:1 (bmp (native) -> h264 (h264_nvenc))
  amerge:default (graph 1) -> Stream #0:2 (aac)

[2024-12-18 00:46:12.469] [info]  [info] Press [q] to stop, [?] for help
There are 2 hardware devices. device cuda0 of type cuda is picked for filters by default. Set hardware device explicitly with the filter_hw_device option if device cuda0 is not usable for filters.

[2024-12-18 00:46:12.473] [info]  [info]     Last message repeated 1 times
[Parsed_amerge_0 @ 00000242f62f0340] No channel layout for input 1

[2024-12-18 00:46:12.476] [info]  [info] [Parsed_amerge_0 @ 00000242f62f0340] Input channel layouts overlap: output layout will be determined by the number of distinct input channels
[Parsed_ddagrab_0 @ 00000242f62ef140] Non-D3D11VA input hw_device_ctx
[Parsed_ddagrab_0 @ 00000242f62ef140] Failed to configure output pad on Parsed_ddagrab_0
[fc#0 @ 00000242f62e6200] Error configuring filter graph: Invalid argument
[fc#0 @ 00000242f62e6200] Task finished with error code: -22 (Invalid argument)
[fc#0 @ 00000242f62e6200] Terminating thread with return code -22 (Invalid argument)

[2024-12-18 00:46:12.482] [info]  [info] There are 2 hardware devices. device cuda0 of type cuda is picked for filters by default. Set hardware device explicitly with the filter_hw_device option if device cuda0 is not usable for filters.

[2024-12-18 00:46:13.042] [info]  [info] [vost#0:0/h264_nvenc @ 00000242fdaa6c80] [enc:h264_nvenc @ 00000242f634c280] Could not open encoder before EOF
[vost#0:0/h264_nvenc @ 00000242fdaa6c80] Task finished with error code: -22 (Invalid argument)
[vost#0:0/h264_nvenc @ 00000242fdaa6c80] Terminating thread with return code -22 (Invalid argument)

[2024-12-18 00:46:13.092] [info]  [info] [out#0/mpegts @ 00000242f62ef680] Nothing was written into output file, because at least one of its streams received no packets.
frame=    0 fps=0.0 q=0.0 Lq=13.0 size=       0KiB time=N/A bitrate=N/A speed=N/A

[2024-12-18 00:46:13.212] [info]  [info] [aac @ 00000242f6398bc0] Qavg: 116.716

[2024-12-18 00:46:13.286] [info]  [info] Conversion failed!

[2024-12-18 00:46:13.338] [info]  FFmpeg process exited with code 4294967274
[2024-12-18 00:46:13.339] [error] ffmpeg closed with error 4294967274

Thanks!

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


text:
how to do this motion blur effect using ffmpeg?
There's a super clean motion blur transition between words I've seen people do on captions that looks like this (10 sec example): https://drive.google.com/file/d/1ygbCgz61fXMk4JeCKQiImRrDlKtE6qFz/view?usp=sharing
the way people actually do this is by taking exporting a transparent video with just the captions on it, then applying a motion blur effect in capcut on the video then overlaying that video on their source video.
So I want to do the same thing in ffmpeg. I've played around with a few different settings but haven't found the right fit yet.
The settings people use on capcut are:
blur: 90
blend: 10
directions: both
speed: Twice
does anyone know the exact command + settings to achieve the same effect using ffmpeg?
I've tried doing a blend on a few frames using ffmpeg but the effect just doesn't look clean. And when I do speed and blur in my command it applies to the entire video instead of just the transition


text:
Dynamic resolution video, resolution won't be adjusted correctly after re-encode
I am recoding the live stream; many of them will adjust resolution because of PK.
For example, the resolution is 720x1280 when solo; after starting PK, the resolution becomes 900x720; after PK ends and go back to solo, the resolution becomes 720x1280 again.
These recorded video files are too big, and they are all h264, so I am trying to re-encode them to AV1 to reduce file size.
But after re-encoding, the resolution are fixed and won't be adjusted correctly like before.

For example, the original file is on the left side, and the re-encoded file is on the right side.
This video starts at 900x720, PK ends and back to solo at 00:00:06, resolution changes to 720x1280.
ffplay plays the original video file, everything seems good.
ffplay plays the re-encoded video file, after 00:00:06, the resolution still keeps 900x720 and causes graphics to stretch and cut off.
Here's the command I used:
ffmpeg -i original.flv -y -c:v libsvtav1 re-encode.mp4

I tried to re-encode using the same codec, h264, but the same problem still
ffmpeg -i original.flv -y -c:v libx264 re-encode.mp4

Have no idea how to fix this
Here's video file: https://www.mediafire.com/file/0vaxtzurwhom8bn/ReEncode_Resolution.zip/file
I expect re-encoded video file can be plays correctly in ffplay (resolution change when it needs to)


text:
error converting mov to mp4 which was created from combined mov/mp4 file sources
Created a video file from images. Added my own music. Split it into 16-second segments with ffmpeg.
Split a video from my iPhone into 1 second segments.
Put phone video bits between my video bits. Saved as MOV. All as expected.
Trying to convert MOV to MP4 using ffmpeg, it throws these errors:
Input contains (near) NaN/+-Inf
Error submitting audio frame to the encoder
Error encoding a frame: Invalid argument
Task finished with error code: -22 (Invalid argument)
Terminating thread with return code -22 (Invalid argument)
used ffprobe to get audio info
what I created
Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 129 kb/s
from my phone
Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, mono, fltp, 70 kb/s
Assuming audio mismatch is the issue.
Simplest way to make the audio formats of all 25 files match? Or is there something else amiss?


text:
Highest reslution video and fps in 2025?
Whats the cost of say 25 k video device to record in 2025 and what is highest fps renting price of such an equipment? So that we can see it in laptop screens in say 2030. Or is 4k resolution the limit of eye?
I want to consumme 2Tb cloud storage fast.


text:
Filmora Wondershare, how to change the duration of the image in the timeline
Filmora Wondershare, how do I change the duration of the image on the timeline?
Hello friends, I need help from someone who has already used this program, FILMORA, or understands how to change its settings.
When you add images to edit, and want to make a slide, the program automatically leaves each image on the timeline for 5 seconds.
I would like to change this to 3 seconds, but I can't find where to change this.
You can only change it if you click on each image and do it manually.
See the image:

I have version 8.7.0 of the program, and I know that in higher versions it is possible to make this change through the program, but I don't want to change it to higher versions, which I consider horrible and full of inutei things that only make the program confusing.
If anyone can help me, I would appreciate it.
I tried looking in the installation folder, C:\Program Files\Wondershare\Filmora
For any files that I could change, but I couldn't find them.


text:
MPC-BE Video alphabetical order
Videos in MPC-HC and MPC-BE always skips videos by alphabetical order, and never by any other sorting order, like by date. This means if Video 4 was created before video 2, it will always play video 5 next. Is there a way to fix this?


text:
After Effects replace 3d layers in existing comp from new comp
i'm using the "run script" function in After Effects to run a .jsx, it creates a new comp that contains keyframed cameras and Nulls as 3D Objects. These Cameras and Nulls come from Blender.
In my workflow i parent 3D Text, or other layers to those Nulls, now after i've changed a few positions and animations in Blender i export another jsx. After running that one again in AE it will create a new composition containing the adjusted or newly added cameras and nulls. I now want to copy these over to my old "Master" Composition, since i've got everything set up there. How can i copy and replace those new layers over, keeping my parenting, masking relationships, without creating duplicates?
Thanks in advance.
I thought about creating a script, but my understanding is far too limited in that regard.


text:
FFmpeg video-from-images with different durations, has wrong durations?
I'm creating a video from a list of images, where images should have different durations.
This works, except the images do not have the correct durations in the resulting video.
Using Linux Mint and FFmpeg version 4.4.2 or 4.5.5
To illustrate, lets create a 30 fps video with a red images for 1 second, followed by alternating green and blue images lasting 100 ms (= 3 frames) each.
Create 3 colored images:
ffmpeg -f lavfi -i color=c=red:s=1000x1000:d=1 red_image.png
ffmpeg -f lavfi -i color=c=green:s=1000x1000:d=1 green_image.png
ffmpeg -f lavfi -i color=c=blue:s=1000x1000:d=1 blue_image.png

Save this as colored_images_list.txt
file red_image.png
duration 1
file green_image.png
duration 0.1
file blue_image.png
duration 0.1
file green_image.png
duration 0.1
file blue_image.png
duration 0.1
file green_image.png
duration 0.1
file blue_image.png
duration 0.1
file green_image.png
duration 0.1
file blue_image.png

and run the command
ffmpeg -f concat -i colored_images_list.txt -r 30 -pix_fmt yuv420p test.mp4
The resulting video should contain 30 red frames, followed by 3 green frames, 3 blue frames, 3 green frames, 3 blue frames, etc.
But (as can be verified using any video editor or ffmpeg -i test.mp4 output_frame_%04d.png) it contains 29 red frames, then 4 green frame, 2 blue frames, 4 green frames, 2 blue frames, etc.
My suspicion is that the video is created at 25 fps which isn't a great fit for the 0.1 s durations (which would be 2.5 frame) and then converted to 30 fps.
The output of FFmpeg seem to support this:
  built with gcc 11 (Ubuntu 11.4.0-1ubuntu1~22.04)
  configuration: --prefix=/usr --extra-version='0ubuntu1~22.04.sav0' --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librabbitmq --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzimg --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-pocketsphinx --enable-librsvg --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
  WARNING: library configuration mismatch
  avcodec     configuration: --prefix=/usr --extra-version='0ubuntu1~22.04.sav0' --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librabbitmq --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzimg --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-pocketsphinx --enable-librsvg --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared --enable-version3 --disable-doc --disable-programs --enable-libaribb24 --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libtesseract --enable-libvo_amrwbenc --enable-libsmbclient
  libavutil      56. 70.100 / 56. 70.100
  libavcodec     58.134.100 / 58.134.100
  libavformat    58. 76.100 / 58. 76.100
  libavdevice    58. 13.100 / 58. 13.100
  libavfilter     7.110.100 /  7.110.100
  libswscale      5.  9.100 /  5.  9.100
  libswresample   3.  9.100 /  3.  9.100
  libpostproc    55.  9.100 / 55.  9.100
Input #0, concat, from 'colored_images_list.txt':
  Duration: N/A, start: 0.000000, bitrate: N/A
  Stream #0:0: Video: png, rgb24(pc), 1000x1000 [SAR 1:1 DAR 1:1], 25 fps, 25 tbr, 25 tbn, 25 tbc
Stream mapping:
  Stream #0:0 -> #0:0 (png (native) -> h264 (libx264))
Press [q] to stop, [?] for help
[libx264 @ 0x5555c7528dc0] using SAR=1/1
[libx264 @ 0x5555c7528dc0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
[libx264 @ 0x5555c7528dc0] profile High, level 3.2, 4:2:0, 8-bit
[libx264 @ 0x5555c7528dc0] 264 - core 164 r3191 4613ac3 - H.264/MPEG-4 AVC codec - Copyleft 2003-2024 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 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=18 lookahead_threads=3 sliced_threads=0 nr=0 decimate=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=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to 'test.mp4':
  Metadata:
    encoder         : Lavf58.76.100
  Stream #0:0: Video: h264 (avc1 / 0x31637661), yuv420p(tv, progressive), 1000x1000 [SAR 1:1 DAR 1:1], q=2-31, 30 fps, 15360 tbn
    Metadata:
      encoder         : Lavc58.134.100 libx264
    Side data:
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: N/A
frame=   49 fps=0.0 q=-1.0 Lsize=       5kB time=00:00:01.53 bitrate=  27.7kbits/s dup=42 drop=0 speed=4.17x
video:4kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 37.138432%
[libx264 @ 0x5555c7528dc0] frame I:5     Avg QP: 8.86  size:   257
[libx264 @ 0x5555c7528dc0] frame P:13    Avg QP:12.38  size:    49
[libx264 @ 0x5555c7528dc0] frame B:31    Avg QP:14.16  size:    41
[libx264 @ 0x5555c7528dc0] consecutive B-frames: 14.3%  0.0% 12.2% 73.5%
[libx264 @ 0x5555c7528dc0] mb I  I16..4: 100.0%  0.0%  0.0%
[libx264 @ 0x5555c7528dc0] mb P  I16..4:  0.0%  0.0%  0.0%  P16..4:  0.0%  0.0%  0.0%  0.0%  0.0%    skip:100.0%
[libx264 @ 0x5555c7528dc0] mb B  I16..4:  0.0%  0.0%  0.0%  B16..8:  0.0%  0.0%  0.0%  direct: 0.0%  skip:100.0%  L0:50.0% L1:50.0% BI: 0.0%
[libx264 @ 0x5555c7528dc0] 8x8 transform intra:0.0%
[libx264 @ 0x5555c7528dc0] coded y,uvDC,uvAC intra: 0.0% 0.0% 0.0% inter: 0.0% 0.0% 0.0%
[libx264 @ 0x5555c7528dc0] i16 v,h,dc,p: 98%  0%  2%  0%
[libx264 @ 0x5555c7528dc0] i8c dc,h,v,p: 98%  2%  0%  0%
[libx264 @ 0x5555c7528dc0] Weighted P-Frames: Y:15.4% UV:15.4%
[libx264 @ 0x5555c7528dc0] kb/s:15.59

I've found several sources (https://ffmpeg.org/ffmpeg-formats.html#image2-1 explaining to se the input frame rate using -framerate 1/30 before the -i option. but this gives me the error
$ ffmpeg -f concat -framerate 30 -i colored_images_list.txt -r 30 -pix_fmt yuv420p test.mp4
trash: Volume of file: /home
trash: Trash-dir: /home/roland/.local/share/Trash from volume: /home
trash: 'test.mp4' trashed in ~/.local/share/Trash
ffmpeg version 4.4.5-0ubuntu1~22.04.sav0 Copyright (c) 2000-2024 the FFmpeg developers
  built with gcc 11 (Ubuntu 11.4.0-1ubuntu1~22.04)
  configuration: --prefix=/usr --extra-version='0ubuntu1~22.04.sav0' --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librabbitmq --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzimg --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-pocketsphinx --enable-librsvg --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
  WARNING: library configuration mismatch
  avcodec     configuration: --prefix=/usr --extra-version='0ubuntu1~22.04.sav0' --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librabbitmq --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzimg --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-pocketsphinx --enable-librsvg --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared --enable-version3 --disable-doc --disable-programs --enable-libaribb24 --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libtesseract --enable-libvo_amrwbenc --enable-libsmbclient
  libavutil      56. 70.100 / 56. 70.100
  libavcodec     58.134.100 / 58.134.100
  libavformat    58. 76.100 / 58. 76.100
  libavdevice    58. 13.100 / 58. 13.100
  libavfilter     7.110.100 /  7.110.100
  libswscale      5.  9.100 /  5.  9.100
  libswresample   3.  9.100 /  3.  9.100
  libpostproc    55.  9.100 / 55.  9.100
Option framerate not found.

What's the solution here? how can I indicate the input frame rate should be 30 fps(thus the duration of 0.1 sec to be 3 frames)

Your suspicion is correct. The image demuxer has a default framerate of 25.
To set a framerate of 30, you will need ffmpeg 5.0+ and modify each file entry as follows:
file red_image.png
option framerate 30
duration 1


text:
HDR-10 file uploaded to YouTube keeps being changed to bt709?
Thanks to suggestions from a previous question, I was able to create my own "tone-mapper" in FCPX - add a color correction and set everything to zero, then add a Hue/Saturation and set the saturation to 0.8
See the attached screenshots, along with the original EXR which have nothing applied to them
https://youtu.be/M-tVtbg8-MM
Still trying to make YouTube recognize HDR-10 using mkvmerge on command line and according to MediaInfo this is an HDR-10 PQ file but YouTube keeps converting it to bt709.
Any suggestions would be appreciated. I have tried ffmpeg as well and MediaInfo keeps telling me that I have an HDR-10 file

Everything worked as expected. For some reason, there is a delay on the YT side and it could take from 24-48 hours for the HDR file to be present
Here is an example of waiting 24 hours for the HDR PQ file to display as an HDR:
First successful example
This is a playlist of the latest HDR PQ files


text:
ffmeg: Error message about two video streams not matching in size even though they actually do match
Here's the command I'm issuing:
ffmpeg -i orig.mkv -i compressed.mkv -filter_complex "format=gbrp,blend=all_expr='clip(B-A+128,0,255)'" -c:v libx264 -crf 18 -c:a copy -pix_fmt yuv420p diff.mkv
This is a command I've used successfully in the past to show the differences between two video streams and extract the changes caused by extra compression.
And here's the error message:
[Parsed_blend_1 @ 000001590b495e00] First input link top parameters (size 3840x1606) do not match the corresponding second input link bottom parameters (size 384x216)
[Parsed_blend_1 @ 000001590b495e00] Failed to configure output pad on Parsed_blend_1
[fc#0 @ 0000015979fba440] Error reinitializing filters!
Failed to inject frame into filter network: Invalid argument
Error while filtering: Invalid argument
[out#0/matroska @ 000001597a9bd280] Nothing was written into output file, because at least one of its streams received no packets.

Here's what mediainfo says about both .mkv files, showing that both files are 3840x1606:
PS C:\Users\kshetline\Videos> mediainfo .\orig.mkv
General
Unique ID                                : 9446412332079049372097753225719001000 (0x71B5016224D9F6BE16AAE45DF912FA8)
Complete name                            : .\orig.mkv
Format                                   : Matroska
Format version                           : Version 4
File size                                : 9.74 GiB
Duration                                 : 57 min 14 s
Overall bit rate                         : 24.3 Mb/s
Frame rate                               : 23.976 FPS
Encoded date                             : 2024-11-23 05:26:40 UTC
Writing application                      : mkvmerge v88.0 ('All I Know') 64-bit
Writing library                          : libebml v1.4.5 + libmatroska v1.7.1
Cover                                    : Yes
Attachments                              : cover.png

Video
ID                                       : 1
Format                                   : HEVC
Format/Info                              : High Efficiency Video Coding
Format profile                           : Main 10@L5@High
HDR format                               : SMPTE ST 2094 App 4, Version 1, HDR10+ Profile B compatible
Codec ID                                 : V_MPEGH/ISO/HEVC
Duration                                 : 57 min 14 s
Bit rate                                 : 24.3 Mb/s
Width                                    : 3 840 pixels
Height                                   : 1 606 pixels
Display aspect ratio                     : 2.40:1
Frame rate mode                          : Constant
Frame rate                               : 23.976 FPS
Color space                              : YUV
Chroma subsampling                       : 4:2:0 (Type 2)
Bit depth                                : 10 bits
Bits/(Pixel*Frame)                       : 0.165
Stream size                              : 9.74 GiB (100%)
Language                                 : English
Default                                  : Yes
Forced                                   : No
Color range                              : Limited
Color primaries                          : BT.2020
Transfer characteristics                 : PQ
Matrix coefficients                      : BT.2020 non-constant
Mastering display color primaries        : Display P3
Mastering display luminance              : min: 0.0050 cd/m2, max: 1000 cd/m2
Maximum Content Light Level              : 651 cd/m2
Maximum Frame-Average Light Level        : 149 cd/m2

PS C:\Users\kshetline\Videos> mediainfo .\compressed.mkv
General
Unique ID                                : 234272370250203591951773295296114907365 (0xB03F37A105851AC1E943E4E30A44D8E5)
Complete name                            : .\compressed.mkv
Format                                   : Matroska
Format version                           : Version 4
File size                                : 640 MiB
Duration                                 : 57 min 14 s
Overall bit rate                         : 1 562 kb/s
Frame rate                               : 23.976 FPS
Encoded date                             : 2024-11-23 05:26:08 UTC
Writing application                      : mkvmerge v88.0 ('All I Know') 64-bit
Writing library                          : libebml v1.4.5 + libmatroska v1.7.1

Video
ID                                       : 1
Format                                   : HEVC
Format/Info                              : High Efficiency Video Coding
Format profile                           : Main 10@L5@Main
HDR format                               : SMPTE ST 2086, HDR10 compatible / SMPTE ST 2094 App 4, Version 1, HDR10+ Profile B compatible
Codec ID                                 : V_MPEGH/ISO/HEVC
Duration                                 : 57 min 14 s
Bit rate                                 : 1 561 kb/s
Width                                    : 3 840 pixels
Height                                   : 1 606 pixels
Display aspect ratio                     : 2.40:1
Frame rate mode                          : Constant
Frame rate                               : 23.976 (24000/1001) FPS
Color space                              : YUV
Chroma subsampling                       : 4:2:0 (Type 2)
Bit depth                                : 10 bits
Bits/(Pixel*Frame)                       : 0.011
Stream size                              : 639 MiB (100%)
Writing library                          : x265 3.6+1-aa7f602f7:[Windows][GCC 13.2.0][64 bit] 10bit
Encoding settings                        : cpuid=1111039 / frame-threads=5 / numa-pools=32 / wpp / no-pmode / no-pme / no-psnr / no-ssim / log-level=2 / input-csp=1 / input-res=3840x1606 / interlace=0 / total-frames=0 / level-idc=0 / high-tier=1 / uhd-bd=0 / ref=3 / no-allow-non-conformance / repeat-headers / annexb / no-aud / no-eob / no-eos / no-hrd / info / hash=0 / temporal-layers=0 / open-gop / min-keyint=24 / keyint=240 / gop-lookahead=0 / bframes=4 / b-adapt=0 / b-pyramid / bframe-bias=0 / rc-lookahead=15 / lookahead-slices=8 / scenecut=40 / no-hist-scenecut / radl=0 / no-splice / no-intra-refresh / ctu=64 / min-cu-size=8 / no-rect / no-amp / max-tu-size=32 / tu-inter-depth=1 / tu-intra-depth=1 / limit-tu=0 / rdoq-level=0 / dynamic-rd=0.00 / no-ssim-rd / signhide / no-tskip / nr-intra=0 / nr-inter=0 / no-constrained-intra / strong-intra-smoothing / max-merge=2 / limit-refs=3 / no-limit-modes / me=1 / subme=2 / merange=57 / temporal-mvp / no-frame-dup / no-hme / weightp / no-weightb / no-analyze-src-pics / deblock=0:0 / sao / no-sao-non-deblock / rd=2 / selective-sao=4 / no-early-skip / rskip / fast-intra / no-tskip-fast / no-cu-lossless / no-b-intra / no-splitrd-skip / rdpenalty=0 / psy-rd=2.00 / psy-rdoq=0.00 / no-rd-refine / no-lossless / cbqpoffs=0 / crqpoffs=0 / rc=crf / crf=18.0 / qcomp=0.60 / qpstep=4 / stats-write=0 / stats-read=0 / ipratio=1.40 / pbratio=1.30 / aq-mode=2 / aq-strength=1.00 / cutree / zone-count=0 / no-strict-cbr / qg-size=32 / no-rc-grain / qpmax=69 / qpmin=0 / no-const-vbv / sar=1 / overscan=0 / videoformat=5 / range=0 / colorprim=9 / transfer=16 / colormatrix=9 / chromaloc=1 / chromaloc-top=2 / chromaloc-bottom=2 / display-window=0 / master-display=G(13250,34500)B(7500,3000)R(34000,16000)WP(15635,16450)L(10000000,50) / cll=651,149 / min-luma=0 / max-luma=1023 / log2-max-poc-lsb=8 / vui-timing-info / vui-hrd-info / slices=1 / no-opt-qp-pps / no-opt-ref-list-length-pps / no-multi-pass-opt-rps / scenecut-bias=0.05 / no-opt-cu-delta-qp / no-aq-motion / hdr10 / hdr10-opt / no-dhdr10-opt / no-idr-recovery-sei / analysis-reuse-level=0 / analysis-save-reuse-level=0 / analysis-load-reuse-level=0 / scale-factor=0 / refine-intra=0 / refine-inter=0 / refine-mv=1 / refine-ctu-distortion=0 / no-limit-sao / ctu-info=0 / no-lowpass-dct / refine-analysis-type=0 / copy-pic=1 / max-ausize-factor=1.0 / no-dynamic-refine / no-single-sei / no-hevc-aq / no-svt / no-field / qp-adaptation-range=1.00 / scenecut-aware-qp=0conformance-window-offsets / right=0 / bottom=0 / decoder-max-rate=0 / no-vbv-live-multi-pass / no-mcstf / no-sbrc
Default                                  : Yes
Forced                                   : No
Color range                              : Limited
Color primaries                          : BT.2020
Transfer characteristics                 : PQ
Matrix coefficients                      : BT.2020 non-constant
Mastering display color primaries        : Display P3
Mastering display luminance              : min: 0.0050 cd/m2, max: 1000 cd/m2
Maximum Content Light Level              : 651
MaxCLL_Original                          : 651 cd/m2
Maximum Frame-Average Light Level        : 149
MaxFALL_Original                         : 149 cd/m2

I have no idea where the (size 384x216) in the error message comes from, as if the width of the second video is only a tenth of its real width and the height is about 13% what it should be. When both videos are played using VLC they occupy exactly the same screen size viewed with no scaling.
I don't see any mismatched screen or pixel aspect ratio info either.

The expression used for the blend filter is same formula as used in the grainextract blend mode, but faster processing than expression.
For error about mismatched dimensions, it can not be seen as ffmpeg output was partially trimmed, but likely by guessing cover.jpg stream may get picked instead.

Wow, that was it! I'd never have guessed the stupid cover art could get picked as an input stream over the actual video. Weird!


text:
Replace object in video
New at this, currently playing with free stuff like Clipchamp and veed ai text to video.  Before I invest in more pro level software, I want to know if it can easily do the types of things I want to do.  Here's my question for one such use-case:
I have a video of a person sitting and reading a book.  They turn the page and as they do for a moment you see some of the content on the page.
I want to replace the book with a different "new" book.   I can easily get images of the front, back, and spine of the new book, as well as a page or two inside.  Is there a name for this object replacement, and/or for the technique to do it, or possible techniques if more than one technique for doing so?  What is a good (hopefully cost-effective) software that can do this relatively easily?
Similar use-case:  Someone is drinking a can of soda, and I want to replace which brand of soda they are drinking, following the movement of bringing the soda can to their lips and taking a sip.
Thanks in advance for any useful answers.

You are describing Compositing, the process of combining elements from different sources into a single video. You will need a motion graphics application to create your projects. Examples are Adobe After Effects or Apple Motion.
Compositing is created by using layers of video or still images which move independently of each other. I will describe the soda can project as it is simpler than the book project. However, both utilize the same types of elements and procedures.
In the motion graphics application you will start with a base layer consisting of your original footage. In order to isolate and replace the soda can with a different one, you have to make a traveling mask layer and a layer for the new soda can.
You can make masks directly in the compositor, or you can make them in an image editor such as Adobe Photoshop.  In either you can use selection tools to select the can, and then convert the raster selection to a vector mask. Or you can draw the vector mask directly with the Beziér curve tool. If there are fingers or parts of the person's hand blocking part of the can, your mask will have to exclude those as well.
On a new layer position the mask over the can at the beginning of the video clip. If the motion of the soda can is smooth, you can advance to the end of the video and reposition the mask layer to match the video layer. This gives you the mask's beginning and ending positions. You will probably have to make intermediate key frames on the mask layer, unless the motion is linear. At each key frame you adjust the position of the mask to follow the motion. You may have to change the properties of the motion curve to make it smooth. The motion curve is a Beziér curve with points and handles, like a vector drawing, which affect speed and direction.
If the motion of the soda can is more complex, you can use the compositor's object following function to generate the motion path. This is too complex to describe here, and differs by software platform.
Once you have your motion path and mask defined, make another layer for the new soda can. At the beginning of the video place the new image inside the mask. The new image will now follow the direction and speed of the motion mask layer, replacing the original soda can.
Once the motion and image match the original, you then render the video and encode it in a video format like .mov or .mp4. You will have many output options to match the format you require.
These concepts are the same for any compositing or motion graphics program, but the details will be different. I have experience with Adobe After Effects, so this description is based on that.

Excellent answer.   Perfect level of detail in terms of what I was looking for.  Thank you.


text:
light bulb recommendations for my youtube channel setup

I have some softboxes that use light bulbs. My goal is to have a youtube video studio.
I want to know what bulb to use and if I can use LEDs. Hopefully LEDs that change temperature colour.
Thanks!


text:
Using video to prove an alarm is flashing
I'm in a bit of an annoying problem. I know nothing about video, so sorry if I'm using wrong terminology.
I live in an apartment buliding in downtown Tel Aviv. On the ground floor of my building there's a sunglasses shop. Recently, its alarm has been going on at night, keeping me up with its incessant siren.
When it happened, I got out of bed, got dressed, and discovered the source of the alarm. I took a video of it with my Pixel 6 camera, and by "it" I mean the sunglasses store, the siren sound, and the light flashing on the alarm device that's on the outside of the store.
Today I talked about it with the manager of the alarm store. He claims that the alarm isn't his. I was going to use my damning video as proof that the alarm is indeed his. However, when I watched the video, the light didn't flash.
I suspect that because the light flashes for such a short time, it clashes with the Pixel 6's video camera framerate, making the light invisible.
In case this dispute with the store owner escalates, I want to have definite proof that his alarm's light is flashing in my videos, otherwise he might be able to claim the alarm isn't his, and I won't be able to sleep at night.
Any ideas on what I can do?

I see now that the Pixel 6's settings have an option for 60 FPS framerate. I'll try that next time and see whether it works.


text:
How these kind of coding tutorial videos can be made using ANIMATION with your face shown on screen?
I was preparing for an interview and came across this wonderful YouTube channel called Tap Academy. In their videos, the tutor's explanation is amazing, and he uses animations on a whiteboard to teach concepts. As he speaks, the animations appear, making it visually appealing (I'm unsure if these animations are pre-scripted). In my opinion it would be very difficult to prepare a script before hand (and I doubt animations are created even before the video begins).
Another YouTube channel that employs a similar approach is The Modern Coder. They are excellent at teaching git concepts using animation. The instructor demonstrates code in his editor while typing simultaneously. Whenever he wants to illustrate a concept, an animation suddenly appears on the screen, making it easy to understand.
My question is, what tools do they use to create such videos? Initially, I thought it might be PowerPoint animation, but PowerPoint may not have advanced options like displaying people on the screen and synchronizing animations with speech.
I also came across coding video tutorials on Udemy by Scott Barrett, where he explains coding using only animations without showing his face. These videos are incredibly helpful, as they allow for easy visualization of complex concepts and understanding of why and how they work. Learning to code becomes much easier with this style of videos.
After some research, I found that Adobe After Effects can be used to create such animation videos (I have no knowledge about AE), but I'm still uncertain about how the first two YouTube videos I mentioned were created using Adobe AE. Are there other tools specifically designed for creating these types of videos?
I haven't been able to find any resources on YouTube or Google that explain how to create these kinds of videos, so I would appreciate any insights on the tools and techniques used.

If you're on a Mac, Screenflow gets you a long way there: https://www.telestream.net/screenflow/overview.htm

Good to know. Thanks for your input.


text:
How to replicate ffmpeg filter during Adobe Premiere Pro 2022 export (to speed up the video without pitch distortion)
My normal process is to export a project to mp4 and then use ffmpeg to speed up the video like this:
ffmpeg -i input.mp4 -filter_complex "[0:v]setpts=PTS/1.3[v];[0:a]atempo=1.3[a]" -map "[v]" -map "[a]" output.mp4

It's super annoying for this to be 2 steps, which become especially time-consuming for long videos.
Is there a way to tell Premiere to do this during the original export?

Looks like you want a simpler version of this: https://video.stackexchange.com/q/21997/

@Gyan Yeah, maybe there is an easy way to select all clips on all tracks of a project and apply one "filter" that speeds them up while maintaining the original pitch of any associated audio).


text:
Video track hierarchy isn't allowing me to use split screen, in davinci resolve
I have 4 video clips loaded into Davinci Resolve, and my goal is to get all 4 of them to show like a grid. So I put 2 of them on separate video tracks, and was editing the zoom and position of each clip when I found that only one was showing at a time.
It turns out that for some reason, only the video clip on the highest video track (say, Video 6) is showing, and the other videos on lower number video tracks (say, Video 5) isn't showing.
Here is a screenshot to hopefully demonstrate my issue further:

The video's border is still appearing in the transform, but the video itself isn't showing.
I've done this before with other videos and have had no issues. I did multiple google searches but wasn't able to find anyone complaining of this issue. Am I missing something very simple?
If any more information is needed please let me know and I'll be glad to provide it.


text:
FFmpeg ass filter doesn't use font i choose
I created an .ass file with specified font (SF Pro Semibold) and wanted to merge with a video.
.ass file:
[V4+ Styles]
Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, OutlineColour, BackColour, Bold, Italic, Underline, StrikeOut, ScaleX, ScaleY, Spacing, Angle, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, Encoding
Style: videoaltyazi,SF Pro Semibold,75.0,&H00CDCDCD,&H0000FFFF,&H00000000,&H00000000,0,0,0,0,100,100.0,0.0,0,3,10.5,3.0,2,10,10,120,1

FFmpeg can actually detect the font either specifying the location of font or not.
PS > ffmpeg -i input.mp4 -vf ass=sub.ass:fontsdir=".\subtitle\SF-Pro-Display-Semibold.otf" output.mp4
ffmpeg version 6.0-full_build-www.gyan.dev Copyright (c) 2000-2023 the FFmpeg developers
  built with gcc 12.2.0 (Rev10, Built by MSYS2 project)
...
[Parsed_ass_0 @ 000001c267a2d180] libass API version: 0x1700000
[Parsed_ass_0 @ 000001c267a2d180] libass source: commit: 0.17.0-39-g04a208d5d200360d2ac75f8f6cfc43dd58dd9225
[Parsed_ass_0 @ 000001c267a2d180] Shaper: FriBidi 1.0.12 (SIMPLE) HarfBuzz-ng 7.0.1 (COMPLEX)
[Parsed_ass_0 @ 000001c267a2d180] Using font provider directwrite (with GDI)
[Parsed_ass_0 @ 000001c267a2d180] Added subtitle file: 'sub.ass' (2 styles, 1 events)
...
[Parsed_ass_0 @ 000001c267a2d180] fontselect: (SF Pro Semibold, 400, 0) -> SFPro-Semibold, 0, SFPro-Semibold

But subtitle font of output video is not Sf Pro Semibold. It's just look like SF Pro.
When I drag subtitle file to original video in MPC-HC, subtitle just look like what I want. I edited a screenshot in ShareX and used font I guess. Here is the comparison:

How can I use the font I want?

MPC-HC uses VSFilter to render subtitles, while FFmpeg uses Libass and you encountered a bug that wasn't known at the time and was happening because Libass was querying GDI-enumerated fonts by family name instead of full name. This behaviour on exactly this font was tracked in issue #744.
The bug was resolved in Libass version 0.17.2 (while yours was 0.17.0), so probably people won't experience it again, but if anyone somehow got here, then just update your FFmpeg to newer.


text:
ffmpeg h264 to mp4 conversion from multiple files fails to preserve in-sequence resolution changes
This will be a long post, so I thank you in advance for your patience in digesting it.
Context
I have different sources that generate visual content that eventually need to be all composed into a single .mp4 file.  The sources are:

H.264 video (encoded using CUDA NVENC).

This video can have in-sequence resolution change that is natively supported by H.264 codec.
I.e. stream may start as HxW resolution and mid-stream change to WxH. This behavior happens because it comes from a camera device that can be rotated and flipped between portrait and landscape (e.g. think of a phone camera recording video and phone being flipped from one orientation to another, and video recording adjusting its encoding for proper video scaling and orientation).
When rotation occurs, most of the time H & W are just swaps, but may actually be entirely new values -- e.g. in some cases 1024x768 will switch to 768x1024, but in other cases 1024x768 may become 460x640 (depends on source camera capabilities that I have no control over).

JPEGs.  A series (a.k.a. batch) of still JPEGs.

The native resolution of JPEGs may or may not match the video resolution in the earlier bullet.
JPEGs can also reflect rotation of device and so some JPEGs in a sequence may start at HxW resolution and then from some arbitrary JPEG file can flip and become WxH. Similar to video, resolution dimensions are likely to be just a swap, but may become altogether different values.

There can be any number of batches and intermixes between video and still sources.  E.g. V1 + S2 + S3 + V4 + V5 + V6 + S7 + ...
There can be any number of resolution changes between or within batches. e.g. V1;r1 + V1;r2 + S2;r1 + S2;r3 + V3;r2 + ... (where first subscript is batch sequence; rX is resolution)

Problem
I'm attempting to do this conversion with ffmpeg and can't quite get it right.  The problem is that I can't get output to respect source resolutions, and it just squishes all into a single output resolution.

As already mentioned above, H.264 supports resolution changes in-sequence (mid-stream), and it should be possible to convert and concatenate all the content and have final output contain in-sequence resolution changes.
Since MP4 is just a container, I'm assuming that MP4 files can do so as well?
Attempts so far
The approach thus far has been to take each batch of content (i.e. .h264 video or a set of JPEGs), and individually convert to .mp4. Video is converted using -c copy to ensure it doesn't try to transcode, e.g.:
ffmpeg -hide_banner -i videoX.h264 -c copy -vsync vfr -video_track_timescale 90000 intermediateX.mp4

... and JPEGs are converted using -f concat
ffmpeg -hide_banner -f concat -safe 0 -i jpegsX.txt -vf 'scale=trunc(iw/2)*2:trunc(ih/2)*2' -r 30 -vsync vfr -video_track_timescale 90000 intermediateX.mp4

... and then all the intermediates concatenated together
ffmpeg -hide_banner -f concat -safe 0 -i final.txt -pix_fmt yuv420p -c copy -vsync vfr -video_track_timescale 90000 -metadata title='yabadabadoo' -fflags +bitexact -flags:v +bitexact -flags:a +bitexact final.mp4

This concatenates, but if resolution changes at some mid point, then that part of content comes up squished/stretched in final output.
Use h.264 as intermediates
All the intermediates are produced the same, except as .h264.  All intermediate .h264 are cat'ed together like `cat intermediate1.h264 intermediate2.264 > final.h264.
If final output is final.mp4, the output is incorrect and images are squished/stretched.
If final.h264, then at least it seems to be respecting aspect ratios of input and managing to produce correctly looking output.  However, examining with ffprobe it seems that it uses SAR weird ratios, where first frames are width=1440 height=3040 sample_aspect_ratio=1:1, but later SAR takes on values like width=176 height=340 sample_aspect_ratio=1545:176, which I suspect isn't right, since all original input was with "square pixels".  I think the reason for it is that it was composed out of different sized JPEGs, and concat filter somehow caused ffmpeg to manipulate SAR "to get things fit".
But at least it renders respectably, though hard to say with ffplay if player would actually see resolution change and resize accordingly .
And, that's .h264; and I need final output to be .mp4.
Use -vf filter
I tried enforcing SAR using -vf 'scale=trunc(iw/2)*2:trunc(ih/2)*2,setsar=1:1' (scaling is to deal with odd dimension JPEGs), but it still produces frames with SAR like stated earlier.
Other thoughts
For now, while I haven't given up, I'm trying to avoid in my code examining each individual JEPG in a batch to see if there are differing sizes, and splitting batch so that each sub-batch is homogenous resolution-wise, and generating individual intermediate .h264 so that SAR remains sane, and keep fingers crossed that the final would work correctly. It'll be very slow, unfortunately.
Question
What's the right way to deal with all that using ffmpeg, and how to concatenate multiple varying resolution sources into a final mp4 so that it respects resolution changes mid-stream?

FFmpeg does not support writing multiple sample descriptions for a MP4 track, which is what would be required for codec parameter changes to be signaled.
FFmpeg also does not support an encoding session with resolution change except for raw uncompressed video and VP9, IIRC.
However, what you can do, is segment the input video(s) at keyframes using the segment muxer into MPEG-TS segments. Encode these segments without inserting a scaler to MPEG-TS output segments.
Similarly, generate one H264 in MPEG-TS segment for the images.
Then concat the outputs together using streamcopy and avc3 tag (-c copy -tag:v avc3). The final MP4 will have only one track sample description but a compliant decoder should come across the parameter sets at segment boundaries and reset the decoder.

if I understand you correctly, one problem was having intermediates as MP4 as it "lost some capabilities support", and instead you're suggesting that all various transitions should be h.264 segments, one for each resolution change, and only then assembled into mp4 with avc3 tag (what does this tag do?).  So my mistake in my "Use h.264 as intermediates" section is that I bunched a bunch of variable sized jpegs into one transcoding job?  Or is there something additional that MPEG-TS does as intermediate that h264 as intermediate fails at?

.h264 can also work, but you'll lose per-frame timestamp info. avc3 tells reader to expect mid-stream parameter sets.

I finally got back to this project.  I found that concatenated .h264 don't squish and retain everything properly.  The issues is introduced when final .h264 is being converted to .mp4.  I tried the -tag:v avc3 (after -c copy), but it doesn't seem to have any influence on output, and continues to have images squished.  Any thoughts on why avc3 directive might not be working?


text:
How to encode scenes with different CRF into a H.264 MP4 video with a variable frame rate?
Source Material

Having many scenes which essentially are still frames (for many seconds)
Commonly found in: Slideshows, Screen Recording or Software Mockup/Prototype

✅ This kind of source material wonderfully shrinks in file size without loosing any extra quality simply by using ffmpeg with -vf -mpdecimate -vsync vfr which decimates duplicate (=still) frames and in consequence makes a variable frame rate video from it.
But what if I have a few scenes which need more/less CFR ?

The H.264 video throughout the majority of its runtime looks totally fine at CRF 28 (lowest recommended quality)
But in the intro I slide in/out a portrait photo, which requires significantly more intra and inter frame compression as in the rest of the video (prototype of a flat design software, compresses really well).

 How do I encode my intro at CR28, and the rest at CR18, and still get a variable frame rate in my video?

TL;DR
Correct Approach

Pick up the necessary scenes of videos with ffmpeg 's time related arguments -ss in-point, -t duration and -to out-point before the -i input argument and encode each such scene with your desired CRF and with VFR (see question above) as a standalone intermediary clip.
Then -f concat your scenes (same dimension, same codec, variable framerate (inherently different!), different CRF) together and use -movflags faststart to be streaming compatible.

Full ffmpeg command lines for steps 1+2 in detail section below.

Playback of video file

From ffmpeg 5.1.2:** on macOS 11 Big Sur

✅ QuickLook, QuickTime Player  10.5, mpv 0.35.0 — Play back fine.

❌ VLC: The variant with intro and main part both having VFR does not play back fine! Audio remains in sync throughout the video. But during the intro the portrait photo slide in gets stuck along the way and then from that position slides out later, and then when the main part starts, the video stream recovers and resumes correctly.

 Maximum compatibility solution: Intro part with fixed frame rate and start with variable frame rates only in the main part.

To visually debug/inspect your resulting video files
ℹ mpv can display frame numbers in its On Screen Display

To your ~/.config/mpv/mpv.conf add the following line: osd-status-msg=${playback-time/full} / ${duration} (${percent-pos}%)\nframe: ${estimated-frame-number} / ${estimated-frame-count}
Play back your video file and press hotkey ⇧-O to toggle OSD on/off.

Wrong Approach

Encode full video with VFR once as CR18, once as CR28.
Concat intro with inpoint/outpoint from CR18, followed by main part as CR28 with inpoint being outro's outpoint.

❌ Fail: Concat's inpoint/outpoint/duration functions seem to not work correctly with VFR sources. Result:

Video track: Intro played twice. That by itself is already inacceptable.
Worse: Audio plays continously, so after the outro is out of sync.

Details
Correct Approach
Creating the intro
ffmpeg \
-to 00:06.300 \ # The intro lasts til 6secs and .300 fractions
-i VID.m4v \
\
-movflags faststart \
-c:v libx264 -preset veryslow -crf 18 \
-vf mpdecimate -vsync vfr \
\
VID-intro-CR18-vfr.mp4

Creating the main part
ffmpeg \
-ss 00:06.300 \  # The main part starts when the intro ends.
-t 30s \         # Duration limited to -t 30s (seconds) during testing. Omit for real run.
-i VID.m4v \
\
-movflags faststart \
-c:v libx264 -preset veryslow -crf 28 \
-vf mpdecimate -vsync vfr \
\
VID-main-from-intro-endpoint-for-30secs-CR28-vfr.mp4

Creating concatenation instructions
assembly.txt
file VID-intro-CR18-vfr.mp4
file VID-main-from-intro-endpoint-CR28-vfr.mp4

Running concatenation
ffmpeg -f concat -i assembly.txt -c copy -movflags faststart \
VID--intro-CR18-vfr--main-CR28-vfr.mp4

Resulting file plays back fine.
Processing throws only two "Non-monotonous DTS in output stream" warning messages.
That seems to be the timecode correction before/after the stitching point between intro and main part:
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fd44a005580] Auto-inserting h264_mp4toannexb bitstream filter
[mp4 @ 0x7fd44a007b00] Non-monotonous DTS in output stream 0:0; previous: 95589, current: 25445; changing to 95590. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7fd44a007b00] Non-monotonous DTS in output stream 0:1; previous: 278528, current: 277830; changing to 278529. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7fd44a007b00] Starting second pass: moving the moov atom to the beginning of the file
frame=  467 fps=0.0 q=-1.0 Lsize=    1898kB time=00:00:36.32 bitrate= 428.0kbits/s speed=1.04e+03x
video:1311kB audio:566kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 1.112216%

With a high probability your timecode will get some auto correction at the stitching point(s), as the cuts most likely will not occur at a keyframes but at interframes. I guess the warning message just told us that.
Wrong Approach
Concatenation instructions by copying out the scenes from full length VFR videos encoded at different CRFs
assembly.txt
file VID-CR18-vfr.mp4
inpoint 00:00
outpoint 00:06.300

file VID-CR28-vfr.mp4
inpoint 00:06.300

The resulting file has issues (see above).
The warning message "Non-monotonous DTS in output stream" occurs ~450 times for a 49min video. Exceprt (with "..." omissions):
[mp4 @ 0x7fecd573b440] Non-monotonous DTS in output stream 0:1; previous: 441344, current: 0; changing to 441345. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7fecd573b440] Non-monotonous DTS in output stream 0:1; previous: 441345, current: 1024; changing to 441346. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7fecd573b440] Non-monotonous DTS in output stream 0:1; previous: 441346, current: 2048; changing to 441347. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7fecd573b440] Non-monotonous DTS in output stream 0:1; previous: 441347, current: 3072; changing to 441348. This may result in incorrect timestamps in the output file.

...

[mp4 @ 0x7fecd573b440] Non-monotonous DTS in output stream 0:1; previous: 441364, current: 20480; changing to 441365. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7fecd573b440] Non-monotonous DTS in output stream 0:1; previous: 441365, current: 21504; changing to 441366. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7fecd573b440] Non-monotonous DTS in output stream 0:0; previous: 95077, current: -7835; changing to 95078. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7fecd573b440] Non-monotonous DTS in output stream 0:1; previous: 441366, current: 22528; changing to 441367. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7fecd573b440] Non-monotonous DTS in output stream 0:1; previous: 441367, current: 23552; changing to 441368. This may result in incorrect timestamps in the output file.

...

[mp4 @ 0x7fecd573b440] Non-monotonous DTS in output stream 0:1; previous: 441385, current: 41984; changing to 441386. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7fecd573b440] Non-monotonous DTS in output stream 0:1; previous: 441386, current: 43008; changing to 441387. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7fecd573b440] Non-monotonous DTS in output stream 0:0; previous: 95078, current: -155; changing to 95079. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7fecd573b440] Non-monotonous DTS in output stream 0:1; previous: 441387, current: 44032; changing to 441388. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7fecd573b440] Non-monotonous DTS in output stream 0:1; previous: 441388, current: 45056; changing to 441389. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7fecd573b440] Non-monotonous DTS in output stream 0:0; previous: 95079, current: 357; changing to 95080. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7fecd573b440] Non-monotonous DTS in output stream 0:1; previous: 441389, current: 46080; changing to 441390. This may result in incorrect timestamps in the output file.

...

[mp4 @ 0x7fecd573b440] Non-monotonous DTS in output stream 0:1; previous: 441773, current: 439296; changing to 441774. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7fecd573b440] Non-monotonous DTS in output stream 0:1; previous: 441774, current: 440320; changing to 441775. This may result in incorrect timestamps in the output file.
[mp4 @ 0x7fecd573b440] Non-monotonous DTS in output stream 0:1; previous: 441775, current: 441344; changing to 441776. This may result in incorrect timestamps in the output file.
frame=38540 fps=38539 q=-1.0 size=   56832kB time=00:42:38.23 bitrate= 182.0kbits/s speed=2.56e+03x  frame=44130 fps=38101 q=-1.0 Lsize=   68207kB time=00:49:27.67 bitrate= 188.3kbits/s speed=2.56e+03x
video:20486kB audio:45963kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 2.645229%


text:
Resources for making multi-perspective panoramic backgrounds?
I've been scraping the internet for this topic in general for so long and it's reeeally hard to find a lot online even though it can be so prevalent in 2d animation. There's your basic banana pans and other panoramic/curvilinear layouts that seem very straightforward to tackle in my mind, even in something more complicated like this: https://twitter.com/fmod91/status/1328751781535387649?s=20&t=90CCxSE2Dgz1FBL1iS_oPw
BUT then there is deconstructing way more complex ones of a different nature like these:
https://twitter.com/JimZub/status/1330715701796102144?s=20 video

OR: https://twitter.com/kawakami_yu/status/1577932605173174272?t=d5M3lUShkk-2gsKi0w0Vig&s=19 video

Where THESE feel way more complex and harder to wrap my head around trying to set up or even grasp the theory on how and why it works so perfectly. Is there any resources that cover this topic and if so are there any parts that specifically address THESE types where the camera seems to be moving a lot more than just a simple "nodal" pan, and how to make them? It would be such an absolute godsend


text:
Use markers in After Effects as triggers for a random color animation
How to change the color of a layer randomly in markers?


text:
Film grain in text effect - Premiere Pro
The effect I am trying to achieve has film grain inside colored texts. I was able to somewhat recreate it using Track Matte Key. But I can't get the color part to work.
Thanks!
Sample:

Mine:

Do you have a link to a video version of what you're trying to achieve? It's pretty hard to tell from a still.

https://www.youtube.com/watch?v=kAJx1TaDj3w
Here! Any of the "PART" title cards

That looks more like coloured noise and less like grain to me.  To make something similar:

The font looks to be Acuta Fat according to whatthefont.com
https://www.myfonts.com/products/fat-acuta-medium-110325
Add your text to a layer and put it on track V2.
Create a Colour Matte, choose a pinky red colour, and add it to track V1.

Add the Noise effect to the colour matte, and raise the amount of noise to 92% or so.  Make sure "Use Colour Noise" is selected.
Add a Track Matte Key effect to your colour matte clip on track V1.
For the Matte setting, make sure it is set to track V2.
Composite using Matte Alpha
Scale up the clip on V1 slightly to make the grain bigger.


text:
Ffmpeg amv conversion
I have a friend in an institution. He only has access to a SanDisk sansa clip sport mp3 player, but it has been modded to run firmware for a Ruizu X10 mp3 player.
It can display videos in amv format only, due to the weak processor.
He is converting MP4 videos on an Android phone using ffmpeg, using the following commands:
-c:v amv -c:a adpcm_ima_amv -pix_fmt yuvj420p -vf
"scale=148:128:force_original_aspect_ratio=dec reas e,crop=128:in_h:10:0,pad=160:128:32:-1:c
olor=black" -vstrict -1 -r 30 -ac 1 -ar 22050 -block_size 735
However, the video quality is poor, blurry.
We are completely new to this and don't understand the code above.
Can you guys please help tweak the code to deliver better video quality that the weak mp3 processor can still handle?
If possible, please just tell us what to type in the ffmpeg template box, because we are very new.
The command to resize the video is necessary because the firmware on the mp3 player was made for a larger screen.
Maybe 30fps is unnecessary? Not sure
Thank you all!!!

Try adding -q:v 4 -qmin 1 -qmax 16. Experiment with the q:v value.

Thanks so much. Will try. Should I also experiment with the qmin and qmax values?

qmin can't go lower. And a higher qmax is only needed in order to slightly reduce file size.

Thanks, I tried altering these -q:v values by adding "-q:v 4" to the very end of my script and trying different values. All the videos were the same file size and looked identical. Am I doing something wrong?

These are output options so they go before the output path.


text:
How to have more than one video preview in premiere pro?
So I want to have two different "Perspectives" in premiere pro. But so far on the internet I only found multi-cam editing. This won't work cause it's not a camera it's me and my friend playing games so I want to have his perspective of the game and mine at the same time so I can edit it.
I've attempted multi-cam either way. Didn't work since you can only select one camera at a time. What I want is having two different videos playing at the same time, But I don't want to crop the clips in order to fit another clip in since if I were to add effects I will also have to reposition them and resize them accordingly.

Can you explain the outcome you want to see on the screen? If you don’t want to cut between two clips and you don’t want to crop two clips on screen at once, how do you propose to show them?

I am trying to edit two clips at once. Kinda like mult icam. But it's my recording and my friend's recording. Multi cam wouldn't work cuz it need syncing or I'll only play one clip at once in multi cam

You have a few options:
1)
If the two clips are approximately in sync, you could import them both into a multi-cam sequence, then switch between "cameras" to switch between the two recordings.  This is probably the best method. If you need to tweak the sync manually before you start switching, then open the multicam sequence in the timeline first, by right-clicking the multicam clip and choose "open in timeline"
2)
Edit the conventional way - open the clips one by one in the clip editor, select the in/out points using I and O of each clip, then insert or overlay that clip into your sequence using . or ,
3)
Open two timelines at the same time, and cut clips out of one and overlay/insert them into the other using Lift and Extract (usually ; and ') then paste the clip into the other sequence.

Thanks I will try the methods. will mark as answer if it works.


text:
How to use FFMPEG with stream as an input in C#
0
I want to use FFmpeg for frame extraction with a stream as an input in C#. However, I am encountering a failure while processing files that have metadata present at the end. FFmpeg tries to read the metadata, which causes it to seek to the end of the stream. After reading the Moov atom, it is unable to seek back in the stream to extract the frames. I am actively seeking possible solutions to solve this problem. Additionally, I am wondering if there is any existing FFmpeg C# wrapper that handles this issue effectively.
This is how I was trying to use ffmpeg.exe in C#
using System.Diagnostics;
var inputArgs = "-i -";
var outputArgs = "-vcodec libx264 -crf 23 -pix_fmt yuv420p -preset ultrafast -r 20 out.mp4";

var process = new Process
{
StartInfo =
{
FileName = "ffmpeg.exe",
Arguments = $"{inputArgs} {outputArgs}",
UseShellExecute = false,
CreateNoWindow = true,
RedirectStandardInput = true
}
};

process.Start();

var ffmpegIn = process.StandardInput.BaseStream;

// Write Data
ffmpegIn.Write(Data, Offset, Count);

// After you are done
ffmpegIn.Flush();
ffmpegIn.Close();

// Make sure ffmpeg has finished the work
process.WaitForExit();


text:
Kdenlive does not seem to be leveraging proxy clips
I am trying to edit some 4K clips in Kdenlive and so I would like to use the proxy clips feature to speed up editing experience.
I have enabled the feature by default:

I've also checked that it is enabled for the project:

However, it does not look like any proxy clips are actually generated — neither when I add clips to the Project Bin, nor when I later drag them onto the timeline. Monitor navigation is still as slow as without the proxy feature enabled. Neither I can see any proxy clips on the disk in the project cache folder.
How to get the proxies to work?

Kdenlive 20.12.3
MLT 6.24.0
OS: PureOS Byzantium

You need to also tick the checkbox [x] Generate for videos larger than and set a suitable size.


text:
Insert PNG at exact position of a video, with exact duration
Insert PNG at exact position of a video, with exact duration - is it possible with FFMPEG?
If not, then may be with other software?
I have several hundreds of PNGs. Each needs to be inserted at exact position and displayed until the next PNG comes.
Time intervals between them are irregular. Some should be displayed for 10 seconds, the other - for 2 minutes etc.

Here is an example:
Overlay "01.png" after 3 seconds for a duration is 4 seconds.
Then overlay "02.png" immediately after the first image for a duration of 5 seconds.
Both images are scaled to 400x300 and positioned in the upper right corner.
The variables make the ffmpeg commands easier to understand.
# video
v=video.mp4

# image 1
i1=01.png

# image 1 start
i1_s=3

# image 1 duration in seconds
i1_dur=4

# wait after image 1 is displayed for this duration. "0" displays image 2 immediately after image 1
w1=0

# image 2
i2=02.png

# image 2 duration in seconds
i2_dur=5

# framerate
fr=25

# image width
i_w=400

# image height
i_h=300

ffmpeg \
-i "$v" -framerate $fr \
-i "$i1" -framerate $fr \
-i "$i2" -filter_complex "\
[0:v]scale=1280:720[v0];\
[1:v]fps=$fr,trim=0:$i1_dur,scale=$i_w:$i_h[i1];\
[2:v]fps=$fr,trim=0:$i2_dur,scale=$i_w:$i_h[i2];\
[v0][i1]overlay=W-w-10:10:enable='between(t,$i1_s,$i1_s+$i1_dur)'[v1];\
[v1][i2]overlay=W-w-10:10:enable='between(t,$w1+$i1_s+$i1_dur,$w1+$i1_s+$i1_dur+$i2_dur)'" -c:v libx264 -crf 18 -preset veryfast output.mp4


text:
Post Production Video Effect: How is this done?
I found a YouTube video with a post-production editing effect I'd never seen before. Could someone explain how they did this, and what software they used? Below is the link to a short Loom video.
https://www.loom.com/share/93cf81bf3892480abedcfa3c572ca0b3?sid=60e70cad-2fe3-4e6c-96f5-87bd6651d9c7
They've split the screen area to 2/3 camera and 1/3 text sidebar panel, so smoothly with text fading in. Thanks in advance!! Pavi

That looks like an effect dubbed as "Text Slider" by ArteRamgopal; he has an ~10 minute video tutorial on reproducing it in Camtasia:

 .

Many thanks, Miles Wolbe! That's exactly what I was looking for!! Super cool effect!


text:
ffmpeg command to scale, show images at exactly 130bpm
I have a sequence of images which I would like to display to some music that plays at 130bpm. I'll also need to scale down the images, which are a rather strange 2673x2151 pixels, to something that would fit inside a 1080p frame -- e.g. 1342x1080.
130BPM yields weirdness with the most common frame rates. There are 2.16666666667 (13/6) beats per second. This being the case, there doesn't seem to be an integer (i.e., non-fractional) number of frames to show each each image at the usual frame rates (24, 25, 30 fps). If I can make a movie with a frame rate of 2.16666667 frames per second, i could simply show each image for one frame. This seems like it might actually be optimal -- it would probably make a a very compact video file, right?? Question 1: can one specify fractional frame rates?
Alternatively, if we must set the frame rate to an positive integer value, 13 frames per second works if we just display each image for six frames. 13 FPS means 780 frames per minute. 780 frames divided by 130 beats means 6 frames per beat.
Finally, my images are named j1.jpg, j2.jpg, j3.jpg, etc.
Question 2: Can someone help me concoct an ffmpeg command to assemble these images, first in order, then reversed, into a video with each image lasting one beat at 130BPM? I'd like some common video format like MP4 or h264/265, something I can post to social media.
I've been trying to massage this command, which does assemble the images into a movie, but my attempts to specify a frame rate have had weird effects. E.g., doing a -r results in strange videos that change image very erratically. I think it's because there's a setpts=N/25/TB bit in there.
ffmpeg -pattern_type glob -i "j*.jpg" -filter_complex "[0]reverse[r];[0][r]concat,loop=2:250,setpts=N/25/TB,scale=1342:1080" -pix_fmt yuv420p -c:v libx264 -preset slow -b:v 3500k output_looped.mp4

Question 3: how does one specify a number of frames to repeat each image? The default is one frame per image. If we want to specify more than one frame per image, how?
Question 4: What does setpts=N/25/TB specify? I've read the docs on setpts but it's not clear to me what the three values are specifying without the option names.
Question 5: What does the 250 mean in loop=2:250? The docs on loop also don't explain what values are set when you don't supply the specific option names.

You can specify fractional frame rates.
Use
ffmpeg -pattern_type glob -framerate 130/60 -i "j*.jpg" -filter_complex "[0]scale=1342:1080,setpts=1*PTS,split=2[f][r];[r]reverse[r];[f][r]concat" -pix_fmt yuv420p -fps_mode cfr -c:v libx264 -preset slow -b:v 3500k output_looped.mp4
Change the coefficient in setpts to set frame repeat value.
P.S. option values without option names are treated as corresponding to order of option declaration, e.g. in loop=2:250 2 is value for option loop, and 250 for size. In setpts, N/25/TB is an expression and means to retime frames to be 25 fps.

Thank you for this answer. I have tried your command, but encounter an error: Unrecognized option 'fps_mode'. Error splitting the argument list: Option not found

You need ffmpeg ver 6.0 or lewer.


text:
Is there a way to combine two videos interlaced frame by frame with a single ffmpeg command?
I have two videos and I want to go through them frame by frame
taking one frame from video 1, followed by 1 frame of video 2
then the next frame of video 1, followed by the next frame of video 2.
Like depicted in the following image:

Or, if the image does not load:
Video 1: [a][b][c]
Video 2: [1][2][3]
Result:  [a][1][b][2][c][3]

The way I have done it now is by using ffmpeg to convert every
video to a series of png files on disk. Renaming them and then
combining them back into a single video:
ffmpeg -framerate 60 -i %03d.png -c:v libx265 -preset slow -crf 23 output4.mp4
Note: The input videos were each 30fps, so I selected 60fps for the output.

Is there a way to do this using ffmpeg in a single command without storing all frames on disk first?

Use the interleave filter.
ffmpeg -i video1 -i video2 -filter_complex "[0]settb=AVTB,setpts=N/30/TB[v0];[1]settb=AVTB,setpts=N/30/TB[v1];[v0][v1]interleave=n=2" out.mp4


text:
Pink and green color on overlay logo
I ran into such a problem with hls streaming, adding filters to the overlay logo, but it was smeared with pink and green stripes. Has anyone come across this.
ffmpeg -f concat -safe 0 -re -i <(for f in *.mp4; do echo "file '$PWD/$f'"; done) \ -i /opt/metal-country_ru/logo-full.png \ -filter_complex "[0:v][1:v]overlay=x=main_w-overlay_w-(main_w*0.011):y=main_h*0.02" \ -f hls -hls_time 4 -hls_playlist_type event /opt/metal-country_ru/live/stream.m3u8\

Does the overlay look like that throughout the output video?

"Does the overlay look like that throughout the output video?"
YES

Add -report and rerun for a few seconds. Verify output has the issue, and share report.

The video format should be changed to rgb by adding format=gbrp before blending, i.e. the filter_complex command should read:
[0:v]format=gbrp[a];[a][1:v]overlay=x=main_w-overlay_w-(main_w*0.011):y=main_h*0.02


text:
Why some cuts my transition is small
In most of the places my Cross Dissolve transition is of normal size, but at one place it is small size, any idea why ?
Small Size

Normal Size

Do you have enough 'spare' at the ends of the clips?

Try the beginner's tutorials: To fade you need some "material at the ends". So maybe trim the beginnings and ends, respectively.


text:
Incorrect reels colors on mobile instagram
After uploading the reels to the profile after what time (about 1 hour) the colours on the video become not very saturated. For example, the orange colour becomes almost yellow - it looks terrible. Only the first frame of the reel is in good colours.
I uploaded the same reel via an android phone and after a couple of hours the reel still looks ok - no such problem.
Does anyone have any idea what could cause something like this? Maybe some specific iOS settings?
https://instagram.com/klev.lb here's a profile with this same issue on 3 last reels and illustrates exactly the problem that I have.


text:
Trying to export from Capcut to external harddrive get error 'no access to save path'
I've googled this and can't find anyone having the same issue.
Using Capcut on a Mac, trying to export to an external hard drive.
Is there a permissions things I need to grant Capcut?


text:
How can I slow down my media time stamp in Camtasia 2023 so it is in sync with a slowed down video?
I have a Camtasia video where the main track is playing at half-speed (slo-mo). I want to have a media timestamp or clock of some kind that shows the correct amount of elapsed time. My main track is at half-speed and a plain media timestamp shows twice the actual elapsed time. How can I show the accurate elapsed time? I'm using Camtasia 2023 (Windows).

I was trying to do it the hard way. The solution is simply to:

create the video and timer running at normal speed
export it as an MP4
create a new Camtasia project and add the MP4 to the timeline
slow down the video (with the timer) to half-speed and export to mp4

The key is to produce the video with the timer and it's natively synced. Then that composite (video with timer) can be slowed down and both timer and video are slowed down together.


text:
position subtitles in the middle of the video height using ffmpeg
Assume my video resolution is 848x480. I add subtitles on the video and I want it to be positioned on the middle of the video. How to do it? (Please write a solution that can position the subtitle at video.height/3,  video.height/4 also and so on..
ffmpeg -y -i video.mp4 -filter_complex [0:v]subtitles='subtitles.srt:force_style='FontName=opensans_extrabold',fontsize=30' -c:a copy -preset superfast -y output.mp4
This command positions the subtitles at the bottom of the video. I tried using marginV=240 (half of the height) and it positions the subtitles on the top of the video
Edit: I can use Alignment=10 but I want to control the height by pixels and not always in the middle


text:
Use eq filter to half of the video
I'm trying to use an eq filler to increase the saturation of half of the video, that is, half of the screen will be changed and the other half will remain unchanged.
Example:
eq filter on half of the video screen
I was able to achieve this by using the crop and hstack filters:
ffmpeg -i input.mp4 -filter_complex \
    "[0:v]crop=iw/2:ih:0:0,eq=saturation=0.4[left];\
    [0:v]crop=iw/2:ih:iw/2:0,eq=saturation=3[right];\
    [left][right]hstack[out]" \
    -map "[out]" -c:v libx264 -threads 1 -t 5 -n "Intro\output.mp4"

However, is there a faster way to apply this filter to half of the video?


text:
How to calculate the CPU resources required to use ffmpeg to transcode a video stream
I have a SAAS software that does video transcoding using ffmpeg. The hardware is expected to have no GPU and other hardware acceleration technologies. The input video stream will have the following basic parameters: 1 video stream, full HD resolution, bitrate = 5500 kbps, h264 codec, audio codec is aac, 160 kbps. The desired output includes 3 video streams with the following parameters: - Stream 1: Full HD resolution, bitrate = 3500 kbps, h264 codec; - Stream 2: HD resolution, bitrate = 1800 kbps, h264 codec; - Stream 3: SD resolution, bitrate = 500, h264 codec. The sound is the same as the input stream, unchanged. The question is whether there is a specific calculation method or anyone has experience calculating the required hardware resources (CPU + Memory) for each 10 input streams and the requirements as I have stated?

Pass -benchmark to ffmpeg with some samples. You'll have to test it on another system to estimate what will be required, because memory and CPU usage also depends on the version of ffmpeg and its libraries as well as the contents of the video you're transcoding.
A few examples of SVT-AV1 at various presets (8, 6, and 0):
cropbox:~$ ffmpeg -benchmark -f lavfi -i "testsrc2=d=30" -c:v libsvtav1 -preset 9 -f null - 2>&1 | grep ^bench
bench: utime=20.163s stime=0.366s rtime=7.933s
bench: maxrss=163548KiB
cropbox:~$ ffmpeg -benchmark -f lavfi -i "testsrc2=d=30" -c:v libsvtav1 -preset 6 -f null - 2>&1 | grep ^bench
bench: utime=42.690s stime=0.513s rtime=18.362s
bench: maxrss=226440KiB
cropbox:~$ ffmpeg -benchmark -f lavfi -i "testsrc2=d=30" -c:v libsvtav1 -preset 0 -f null - 2>&1 | grep ^bench
bench: utime=369.513s stime=0.882s rtime=166.848s
bench: maxrss=243972KiB

So you can see that it's not just the codec or resolution, but the presets that matter too.
And for shits and grins, MPEG-1:
cropbox:~$ ffmpeg -benchmark -f lavfi -i "testsrc2=d=30" -c:v mpeg1video -f null - 2>&1 | grep ^bench
bench: utime=0.596s stime=0.059s rtime=0.303s
bench: maxrss=23408KiB


text:
ffmpeg skips first 5 secs
I'm trying to copy the first minute of an mp4 file, but getting a strange result in which I try to play the file output from ffmpeg and the first 5 secs are missing!
I have tried using the following command:
ffmpeg -i The\ Big\ Fight\ \(1972\).mp4 -ss 0 -t 30 -c copy fight.mp4

as well as this command:
ffmpeg -i The\ Big\ Fight\ \(1972\).mp4 -acodec copy -vcodec copy -ss 0 -t 00:0:30 fight.mp4

both result in the video starting to play at 05s, and nothing exisiting prior to that 05s

this command seems to work:
ffmpeg -ss 0 -i The\ Big\ Fight\ \(1972\).mp4 -to 45 -c:v copy -c:a copy newfight.mp4


text:
Why I cannot seem to get a good image in 360p Youtube?
This is a Canon M50 4K footage [manual focus] using Kit-lens, using very fast shutter speed around 1/300, ISO around 400, and Aperture f/4. (No edit just straight from the memory card)

This is another one that is better looking (flower):

Viewed at 360p it looks so terrible compared to other Youtube videos that only used smartphones.
I already tried to export with very high bit rate like 120Mb/s and even higher than that, but it does not seem to ameliorate the Youtube compression on my video.
Does wider Aperture really matter on the picture quality? even though I already set very low ISO less than 500. I can see that Thomas Vennet's video using Canon M50 looks good even in 360p, he was using wider aperture lens f2.8.
(

)


text:
How can I use if/else with FFmpeg to check if a video is portrait or landscape and execute different settings?
I'm using FFmpeg to generate previews for the videos added to my website. The site script's (KVS) built-in tools help to some extent by automatically creating previews with the following properties:

Max. duration: 15s
Offset from beginning: 10%
Offset from end: 10%
Fragments: 5 (each lasting about 3s)
Crossfade between fragments: 1s

However, I don't know how to recreate those through the FFmpeg command line, in addition to adding an if/else part that will check if the video is landscape or portrait.
If the video is landscape, the previous properties should execute and generate the preview.
If the video is portrait, I'd like to execute the previously-listed properties as well as additional ones to insert a blurred video in the background.
I'm using the following command line for that, and it generates exactly what I had in mind.
ffmpeg -i source-video.mp4 -vf split[original][copy];[copy]scale=ih*16/9:-1,crop=h=iw*9/16,gblur=sigma=20[blurred];[blurred][original]overlay=(main_w-overlay_w)/2:(main_h-overlay_h)/2 new-video.mp4

I'm also using the following flags, which I'd like to apply to the preview video regardless of orientation.
-c:v libx264 -c:a copy -movflags +faststart -preset veryfast -strict 0 -f mp4

I found several unrelated solutions on if/else but none of them really match what I'm trying to achieve and only add to the confusion.
Note: I am not using PHP, Python, or otherwise, and would like to know whether it's achievable only through the FFmpeg command line itself.


text:
Infinite Rainbow Circle Loop
I was wondering if anyone can think of a way of recreating this infinite rainbow circle loop in After Effects
https://giphy.com/gifs/loop-rainbow-unicorn-l0LIYv9tJFIVHxF5u

There's many ways to achieve this effect. I will try to propose a flexible one:
Create a new circular shape layer and choose your first color. Open the scale and add keyframes scaling the layer from 1% to 1000%. Choose the distance between your keyframes to set the speed.
Next, duplicate that layer and choose your next color. Repeat this for as many colors as you like (your example used six). If you now offset each layer a little bit by shifting it to the right (so that it starts later), starting from the lowest layer going up, you will see that the circles overlap and form these colorful circles. The more you shift the layers to the right, the thicker the rings will be.
Now, select all layers and pre-compose them. Duplicate your precomp twice and shift it to the right so that the animation continues. Timing this offset right will result in a loopable animation. Try to find two frames that look the same, set them as your IN and OUT and render the sequence. This should result in a loopable sequence.


text:
How Do I Batch Convert to Ogg Theora with FFmpeg6?
Good evening.
I'm struggling to figure out a set of ffmpeg6 commands/flags for the following scenario:
I have a large batch of 1080p 5.1ch lossless MKV's (courtesy of MakeMKV) that I want to encode to Ogg Theora specifically, downscale to 720p, 2ch audio, and both video and audio at a somewhat higher Q (quality) setting for both. Can anyone offer some direction? I am stuck on MacOS on a 2020 Intel Macbook Air, and no Linux or BSD distro can use the built in keyboard and trackpad so far as I can tell (believe me, I have tried many.) GUI tools like nch prism and miro produce poor quality, laggy video while ffmpeg6 does well, but I'd really like to encode more than one at a time. Thank you.

Use GNU Parallel for encoding more than one at a time, since libtheora is not multithreaded.
parallel ffmpeg -v 24 -i {} -c:v libtheora -q:v 7 -vf "scale=-2:720:flags=lanczos+accurate_rnd" -c:a libvorbis -q:a 5 -ac 2 {.}.ogg ::: *.mkv

Because you're using Theora, I'm guessing you want something compatible with older software that can read OGG, so I picked Vorbis for audio. This sets Theora quality to 7 (~3Mbps for a low-motion video I tested), Vorbis quality to 5 (160 kbps), downscales the video to 720p using the high-quality Lanczos rescaling algorithm, and downmixes the audio to stereo (I think this drops LFE though). All .mkv files in the current directory will be converted to .ogg files (without removing the originals).
My test with a 20 second low-motion 720p shows the following for SSIM:
| Quality | Bitrate | SSIM    |
-------------------------------
| -q:v 0  | 530k    | .940290 |
| -q:v 1  | 660k    | .952972 |
| -q:v 2  | 814k    | .963344 |
| -q:v 3  | 1025k   | .971422 |
| -q:v 4  | 1322k   | .978433 |
| -q:v 5  | 1649k   | .982819 |
| -q:v 6  | 2152k   | .986383 |
| -q:v 7  | 2983k   | .989660 |
| -q:v 8  | 3938k   | .990908 |
| -q:v 9  | 5095k   | .992417 |
| -q:v 10 | 6659k   | .993693 |

Do you have to use Theora? It's an ancient codec which has really poor compression efficiency. Almost anything will be better than it. It's not even competitive with H.264 baseline! Both Theora and Vorbis are based on ~25 year old technology. If you can use other algorithms but want to use free ones, then I would suggest AV1 for video (via libsvtav1) and Opus for audio (via libopus). In my own quick test, AV1 was only slightly slower to encode (just 10% slower) but it managed to match Theora's quality at only half the bitrate (AV1 at 1500k matched Theora at 3000k).

Try any AV1 on e.g. a 8 core 16Gb ram machine to discover how extremely slow it is. Even in ultrafast (worse quality).
The conversion speed also depends on special settings and resolution.
And yes theora is a bit of a mess with ffmpeg, in a linux bash script e.g. The confusion between ffmpeg2theora and -c:v libtheora for one. How to set the special theora settings etc...
Another thing in our messed-up formats world is the aspect. 16:9 most common today. It wouldn't be what it is if also there is a formats problem/conflict there. There is 'standard', there is 'youtube', there is 'pure'. To be sure, to avoid any banding, I choose 'pure'. True 16:9 resolutions of 1.77:1 (divide width by height and you should get 1.77endless for a rightful 16:9 resolution). Width and height should also give a round number when you divide them each by the number 8.
Examples: 640x360, 768x432, 1280x720.
Needless to say that re-inventing formats, contributing to the WWW-videoconversionconfusion, helps the sales of chips and computer manufacturers as they expect you to buy heavier and heavier machines.
If you want a modest, fast and still quality rich video file on the before mentioned 8 core 16Gb machine, I would go for something like x264 (24fps) crf 22 to 23, 640x360 (A) or x264 (24fps) crf 25 768x432 (B). Resolutions higher than the latter start making conversions slower and files bigger.
x264 A will give a speed of 25 to 27x (subme=3), B a speed of 17 to 22x (subme=3).
x265 half or a third of that speed and you will probably have to go for super- and ultrafast.
AV1, a turtle on sleeping pills.
Then there is vpx and theora...
And how to use all those formats and aaaaall their settings in code/script, e.g. with ffmpeg, in a human friendly way...


text:
First HLS segment overlapping when renditions have different framerates
I have a multi resolution m3u8 file, created from 1080p60 source file. Resolutions lower than 720p are converted to 30fps, while 720p+ stay at 60fps.
The problem is that the first segment is broken between 30 and 60fps renditions, causing an overlap, which is detected by hls.js as a gap between segments for some reason.
I have checked the segment files manually and it looks like they are fine, except for single audio frame missing between them, 60fps one has 187 'frames', while 30fps one has 186 'frames'.
Videos are segmented in separate ffmpeg runs, but using the same settings, differing only in FPS, resolution and bitrate. Source file is always the same.
Is there a way to fix this?
Thanks!

What are your encoding commands?

@Gyan it's
-async 30 -fps_mode cfr -vf \"scale=640:-2,framerate=fps=30\" -ac 2 -preset faster -crf 23 -b:a 128k -maxrate 1160k -bufsize 1600k -force_key_frames expr:if(isnan(prev_forced_n),1,eq(n,prev_forced_n+30)) -g 30 -keyint_min 30 -sc_threshold 0 -hls_time 4 -hls_list_size 0 -hls_playlist_type vod -hls_flags independent_segments+discont_start -max_muxing_queue_size 9999 -profile:v main -pix_fmt yuv420p -fflags +genpts -r 30 - it's the same for 60fps, just with different resolution and 30 gets replaced by 60


text:
How to KEEP PIXELS when exporting my video?
I’m making a pixel art video, so I definitely want hard edges on pixels. However, Premiere Pro likes blurring them all when I export the video (and also some in preview). Moreover, I have a Pixel font as well.
My Pixels Sprites are sized for a 640x480 screen size.
Now, look at the image below. Do you see those shadows around “SCH”, “LV 1” and “HP”? They are awful. Do you see that red ribbon? Well, it looks different from the original one (second photo below). Do you see that ugly yellow shadow on the health bar? Horrible! On the other hand, the feet on the top are totally ok.

The texts have not been scaled up and the yellow bar was made in Premiere Pro itself with the Rectangle tool.
What did I try?

AVI Uncompressed UYVY 422 8bit

AVI Codec Intel IYUV

H.264

And I can’t see any noticeable difference. Maybe H.264 is the worse. I’m using 2018 Premiere Pro. It’s the first time that I tried to make a pixel art animation and I really do not know which export settings to pick. Actually, I have the same problem even in preview (except for the red ribbon, which looks great). Many thanks to the ones are gonna help me :slightly_smiling_face:
Note: I've already checked https://www.reddit.com/r/premiere/comments/6awbo7/help_how_to_fix_blurry_titles_with_pixel_font/
https://www.reddit.com/r/premiere/comments/h09mnu/premiere_wont_export_pixel_perfect_even_if/
Here's a suggestion I got:

You’re seeing the effects of chroma sub sampling. Export your video
to a video with 4:4:4 subsampling, such as ProRes 4444 or QuickTime
Animation. Upscale it in another application 2x, 4x, 8x etc using
nearest neighbour scaling.


text:
Make sound settings created by ffmpeg apply to entire Windows applications
The recording sound of my microphone is weak, so I resorted to using ffmpeg to add a volume increase effect and some other effects. I created a simple batch file and recorded the sound with it, and it works very well. This is the batch file code:
ffmpeg -f dshow -i audio="Microphone (USBAudio2.0)" -channels 1 -af " stereotools=level_in=2 , afftdn=nf=-25 , volume=10 " Output.wav

But the problem occurs when I want to make calls or use the microphone in Windows applications, the recording is very weak. Is there a way to make the ffmpeg effects that are in the batch file apply to all system applications, and how can that be done?
I searched and found that I have to create a virtual microphone device with some programs and make it the main microphone for the system. I tried these programs, but there was no option to add ffmpeg codes or pass the audio through the batch file that I created earlier.

You are focusing on the wrong thing - sort out your microphone levels and the problem is solved. Don't use ffmpeg as a kludge to fix a very basic issue.

I raised the volume levels on my microphone to the highest level, but the recording still sounded weak. I also prefer ffmpeg because it gives me more freedom to adjust the audio settings.

raising volume levels on the mic is not the solution I was suggesting. Your mic appears to be the problem - get a better mic and audio interface. Nothing else will help if those aren't sorted.


text:
How to tell ffmpeg -ss and -to to cut at keyframes (no re-encoding)
From a video, I want to clip out a part I like. It's roughly from 12:34 to 43:21, so I do:
ffmpeg -i "input.mp4" -ss 12:34 -to 43:21 -c copy "output.mp4"

The result is cut exactly at those timestamps, not at keyframes, so I get a few seconds of audio with frozen image at both ends.
How do I tell ffmpeg to cut at closest keyframes?
I've tried putting -ss in front, like -ss 12:34 -i "input.mp4", this does start the clip at a keyframe, but it makes 12:34 the new 00:00, so -to won't work the same. Now I need to manually calculate the duration of my clip and put the duration after -to, but the calculation is too hard to be the best solution.
The official wiki suggests using -copyts to maintain the original timestamps, but it messes up the timeline, and the progress bar in the player shows a wrong total video length.
There's also a -noaccurate_seek flag which sounds like what I need, but is actually not what it sounds.
(In case it matters, I'm using ffmpeg v6.0, input v=AVC and a=AAC)


text:
Should this audio file have ogg or opus as file name extension?
bash $ mediainfo myaudio.opus
General
Complete name                            : /Users/qaz/myaudio.opus
Format                                   : Ogg
File size                                : 3.52 MiB
Duration                                 : 3 min 48 s
Overall bit rate                         : 129 kb/s
Writing application                      : Lavf60.3.100

Audio
ID                                       : 4122949963 (0xF5BF394B)
Format                                   : Opus
Duration                                 : 3 min 48 s
Channel(s)                               : 2 channels
Channel layout                           : L R
Sampling rate                            : 48.0 kHz
Compression mode                         : Lossy
Writing library                          : Lavf60.3.100
Language                                 : English

Should I keep it as myaudio.opus or is it better to rename it as myaudio.ogg?