text:
How to convert a 720° ".ts" video recorded with an AllieCam360?
I have an AllieCam camera to record 720 videos 360x2 lenses.
The format it use is .ts and the program requires you to login online. Now the manufacturers drop the business and the web site is offline.
How can I now convert the videos to mp4?
I tried a lot of converters but no one solve the problem. If one of them managed to convert to mp4 then I only obtained a sphere with half of the video.

Your link is broken.

FFmpeg can see both views as separate video streams.
You can remux the file to MP4 simply by using
ffmpeg -i input.ts -c copy -map 0 output.mp4

Hopefully, your video editor can work with distinct streams, else they will need to be combined in some way.

Thank you very much for your answer,, The code that you give me, convert the file in to an .mp4 file, but still show only the sphere not the video uncompressed, that is supposed to be wider in 4k resolution
I don´t have an idea of How they do that, I mean why I only can see one side of the camera and not both sides?

I solved to extract the two videos with the following lines:
ffmpeg -i input.ts -map 0:2 -map 0:0 -c copy output.mp4     (this for the front video
ffmpeg -i input.ts -map 0:2 -map 0:1 -c copy output.mp4     (this for the rear video)
Thank you Gyan you give the clue


text:
How to concatenate MPEG-4 and AVC/h.264?
I would like to use ffmpeg, mencoder or still something free.
I cannot concatenate two videos because of different video codecs:
$ mkvmerge -o merged.mkv 1.mkv \+ 2.mp4
mkvmerge v19.0.0 ('Brave Captain') 64-bit
'1.mkv': Using the demultiplexer for the format 'Matroska'.
'2.mp4': Using the demultiplexer for the format 'QuickTime/MP4'.
'1.mkv' track 0: Using the output module for the format 'MPEG-4'.
'1.mkv' track 1: Using the output module for the format 'AAC'.
'2.mp4' track 0: Using the output module for the format 'AVC/h.264'.
'2.mp4' track 1: Using the output module for the format 'AAC'.
No append mapping was given for the file no. 1 ('2.mp4'). A default mapping of 1:0:0:0,1:1:0:1 will be used instead. Please keep that in mind if mkvmerge aborts with an error message regarding invalid '--append-to' options.
Error: The track number 0 from the file '2.mp4' cannot be appended to the track number 0 from the file '1.mkv'. The formats do not match.

Output of ffmpeg -i 1.mkv -i 2.mp4 :
ffmpeg version 3.4.2-2 Copyright (c) 2000-2018 the FFmpeg developers
  built with gcc 7 (Ubuntu 7.3.0-16ubuntu2)
  configuration: --prefix=/usr --extra-version=2 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --disable-stripping --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --enable-librsvg --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared
  libavutil      55. 78.100 / 55. 78.100
  libavcodec     57.107.100 / 57.107.100
  libavformat    57. 83.100 / 57. 83.100
  libavdevice    57. 10.100 / 57. 10.100
  libavfilter     6.107.100 /  6.107.100
  libavresample   3.  7.  0 /  3.  7.  0
  libswscale      4.  8.100 /  4.  8.100
  libswresample   2.  9.100 /  2.  9.100
  libpostproc    54.  7.100 / 54.  7.100
Input #0, matroska,webm, from '1.mkv':
  Metadata:
    encoder         : libebml v1.3.5 + libmatroska v1.4.8
    creation_time   : 2018-05-21T03:04:06.000000Z
  Duration: 00:00:34.42, start: 0.000000, bitrate: 9455 kb/s
    Stream #0:0: Video: mpeg4 (Simple Profile) (FMP4 / 0x34504D46), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], 59.94 fps, 59.94 tbr, 1k tbn, 60k tbc (default)
    Metadata:
      BPS             : 9319990
      BPS-eng         : 9319990
      DURATION        : 00:00:34.417000000
      DURATION-eng    : 00:00:34.417000000
      NUMBER_OF_FRAMES: 1758
      NUMBER_OF_FRAMES-eng: 1758
      NUMBER_OF_BYTES : 40095766
      NUMBER_OF_BYTES-eng: 40095766
      _STATISTICS_WRITING_APP: mkvmerge v19.0.0 ('Brave Captain') 64-bit
      _STATISTICS_WRITING_APP-eng: mkvmerge v19.0.0 ('Brave Captain') 64-bit
      _STATISTICS_WRITING_DATE_UTC: 2018-05-21 03:04:06
      _STATISTICS_WRITING_DATE_UTC-eng: 2018-05-21 03:04:06
      _STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
    Stream #0:1: Audio: aac (LC), 48000 Hz, stereo, fltp (default)
    Metadata:
      BPS             : 128301
      BPS-eng         : 128301
      DURATION        : 00:00:34.410000000
      DURATION-eng    : 00:00:34.410000000
      NUMBER_OF_FRAMES: 1613
      NUMBER_OF_FRAMES-eng: 1613
      NUMBER_OF_BYTES : 551855
      NUMBER_OF_BYTES-eng: 551855
      _STATISTICS_WRITING_APP: mkvmerge v19.0.0 ('Brave Captain') 64-bit
      _STATISTICS_WRITING_APP-eng: mkvmerge v19.0.0 ('Brave Captain') 64-bit
      _STATISTICS_WRITING_DATE_UTC: 2018-05-21 03:04:06
      _STATISTICS_WRITING_DATE_UTC-eng: 2018-05-21 03:04:06
      _STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
      _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
Input #1, mov,mp4,m4a,3gp,3g2,mj2, from '2.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf57.83.100
  Duration: 00:00:55.74, start: 0.000000, bitrate: 44754 kb/s
    Stream #1:0(und): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuvj420p(pc, smpte170m/bt709/bt709), 1280x720, 44627 kb/s, SAR 1:1 DAR 16:9, 59.92 fps, 59.94 tbr, 16k tbn, 32k tbc (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #1:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 128 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
At least one output file must be specified

@LordNeckbeard take a look, please.

concat filter
Use the concat filter:
ffmpeg -i 1.mkv -i 2.mp4 -filter_complex "[0:v][0:a][1:v][1:a]concat=n=2:v=1:a=1[v][a]" -map "[v]" -map "[a]" output.mp4

In your case it should work without needing any additional filters because the inputs match parameters such as width, height, stream types, etc.
concat demxuer
Alternatively you could re-encode one segment to match parameters of the other then concatenate using the concat demuxer. Advantage is that one segment can avoid re-encoding unlike the concat filter. Disadvantage is that you have to properly match formats and parameters for it to work and it will require multiple steps.
ffmpeg -i 1.mkv -c:v libx264 -vf format=yuvj420p -c:a copy 1b.mp4
ffmpeg -f concat -i inputs.txt -c copy output.mp4

Contents of inputs.txt:
file "1b.mp4"
file "2.mp4"

Also see FFmpeg Wiki: Concatenate.

source: Stack Exchange

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

sort: votes


text:
Using FFmpeg -lavfi to calculate the SSIM of each frame
I would like to be able to take a single video, run it through ffmpeg, and have it spit out a log containing the SSIM of each frame with respect to the previous - that is, I want the SSIM scores comparing the previous frame to the current one.
I am attempting to do so by running ffmpeg with the same video input twice, with the second input skipping ahead by one frame.
ffmpeg -i .\a.mp4 -i .\a.mp4 -filter_complex "[1:v]select=gte(n\,1)[f]" -map 0:v:0 -map "[f]" -lavfi ssim -f null -

When attempting to run this, I am given the error:
Cannot find a matching stream for unlabeled input pad 1 on filter Parsed_ssim_0

Is there a way I can correct this so that the second input skips one frame and both are run through -lavfi ssim?

You have to perform all filtering in a single filtergraph.
ffmpeg -i .\a.mp4 -i .\a.mp4 -filter_complex "[0:v]setpts=N/FR/TB[v0];[1:v]select=gte(n\,1),setpts=N/FR/TB[v1];[v0][v1]ssim=f=stats.log" -f null -

ffmpeg says  Filter setpts has an unconnected output is this normal?

No see edited answer

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


text:
Some GIFs do not loop properly when converted to WEBM with FFmpeg
I have a collection of seamlessly-looping GIF images that I am trying to convert to VP9(WEBM) to cut down on filesize. A majority of these GIFs convert with no problem, and the resulting WEBM files are seamless as well. However, there are some GIF images that do not seamlessly loop after being converted, almost as if some frames are cut from the output.
I am using the following arguments to convert the GIFs to WEBMs (note: although the CRF/bitrate are set very high, yet the resulting file sizes are still way smaller):
ffmpeg -i in.gif -c:v libvpx-vp9 -b:v 10M -crf 0 out.webm -y

After some experimentation, I think the problematic GIF files are utilizing tricks to give the illusion of seamless looping, such as transparency. The following arguments fix the looping issue, but screw up the colors (in VLC it looks fine, but when Google Chrome plays the WEBM a greenish hue is visible, as if it's only displaying one of the YUV channels):
ffmpeg -i in.gif -c:v libvpx-vp9 -b:v 10M -crf 0 -filter_complex "[0:v] scale=-1:-1:flags=lanczos,split [a][b]; [a] palettegen=reserve_transparent=on:transparency_color=000000 [p]; [b][p] paletteuse" out.webm

Is there a set of parameters that will convert GIF to WEBM and guarantee that the looping will remain seamless?
Here is an example of one of the source GIFs.

Can you provide one of these GIF files?

@llogan Here is an example. As a gif, it loops seamlessly. Using the first set of arguments, it does not. Using the third set of arguments, it does, but viewing in certain applications displays it in weird colors.


text:
Does using an S-Video output via a SCART connector improve the output quality of a VCR?
This answer reports that in order not to lose quality when digitizing VHS one should use an S-Video cable.
My VCR is a Sharp VC-M401SM and does not have any S-Video output nor a composite output. Instead it has a scart video/audio line.
Question: If I use an adaptor like the following together with an S-Video cable can I obtain a better quality than using the same adapter with a composite cable? Why? Does the answer depend on the tape quality (VHS or S-VHS)?

The answer is probably no, unless the SCART socket on your VCR is labeled specifically as "S-VIDEO". The fact that SCART connector has S-Video pins does not guarantee that your VCR provides S-Video signal to these pins. A low-end model will simply transmit a composite signal over the luminance S-Video pin and nothing over the chrominance pin.
Even my DVD player having both S-Video and SCART sockets doesn't provide S-Video signal over SCART. Only component RGB.

Yes, using the S-Video output of the SCART breakout will give you better quality than if you use the composite output of the same breakout. (You can get even better quality if you use a different SCART breakout that has RGB outputs.)
NTSC and PAL composite signals sacrifice the amount of data about the brightness and color of the scene for the sake of squishing it all together on one easy to use wire. S-Video separates the black and white (luminance) from the color (chrominance) signals, removing some blurring introduced in a composite signal. Using RGB outputs further improves quality by eliminating the bandwidth limitations of combining the three color signals into one.
The improvements will be more noticeable when you are using an S-VHS source because S-VHS has a higher luminance bandwidth than VHS. But you will still have some possibly subtle improvements with VHS, too. The way a VHS tape stores the signal is slightly different (color-under) than NTSC or PAL, so there is some extra loss converting for output to composite compared to converting to S-Video.
(Video Engineering is a solid, highly technical reference for older media technology.)

You said that using a SCART breakout with RGB outputs gives you an even better output quality. With a brief research on the internet I wasn't able to find any video grabber for digitizing VHSs with RGB inputs. All of them seem to have only the composite input and the S-Video input. Why?

Consumer grade tape equipment doesn't have RGB output. S-VHS is Y/C encoded, so to get a RGB signal you'd have to decode it, which is normally done by the screen. An S-Video output will give you the best quality you could hope for from S-VHS. There might be some advantage for VHS because you won't get any electrical interference from the cable, but most S-VHS players I've used only output a composite signal if you put in a standard VHS tape.

I think that RGB digitisers don't exist because the only tape machines that produce RGB signals were high-end specialised post production machines. Or are you talking about component (Y-pR-pB) when you say RGB?

@stib since I'm in the US, I really haven't encountered SCART in practice, so I can only go off the documentation, which shows RGB pins. The wikipedia article mentions some manufacturers using those pins for HD color difference signals. And while I was speaking hypothetically about component being higher quality than S-Video, I agree that it is highly unlikely to find something capable of handling it.

Yeah, I think the RGB pins are for digital equipment like set-top boxes and so on. I think they also get used for the S-video and component signal too, but I'm from Australia so my working knowledge of scart is similarly limited. I think if you search for 'scart component converter' you'll get better results — here's the first page from my duckduckgo search, they have several: https://www.selby.com.au/cables/scart-cables/to-component.html You'd need something like the BlackMagic Intensity to digitise it, once you go compnent the price increases a bit.


text:
What format should I use to archive video issued from mini DV tapes?
I want to convert and archive movies captured with mini DV tapes. Videos are family movies.
Native format in dvvideo is huge (about 220 MB/min).
So I am willing to accept video compression but I want to keep the possibility of video montage afterwards.
I am looking for a interoperable and durable video format.
So far my searches have me led to :

H264 (default crf:23 - typical values 18 to 28)
H265 (default crf:28 - typical values ...)

I am looking for recommandation for the video format and constant rate factor (crf) to use, and any return of experience.
Thanks for your advices.
Documentation:

A CRF Guide
WP: Comparison of video codecs

Hard drives are cheap. I would not convert DV videos, but would store as is. If you insist on converting, I would at least deinterlace them using the best tools available running at the best quality setting, so as not to burden your editing system with deinterlacing and to achieve the best result possible.

The authoritative answer on this will be from museums, library sciences, and historic preservation societies.  You want something you'll be able to read in the future, so open standards are more reliable than proprietary ones.  Bit rot is real, so you'll need something that's resistant to errors.  Storage cost goes down over time, and compression algorithms get more advanced with time, it's best to archive in an uncompressed format.  Native formats always seem huge now, but you'll laugh at what seemed huge in just a few years.  H.26x is a bad choice.

4:3 25 fps interlaced rectangular pixel 720x576 PAL .dv to 50 fps progressive 768x576 square pixel H.265 .mp4 (bob deinterlace, scale 788x576, crop 768x576, H.265, CRF18, slow, timecode, hvc1, AAC):
ffmpeg -i input.dv -vf bwdif=1,scale=788:576,crop=768:576:10:0,setsar=sar=1/1 -c:v libx265 -crf 18 -preset slow -timecode 00:00:00:00 -tag:v hvc1 -c:a aac -b:a 128k output.mp4

The same as a batch:
for i in *.dv; do ffmpeg -i "$i" -vf bwdif=1,scale=788:576,crop=768:576:10:0,setsar=sar=1/1 -c:v libx265 -crf 18 -preset slow -timecode 00:00:00:00 -tag:v hvc1 -c:a aac -b:a 128k "${i%.*}_converted.mp4"; done

That is slightly too good quality for most input so you might do it somewhat faster with '-crf 28 -preset medium' defaults. But some of my source material needed that.
Essentially the same for 4:3 NTSC .dv:
ffmpeg -i input.dv -vf bwdif=1,scale=648:480,crop=640:480:4:0,setsar=sar=1/1 -c:v libx265 -crf 18 -preset slow -timecode '00:00:00;00' -tag:v hvc1 -c:a aac -b:a 128k output.mp4

for i in *.dv; do ffmpeg -i "$i" -vf bwdif=1,scale=648:480,crop=640:480:4:0,setsar=sar=1/1 -c:v libx265 -crf 18 -preset slow -timecode '00:00:00;00' -tag:v hvc1 -c:a aac -b:a 128k "${i%.*}_converted.mp4"; done

Matti

Thanks for this detailed answer. Could you elaborate on how you derived these settings? Have you some feedback on the crf coefficient?

I grabbed a few samples from my .dv footage and ran ffmpeg tests with different options. -crf 18 was needed for some poorly lit clips so I ran it for all footage. bwdif=1 was the best double frame rate bob deinterlacer filter. I wanted this to be a one-time project so I used -preset slow and let ffmpeg batch run for a few days and nights. Then edited output .mp4 metadata with exiftool. Rectangular to square pixel calculations from https://web.archive.org/web/20140218044518/http://lipas.uwasa.fi/~f76998/video/conversion/

I think that your choose are good.
H264 will be a bit huge in compare with H265, but will be supportable for more devices at this moment.
CRF you can get experimentally. Less CRF is better quality but bigger size of the file.
Also you can use bitrate settings instead of CRF.
You can Focus on data from video recommendations for YouTube - https://support.google.com/youtube/answer/1722171?hl=en
I use approx 8Mbit/s for 1080p, 5Mbit/s for 720p and 1-2 Mbit/s for 480p.
If you need a good quality for video editing and all the videos were recorded on a good camera and you want to do color grading with your videos you can save them in Apple ProRes or Cinegy Daniel 2 or another losless or low compression codec.

Converting to ProRes or Daniel will take up as much room as just copying the DV stream, and won't improve the result. Buy a portable harddrive — even a cheap portable hard drive should be able to keep up with DV speeds these days, it's only 25Mbs

@stib you should turn this into an answer

@stib Daniel2 codec is lossless, but it have compession and it will take less space on the drive, but work with uncompressed material will be good too, I agree with you. But it will work good for DV.
1 minute of uncompressed 1920x1080 video will take as much space as 1 hour of NTSC DV video. Approx.


text:
USB Webcam not working with USB Microphone
I have two USB devices: a webcam and a microphone.  I can play the webcam's video into VLC and GUVCView. However, I want to use the microphone for another application. The issue is that launching media capture with VLC or GUVCView blocks the microphone.
For instance, running the following before launching VLC/GUVCView:
arecord -vvv -f dat /dev/null

Shows what the microphone picks up. If I launch VLC first with the following command (webcam is on video0):
vlc v4l2:///dev/video0

And then monitor the microphone with the previously shown arecord command, I get nothing. It is the same behavior with GUVCView.
Doing the opposite, launching arecord before VLC, however shows the issue. I only get part of the webcam's image (like the few first lines of the image). Dropping the camera resolution shows more lines in the webcam's image.
It looks like I don't have enough USB bandwidth for both the webcam and the microphone. However, typing lsusb -t show that I have USB 2.0, which supports 480Mbps, and that the webcam only pulls 12Mbps.

I think I found the issue. One of the device is USB 1.1, and this causes the whole hub to fall down to USB 1.1 to accommodate it. I saw it using lsusb -v.
USB 1.1 has a max bandwidth of 12Mbps, hence the reading I get with lsusb -t. I'll need to either replace the USB 1.1 device for a USB 2.0 device, or plug in a second USB card directly in the motherboard.


text:
How to use ffmpeg to replace a specific color with another color
I am trying to replace an arbitrary color in a video with another arbitrary color. In this case I want to replace #72f3f2 (rgb(114,243,242)) with #7ccbd4 (rgb(124,203,212)) in a video file using ffmpeg.
I have tried using the lutrgb filter below which I derived from this question, but it seems to have no effect.
How can I only replace the entire set of one RGB value with another?
$ ffmpeg -i in.mp4 -vf "format=rgb24,lutrgb=r='if(eq(val,45),49,val)':g='if(eq(val,95),80,val)':b='if(eq(val,95),83,val)'" -vcodec libx265 out.mp4
ffmpeg version 4.2.2-static https://johnvansickle.com/ffmpeg/  Copyright (c) 2000-2019 the FFmpeg developers
  built with gcc 8 (Debian 8.3.0-6)
  configuration: --enable-gpl --enable-version3 --enable-static --disable-debug --disable-ffplay --disable-indev=sndio --disable-outdev=sndio --cc=gcc --enable-fontconfig --enable-frei0r --enable-gnutls --enable-gmp --enable-libgme --enable-gray --enable-libaom --enable-libfribidi --enable-libass --enable-libvmaf --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librubberband --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libvorbis --enable-libopus --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libdav1d --enable-libxvid --enable-libzvbi --enable-libzimg
  libavutil      56. 31.100 / 56. 31.100
  libavcodec     58. 54.100 / 58. 54.100
  libavformat    58. 29.100 / 58. 29.100
  libavdevice    58.  8.100 / 58.  8.100
  libavfilter     7. 57.100 /  7. 57.100
  libswscale      5.  5.100 /  5.  5.100
  libswresample   3.  5.100 /  3.  5.100
  libpostproc    55.  5.100 / 55.  5.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'in.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2mp41
    encoder         : Lavf58.29.100
  Duration: 00:00:30.00, start: 0.020000, bitrate: 2400 kb/s
    Stream #0:0(und): Video: hevc (Main) (hvc1 / 0x31637668), yuv420p(tv, bt709), 2000x1126 [SAR 1:1 DAR 1000:563], 2324 kb/s, 29.97 fps, 29.97 tbr, 90k tbn, 29.97 tbc (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 143 kb/s (default)
    Metadata:
      handler_name    : Stereo
File 'out.mp4' already exists. Overwrite ? [y/N] y
Stream mapping:
  Stream #0:0 -> #0:0 (hevc (native) -> hevc (libx265))
  Stream #0:1 -> #0:1 (aac (native) -> aac (native))
Press [q] to stop, [?] for help
x265 [info]: HEVC encoder version 3.3+2-dd2464df2f40
x265 [info]: build info [Linux][GCC 8.3.0][64 bit] 8bit+10bit+12bit
x265 [info]: using cpu capabilities: MMX2 SSE2Fast LZCNT SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
x265 [warning]: halving the quality when psy-rd is enabled for 444 input. Setting cbQpOffset = 6 and crQpOffset = 6
x265 [info]: Main 4:4:4 profile, Level-5 (Main tier)
x265 [info]: Thread pool created using 8 threads
x265 [info]: Slices                              : 1
x265 [info]: frame threads / pool features       : 3 / wpp(18 rows)
x265 [info]: Coding QT: max CU size, min CU size : 64 / 8
x265 [info]: Residual QT: max TU size, max depth : 32 / 1 inter / 1 intra
x265 [info]: ME / range / subpel / merge         : hex / 57 / 2 / 3
x265 [info]: Keyframe min / max / scenecut / bias  : 25 / 250 / 40 / 5.00
x265 [info]: Cb/Cr QP Offset                     : 6 / 6
x265 [info]: Lookahead / bframes / badapt        : 20 / 4 / 2
x265 [info]: b-pyramid / weightp / weightb       : 1 / 1 / 0
x265 [info]: References / ref-limit  cu / depth  : 3 / off / on
x265 [info]: AQ: mode / str / qg-size / cu-tree  : 2 / 1.0 / 32 / 1
x265 [info]: Rate Control / qCompress            : CRF-28.0 / 0.60
x265 [info]: tools: rd=3 psy-rd=2.00 early-skip rskip signhide tmvp b-intra
x265 [info]: tools: strong-intra-smoothing lslices=7 deblock sao
Output #0, mp4, to 'out.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2mp41
    encoder         : Lavf58.29.100
    Stream #0:0(und): Video: hevc (libx265) (hev1 / 0x31766568), gbrp, 2000x1126 [SAR 1:1 DAR 1000:563], q=2-31, 29.97 fps, 30k tbn, 29.97 tbc (default)
    Metadata:
      handler_name    : VideoHandler
      encoder         : Lavc58.54.100 libx265
    Side data:
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 128 kb/s (default)
    Metadata:
      handler_name    : Stereo
      encoder         : Lavc58.54.100 aac
frame=  901 fps= 15 q=-0.0 Lsize=    6979kB time=00:00:29.99 bitrate=1906.1kbits/s dup=32 drop=0 speed=0.492x
video:6470kB audio:472kB subtitle:0kB other streams:0kB global headers:2kB muxing overhead: 0.524252%
x265 [info]: frame I:      6, Avg QP:27.55  kb/s: 9044.56
x265 [info]: frame P:    222, Avg QP:29.70  kb/s: 5202.73
x265 [info]: frame B:    673, Avg QP:35.37  kb/s: 562.33
x265 [info]: Weighted P-Frames: Y:6.8% UV:6.8%
x265 [info]: consecutive B-frames: 4.8% 4.4% 3.5% 65.4% 21.9%

encoded 901 frames in 60.78s (14.82 fps), 1762.18 kb/s, Avg QP:33.93
[aac @ 0x62b24c0] Qavg: 260.747

I've tried using RGB percent values (0-100) and RGB decimal values, as well as lutyuv filter to no avail.

How did you identify the source color values?

@Gyan taking a screenshot of one of the frames from in.mp4 and then using the color picker in e.g. Photoshop

Try lutyuv filter instead of lutrgb?
Refer to:
https://ffmpeg.org/ffmpeg-filters.html#toc-lut_002c-lutrgb_002c-lutyuv


text:
Davinci Resolve 16: Need to restore timeline to original aspect ratio
I'm new to DR and was trying out some different aspect ratios on one of my timelines. Somehow I messed thing up and now can't seem to get back to the original aspect ratio 1.66. attached is a screenshot of my situation. I have attempted every way of changing it back, but can't seem to make it work.  Using Mac with Catalina.
Grateful for any assistance that you are able to give me.
![Now when I drag a clip (any clip) into the time line, it comes in like this.On their own clips are fine.
]2

The clip you show has the Tools selected and Dynamic Zoom selected. Hence the Red and Green boxes. To return the view to normal - you can just click the Tools button (3 little lines) on the left-middle of your screenshot.
If the Aspect Ratio / Display is still wrong - you can change the custom timeline resolution in Project Settings using the Resolution button ( > < near top right) or Shift-9.

It's hard to know what's going on without knowing your project settings or what kind of footage you're using.  But the relevant settings are under Project Settings->Master Settings->Timeline resolution, Project settings->Master Settings->Pixel aspect ratio, and Project Settings->Image Scaling->Input Scaling->Mismatched resolution files.  Unless you're editing old DV footage or unless you used an anamorphic lens (you would know), Pixel aspect ratio should be set to Square, and Mismatched resolution files should be anything except "Stretch Frame to all Corners."


text:
How can I add a background image to a large music file?
My music file is about ~300 MB and ~4 hours long. I'd like to add a background image onto it to upload it on Youtube. The problem is, when I try a video rendering program (Kdenlive, Windows Movie Maker etc.) to do that, the output becomes massively big, like ~40 GB. I don't understand, why does merging procession of a 300 MB mp3 file and a 1 MB png file result such a huge file size like that? Does the rendering program render the background image again and again for every frame? Can't the whole video have just a single frame and an audio attached on it?
Is there another way to accomplish it?

Simple answer is yes - the Video frame is repeatedly encoded multiple times. There is compression - including frame-to-frame, but the single image frame is effectively duplicated numerous times. Try reducing the resolution for lower file size - if the quality of that image is not so important.


text:
How to compare the audio/video synchronization in video clips?
I have two video clips of the same music video. Both are made of the same video and audio tracks but of different sources and quality.
One of them is a rip from an officially released media, so the video/audio synchronization in it can be used as reference.
The other was made by muxing video and audio streams from different unrelated sources. Whereas they appear perfectly in sync to human eye and ear resembling the original, I would like to somehow gauge it with sample-perfect precision to see how close the sync to the original actually is.
I can use some video players to nagivate frame-by-frame to the same frame in both clips. But I don't know how to see the accurate position in the audio waveform which that frame corresponds to (to be perfectly clear, the brackets encompassing the audio fragment corresponding to a particular video frame). What tools can I use for this?
Ideally I want the tool to tell me something like "your second clip's audio is muxed 0.0005 seconds behind comparing to the reference clip". I will then use that 0.0005 seconds result to correct the second clip by re-muxing it with the right offset.

I don't understand the question. You said audio is perfectly in sync judging by your eyes and ears. Anyway, you cannot get more precise than 0.01 - 0.04 seconds depending on fps of the video. To me it seems you're chasing a ghost problem.

@Matt Let's say I'm chasing 0.04 s for pure perfectionism purposes. Eyes/ears won't detect 0.04 s out-of-sync, will they? I want to detect and negate that.

@Matt Actually, why would audio sync precision depend on fps? While a frame is frozen on the screen for a split of a second, the audio keeps playing continuously. You can move it backwards or forwards with its sampling precision (e.g. 1/48000 s).

Humans can detect off-sync audio from around 0.045 s or 0.1 s depending on who you ask. You're right, you can align the audio signal as precisely as the audio sampling rate. But you need to decide to what frame to align but you only get a new frame every 0.04s for example. What if you want to sync to a drum stick hit on a hi-hat but the stick is in one frame far from the hi-hat and in the next one already touches it? The hit is somewhere in between those two frames. You can't tell by how much to move the audio signal back or forth. That's what I meant.

@Matt The stick hit will be somewhere inside the frame previous to the first one where the stick touches the hit-hat. And yes I can tell how much to move the audio signal because I can see where exactly the hit is in the frame in the reference video. Just need a tool to magnify and measure it with precision, which is what this question is about.


text:
Why has grayscale a higher bitrate than YUV with H.265/HEVC?
For compression purposes, I am re‐encoding a grayscale video to the H.265/HEVC codec. Although the input video is more or less perfectly grayscale in aspect, it is provided in the yuv420p pixel format. So I thought that mapping the video to the gray pixel format would reduce file size further. I was expecting this, not only because gray uses 8 bits per pixel while yuv420p uses 12 (according to ffmpeg -pix_fmts), but also because stripping noisy data (irrelevant color information) would help compression.
To my surprise, the opposite happened: the output video in gray is about 14 % larger than the output video in yuv420p!

As an example, I measured the byte size with a 60‐second footage, which I encoded as follows :
ffmpeg -i in.h264 \
    -filter:V 'crop=960:720:160:0, format=gray, format=yuv420p' \
    -c:V libx265 -crf 26 -preset medium \
  out-gray-yuv.h265

I tried several filter chains (I was also cropping the video):

nothing (output file out.h265),
turning the video to gray (output file out-gray.h265)
turning the video to gray, then back to yuv420p (output file out-gray-yuv.h265) — as hinted at by that answer.

(I also tried the hue filter, like this: hue=s=0, but it is apparently subsumed by converting the video to gray. Also, using the -pix_fmt option appears to be equivalent to appending a format filter)
BYTES      NAME                FFPROBE
14972779   in.h264             h264 (Main), yuv420p(tv, progressive), 1280x720 [SAR 1:1 DAR 16:9], 25 fps, 25 tbr, 1200k tbn, 50 tbc
 3043717   out-gray.h265       hevc (Rext), gray(tv),                 960x720 [SAR 1:1 DAR 4:3], 25 fps, 25 tbr, 1200k tbn, 25 tbc
 2670564   out.h265            hevc (Main), yuv420p(tv),              960x720 [SAR 1:1 DAR 4:3], 25 fps, 25 tbr, 1200k tbn, 25 tbc
 2662991   out-gray-yuv.h265   hevc (Main), yuv420p(tv),              960x720 [SAR 1:1 DAR 4:3], 25 fps, 25 tbr, 1200k tbn, 25 tbc

It appears that out-gray-yuv is very slightly smaller than out, which is not surprising (it could come from the input video not being perfectly grayscale yet). However, it is also about 14 % smaller than out-gray, which I cannot explain.

Why do I observe these results? What should I do to benefit from grayscale compression with H.265?

Imna hazard a guess and say out-gray.h265 doesn’t use chroma sub sampling, and isn’t just the y’ component, maybe? Maybe it’s 411? I don’t understand why out-gray-Yuv would be 420, either; it shouldn’t have a chrominance component — it should just be black and white.

encoding videos can be quirky. A different combination of preset and crf values might give you totally different results!
Also I imagine that the libx265 encoder was primarily optimized for yuv420/yuv420p10/color  formats. You might just be running into some slightly substandard behavior.
One thing you can try is keep the yuv420p format, but explicitly remove the chroma components with lutrgb="g=0:b=0" and see what happens.

I consistently observe this. @JasonConrad the gray pixel format doesn’t even have a chroma to sub-sample. It’s really just the Y component (or Y', I don’t know exactly) at 8 bits per pixel. Whereas the yuv420p is 12 bits per pixel (Y at 8b/px, U at 8b/4px, V at 8b/4px). This is documented by ffmpeg -pix_fmts. As far as I understand, the encoding of out-gray-yuv is just the same as that of out-gray with four additional null bits per pixel. So I guess it’s just that H.265 compression algorithms/settings have not been optimized for 8bit-pixels. ¯\(ツ)/¯

@Chris The video filter lutrgb=g=0:b=0 imposes RGB instead of YUV, and removes the green and blue components, leaving the picture in redscale. I guess you rather meant lutyuv=u=128:v=128 (hinted by man ffmpeg-filters), which cancels the chroma components (while keeping these null components in the output). I just tested it, it is exactly the same (bit-equal) as the filter chain format=gray, format=yuv420p which I was using in the question.

Right you are! I've learned a bit more about color in the year since I replied. Sometimes I wonder if ffmpeg's automatic format conversion filter insertion does too much.   It makes things much easier to get working most of the time, but in this case it automatically inserts a format conversion filter to rgb24 before lutrgb=g=0:b=0. If I was forced to be explicit about fmt conversions I probably would have re-thought what I was doing. Just some musings. Anyway, thanks for correcting me!


text:
Create 4x2 grid mosaic
trying to create a 4x2 grid from 8 videos using the terminal on a mac. The code I am using is not working:
ffmpeg -i input0.mov -i input1.mov -i input2.mov -i input3.mov -i input4.mov -i input5.mov -i input6.mov -i input7.mov -filter_complex "[0:v][1:v][2:v][3:v] [4:v] [5:v][6:v][7:v] xstack=inputs=8:layout=0_0|0_h0|w0_0|w0_h0|w0+w1_0|w0+w1_h0|w0+w1+w2_0|w0+w1+w2_h0[v]” -map "[v]" 4x2grid.mp4
Any ideas? I'm using ffmpeg version 4.3.1. And the error message is:  dquote>
Not sure why this is. I am relatively new to ffmpeg but can successfully create a 3x2 grid using the following code without the same message:
ffmpeg -i input0.mov -i input1.mov -i input2.mov -i input3.mov -i input4.mov -i input5.mov -filter_complex "[0:v][1:v][2:v][3:v] [4:v] [5:v] xstack=inputs=6:layout=0_0|w0_0|0_h0|w0_h0|w0+w3_0|w0+w3_h0[v]" -map "[v]" 3x2grid.mp4
I have also tried various other possibilities including the following code but with the same result:
ffmpeg -i input0.mov -i input1.mov -i input2.mov -i input3.mov -i input4.mov -i input5.mov -i input6.mov -i input7.mov -filter_complex "[0:v][1:v][2:v][3:v][4:v][5:v][6:v][7:v] xstack=inputs=8:layout=0_0|w0_0|0_h0|w0_h0|w0+w3_0|w0+w3_h0|w0+w3+w4_0|w0+w3+w4_h0[v]” -map "[v]" 4x2grid.mp4
Although I have tried to read the explanation here:
http://ffmpeg.org/ffmpeg-all.html#xstack
I am not sure I fully understand how to specify the desired layout configuration.

Hi, thanks for your response. I've tried to answer your questions and added a greater explanation of the problem and the solutions I've tried. Hope it's clearer. I'm not sure what you mean by ffmpeg command output? Do you mean desired output. If so that is outputting the finished video as an .mp4

@Paul Thanks for your response. Not sure how I find the error message output of ffmpeg? When I try the code discussed above using terminal in Mac OS 10.14.6 I receive the message "dquote" which I gather means I've executed a line of code with only one double-quote character. However as I mention I can create a 3x2 grid using a similar format:
ffmpeg -i input0.mov -i input1.mov -i input2.mov -i input3.mov -i input4.mov -i input5.mov -filter_complex "[0:v][1:v][2:v][3:v] [4:v] [5:v] xstack=inputs=6:layout=0_0|w0_0|0_h0|w0_h0|w0+w3_0|w0+w3_h0[v]" -map "[v]" 3x2grid.mp4

That's possible. will have a look at the link. Many thanks

I have tried it on the colab, plz check if
https://colab.research.google.com/gist/xer-rex/90c426cd7dbdfd4ec3330a7c3b46f98f/sidebyside.ipynb helps?

Many thanks for your suggestion which looks very interesting. Unfortunately I have no knowledge of Python and can only use ffmpeg using the terminal

My suggestion on colab has nothing to do with Python, i treat it as a Linux terminal, as you see i did !ffmpeg with exclamation mark at front, i can do !ls, !cp, !rm, ...

thanks for your response. Sorry, this is a big learning curve! I tried your code substituting my video files and starting with "ffmpeg" not "iffmpeg" but received this message:
At least one output file must be specified
zsh: command not found: -filter_complex
I assume there will be many formatting issues because I am using ffmpeg on a mac terminal?

I think it's just the matter of ffmpeg version on colab it uses
ffmpeg version 3.4.8-0ubuntu0.2 Copyright (c) 2000-2020 the FFmpeg developers


text:
With ffmpeg how do I imply spatial position when mixing mono to stereo
I have a range of mono audio samples and have worked out how to play them at specific time offsets but would like to give some indication of 'where the sound is coming from' I have the x and y centers of each sound source in the frame, is it sufficient to use a slight bias in the pan filter? Or is some element of delay in one channel needed too?
My best guess is passing each of the samples through this:
[mono0]pan=stereo|c0=c0|c1=c0,stereotools=balance_out={panpos}[stereo0]
where {panpos} is a value -1 = 1 representing the x position.
and them later amerge over them all.

This is something that we can't really give an absolute answer because we don't have your inputs and what is "best" will be fairly subjective.
You could just try using the pan filter with a bigger gain factor for one side. Something like:
pan=stereo|c0=0.8*c0|0.2*c1=c0

Depending on your inputs adding adelay may make it sound less flat:
pan=stereo|c0=0.8*c0|c1=0.2*c0,adelay=0|10

You can use stereotools filter if you prefer as it has many options (I completely forgot about this filter...can't keep up).


text:
Video blurry after Rendering in After Effects CS6
In After Effects I edited a 1080p video. The preview of the final composition looks fine, however the rendered output is very blurry (looks like 480p instead of 1080p).
Original video properties:
Item type: .mp4
Frame width: 1920
Framde height: 1080
Frame rate: 30.00 Fps

Video imported, to be sure right-click > 'Interpret Footage' > 'Main' >
'Conform to frame rate: 30'
'Separate Fields: off
'Remove pulldown: off'
'Pixel Aspects Ratio: Square Pixels'

Preview is still looking fine. Now importing that video into a new composition. Composition settings:
'Preset: Custom' (also tried here preset 'HDTV 1080 29.97')
'Width: 1920'
'Height: 1080'
'Pixel Aspects Ratio: Square Pixels'
'Frame Rate: 30'
'Resolution: Full'

Preview is still looking fine. Now File > Export > Add to Render Que.
Render settings:
'Quality: Best' (with 'current settings' it has the same quality loss)
'Resolution: Full'
'Size 1920x1080'
'Use comp's frame rate: 30.00'

Output Module settings:
'Format: H.264'
'Post-Render Action: None'
'Channels: RGB'
'Depth: Millions of Colors'
'Premultiplied (Matted)'

During the render, the preview also shows the right quality.
After the render, I open the file in VLC and there it shows poor quality. Meanwhile the same VLC player shows the original video in high quality.
Any suggestions what I miss?
Kind regards,
Igor

Is it actually blurry, or just low quality? Have you looked at the codec settings? Could be the bitrate is too low. Also, don't render to h.264 from AE, it's better to render to a lossless / intermediate codec master and run off h.264 copies from that.

Ok, that actually is the problem, it was blurry indeed. I had no knowledge about Codec settings, changed it from VBR to CBR and looked up videos on bitrate. Quality looks fine now! Thanks.


text:
No sound on Windows Media Player after removing unneeded audio streams with ffmpeg
In some .mkv files with multiple different audio streams I removed all the ones I don't need with ffmpeg and only kept the desired audio stream along with the video and possibly subtitles.
The result works fine in VLC, but in Windows Media Player I don't have any sound after the repacking. I do wonder what the issue is. Anything incorrect with the process? How could I achieve that it still works with WMP after the removal of certain audio streams.
Note: The audio works well in WMP with the original file.
Here's what I use to remove the unneeded streams. Let's say I have a file with three audio streams and I only want to keep the second one:
ffmpeg -i inputfile.mkv -map 0:v -map 0:s -map 0:a:1 -c copy outputfile.mkv

Edit:
ffmpgeg -i <file> output before and after removing.
I notice that the encoder changes, maybe that causes issues for WMP?
ffmpeg -i in.mkv

ffmpeg version git-2020-04-17-889ad93 Copyright (c) 2000-2020 the FFmpeg developers
  built with gcc 9.3.1 (GCC) 20200328
  configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libdav1d --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libsrt --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --disable-w32threads --enable-libmfx --enable-ffnvcodec --enable-cuda-llvm --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmpt --enable-amf
  libavutil      56. 42.102 / 56. 42.102
  libavcodec     58. 80.100 / 58. 80.100
  libavformat    58. 42.100 / 58. 42.100
  libavdevice    58.  9.103 / 58.  9.103
  libavfilter     7. 77.101 /  7. 77.101
  libswscale      5.  6.101 /  5.  6.101
  libswresample   3.  6.100 /  3.  6.100
  libpostproc    55.  6.100 / 55.  6.100
Input #0, matroska,webm, from 'in.mkv':
  Metadata:
    title           : test
    encoder         : libebml v0.7.7 + libmatroska v0.8.1
    creation_time   : 2011-09-25T09:17:25.000000Z
  Duration: 01:31:44.83, start: 0.000000, bitrate: 13668 kb/s
    Stream #0:0(eng): Video: h264 (High), yuv420p(progressive), 1920x1080, SAR 1:1 DAR 16:9, 23.98 fps, 23.98 tbr, 1k tbn, 47.95 tbc (default)
    Stream #0:1(rus): Audio: ac3, 48000 Hz, 5.1(side), fltp, 448 kb/s (default)
    Metadata:
      title           : MVO
    Stream #0:2(rus): Audio: ac3, 48000 Hz, stereo, fltp, 192 kb/s
    Metadata:
      title           : DUB
    Stream #0:3(rus): Audio: ac3, 48000 Hz, stereo, fltp, 192 kb/s
    Metadata:
      title           : Mihalev
    Stream #0:4(eng): Audio: dts (DTS), 48000 Hz, 5.1(side), fltp, 1536 kb/s
    Metadata:
      title           : DTSHD core5.1 1536k
    Stream #0:5(rus): Subtitle: subrip (default)

ffmpeg -i out.mkv

ffmpeg version git-2020-04-17-889ad93 Copyright (c) 2000-2020 the FFmpeg developers
  built with gcc 9.3.1 (GCC) 20200328
  configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libdav1d --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libsrt --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --disable-w32threads --enable-libmfx --enable-ffnvcodec --enable-cuda-llvm --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmpt --enable-amf
  libavutil      56. 42.102 / 56. 42.102
  libavcodec     58. 80.100 / 58. 80.100
  libavformat    58. 42.100 / 58. 42.100
  libavdevice    58.  9.103 / 58.  9.103
  libavfilter     7. 77.101 /  7. 77.101
  libswscale      5.  6.101 /  5.  6.101
  libswresample   3.  6.100 /  3.  6.100
  libpostproc    55.  6.100 / 55.  6.100
Input #0, matroska,webm, from 'out.mkv':
  Metadata:
    title           : test
    ENCODER         : Lavf58.42.100
  Duration: 01:31:44.83, start: 0.000000, bitrate: 12842 kb/s
    Stream #0:0(eng): Video: h264 (High), yuv420p(progressive), 1920x1080, SAR 1:1 DAR 16:9, 23.98 fps, 23.98 tbr, 1k tbn, 47.95 tbc (default)
    Metadata:
      DURATION        : 01:31:44.828000000
    Stream #0:1(rus): Subtitle: subrip (default)
    Metadata:
      DURATION        : 01:26:07.385000000
    Stream #0:2(eng): Audio: dts (DTS), 48000 Hz, 5.1(side), fltp, 1536 kb/s
    Metadata:
      title           : DTSHD core5.1 1536k
      DURATION        : 01:31:44.273000000

EDIT 2:
Log output of ffmpeg -i inputfile.mkv -map 0:v -map 0:s -map 0:a:1 -c copy outputfile.mkv
ffmpeg -i inputfile.mkv -map 0:v -map 0:s -map 0:a:1 -c copy out.mkv
ffmpeg version git-2020-04-17-889ad93 Copyright (c) 2000-2020 the FFmpeg developers
  built with gcc 9.3.1 (GCC) 20200328
  configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libdav1d --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libsrt --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --disable-w32threads --enable-libmfx --enable-ffnvcodec --enable-cuda-llvm --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmpt --enable-amf
  libavutil      56. 42.102 / 56. 42.102
  libavcodec     58. 80.100 / 58. 80.100
  libavformat    58. 42.100 / 58. 42.100
  libavdevice    58.  9.103 / 58.  9.103
  libavfilter     7. 77.101 /  7. 77.101
  libswscale      5.  6.101 /  5.  6.101
  libswresample   3.  6.100 /  3.  6.100
  libpostproc    55.  6.100 / 55.  6.100
Input #0, matroska,webm, from 'inputfile.mkv':
  Metadata:
    title           : test
    encoder         : libebml v0.7.7 + libmatroska v0.8.1
    creation_time   : 2011-09-25T09:17:25.000000Z
  Duration: 01:31:44.83, start: 0.000000, bitrate: 13668 kb/s
    Stream #0:0(eng): Video: h264 (High), yuv420p(progressive), 1920x1080, SAR 1:1 DAR 16:9, 23.98 fps, 23.98 tbr, 1k tbn, 47.95 tbc (default)
    Stream #0:1(rus): Audio: ac3, 48000 Hz, 5.1(side), fltp, 448 kb/s (default)
    Metadata:
      title           : MVO
    Stream #0:2(rus): Audio: ac3, 48000 Hz, stereo, fltp, 192 kb/s
    Metadata:
      title           : DUB
    Stream #0:3(rus): Audio: ac3, 48000 Hz, stereo, fltp, 192 kb/s
    Metadata:
      title           : Mihalev
    Stream #0:4(eng): Audio: dts (DTS), 48000 Hz, 5.1(side), fltp, 1536 kb/s
    Metadata:
      title           : DTSHD core5.1 1536k
    Stream #0:5(rus): Subtitle: subrip (default)
Output #0, matroska, to 'out.mkv':
  Metadata:
    title           : test
    encoder         : Lavf58.42.100
    Stream #0:0(eng): Video: h264 (High) (H264 / 0x34363248), yuv420p(progressive), 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 23.98 fps, 23.98 tbr, 1k tbn, 1k tbc (default)
    Stream #0:1(rus): Subtitle: subrip (default)
    Stream #0:2(rus): Audio: ac3 ([0] [0][0] / 0x2000), 48000 Hz, stereo, fltp, 192 kb/s
    Metadata:
      title           : DUB
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:5 -> #0:1 (copy)
  Stream #0:2 -> #0:2 (copy)
Press [q] to stop, [?] for help
frame=131984 fps=941 q=-1.0 Lsize= 7741970kB time=01:31:44.70 bitrate=11521.5kbits/s speed=39.3x
video:7611378kB audio:128246kB subtitle:66kB other streams:0kB global headers:0kB muxing overhead: 0.029470%

Share the full log of ffmpeg -i file for both input and output.

@Gyan I added the outputs. I see that the encoder changes, maybe that might be the culprit...?

The log from ffmpeg -i inputfile.mkv -map 0:v -map 0:s -map 0:a:1 -c copy outputfile.mkv may be more informative.

@llogan See second edit above for the requested log output.


text:
Audio is corrupted after joining videos with ffmpeg concat demuxer
I've concat or joined four video files using ffmpeg concat demuxer The video has no problem. But on audio side I am greeted with a bunch of error when I tried re encoding the final video. Here is the console output:
Output #0, matroska, to '../videos/nnnnc.mkv':
  Metadata:
    encoder         : Lavf58.42.101
    Stream #0:0: Video: h264 (libx264) (H264 / 0x34363248), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], q=-1--1, 23.98 fps, 1k tbn, 23.98 tbc (default)
    Metadata:
      DURATION        : 02:35:10.922000000
      encoder         : Lavc58.80.100 libx264
    Side data:
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: N/A
    Stream #0:1: Audio: aac (libfdk_aac) ([255][0][0][0] / 0x00FF), 48000 Hz, stereo, s16, 139 kb/s (default)
    Metadata:
      DURATION        : 02:35:10.929000000
      encoder         : Lavc58.80.100 libfdk_aac
    Stream #0:2: Subtitle: subrip (default)
    Metadata:
      DURATION        : 02:35:10.920000000
[aac @ 0x5653edc94b00] channel element 2.13 is not allocatedbitrate= 108.2kbits/s dup=0 drop=2 speed=6.21x
Error while decoding stream #0:1: Invalid data found when processing input
[aac @ 0x5653edc94b00] channel element 2.13 is not allocatedbitrate= 678.3kbits/s dup=0 drop=2 speed=5.96x
Error while decoding stream #0:1: Invalid data found when processing input
[aac @ 0x5653edc94b00] channel element 2.13 is not allocatedbitrate= 771.3kbits/s dup=0 drop=2 speed=5.87x
Error while decoding stream #0:1: Invalid data found when processing input
[aac @ 0x5653edc94b00] channel element 2.13 is not allocatedbitrate= 693.0kbits/s dup=0 drop=2 speed=5.89x
Error while decoding stream #0:1: Invalid data found when processing input
[aac @ 0x5653edc94b00] channel element 2.13 is not allocated
Error while decoding stream #0:1: Invalid data found when processing input

ffprobe output of source 1
[STREAM]
index=0
codec_name=hevc
codec_long_name=unknown
profile=1
codec_type=video
codec_time_base=1001/24000
codec_tag_string=[0][0][0][0]
codec_tag=0x0000
width=1280
height=720
coded_width=1280
coded_height=720
has_b_frames=2
sample_aspect_ratio=1:1
display_aspect_ratio=16:9
pix_fmt=yuv420p
level=93
color_range=tv
color_space=unknown
color_transfer=unknown
color_primaries=unknown
chroma_location=unspecified
field_order=progressive
timecode=N/A
refs=1
id=N/A
r_frame_rate=24000/1001
avg_frame_rate=24000/1001
time_base=1/1000
start_pts=105
start_time=0.105000
duration_ts=N/A
duration=N/A
bit_rate=N/A
max_bit_rate=N/A
bits_per_raw_sample=N/A
nb_frames=N/A
nb_read_frames=N/A
nb_read_packets=N/A
DISPOSITION:default=1
DISPOSITION:dub=0
DISPOSITION:original=0
DISPOSITION:comment=0
DISPOSITION:lyrics=0
DISPOSITION:karaoke=0
DISPOSITION:forced=0
DISPOSITION:hearing_impaired=0
DISPOSITION:visual_impaired=0
DISPOSITION:clean_effects=0
DISPOSITION:attached_pic=0
DISPOSITION:timed_thumbnails=0
TAG:ENCODER=Lavc58.80.100 libx265
TAG:DURATION=00:00:03.108000000
[/STREAM]
[STREAM]
index=1
codec_name=subrip
codec_long_name=unknown
profile=unknown
codec_type=subtitle
codec_time_base=0/1
codec_tag_string=[0][0][0][0]
codec_tag=0x0000
width=N/A
height=N/A
id=N/A
r_frame_rate=0/0
avg_frame_rate=0/0
time_base=1/1000
start_pts=0
start_time=0.000000
duration_ts=3108
duration=3.108000
bit_rate=N/A
max_bit_rate=N/A
bits_per_raw_sample=N/A
nb_frames=N/A
nb_read_frames=N/A
nb_read_packets=N/A
DISPOSITION:default=1
DISPOSITION:dub=0
DISPOSITION:original=0
DISPOSITION:comment=0
DISPOSITION:lyrics=0
DISPOSITION:karaoke=0
DISPOSITION:forced=0
DISPOSITION:hearing_impaired=0
DISPOSITION:visual_impaired=0
DISPOSITION:clean_effects=0
DISPOSITION:attached_pic=0
DISPOSITION:timed_thumbnails=0
TAG:ENCODER=Lavc58.80.100 subrip
TAG:DURATION=00:00:03.105000000
[/STREAM]
[STREAM]
index=2
codec_name=aac
codec_long_name=unknown
profile=4
codec_type=audio
codec_time_base=1/48000
codec_tag_string=[0][0][0][0]
codec_tag=0x0000
sample_fmt=fltp
sample_rate=48000
channels=2
channel_layout=stereo
bits_per_sample=0
id=N/A
r_frame_rate=0/0
avg_frame_rate=0/0
time_base=1/1000
start_pts=0
start_time=0.000000
duration_ts=N/A
duration=N/A
bit_rate=N/A
max_bit_rate=N/A
bits_per_raw_sample=N/A
nb_frames=N/A
nb_read_frames=N/A
nb_read_packets=N/A
DISPOSITION:default=1
DISPOSITION:dub=0
DISPOSITION:original=0
DISPOSITION:comment=0
DISPOSITION:lyrics=0
DISPOSITION:karaoke=0
DISPOSITION:forced=0
DISPOSITION:hearing_impaired=0
DISPOSITION:visual_impaired=0
DISPOSITION:clean_effects=0
DISPOSITION:attached_pic=0
DISPOSITION:timed_thumbnails=0
TAG:ENCODER=Lavc58.80.100 libfdk_aac
TAG:DURATION=00:00:03.105000000
[/STREAM]

ffprobe output of source 2,3,4 (all are same source)
[STREAM]
index=0
codec_name=hevc
codec_long_name=unknown
profile=1
codec_type=video
codec_time_base=1001/24000
codec_tag_string=[0][0][0][0]
codec_tag=0x0000
width=1280
height=720
coded_width=1280
coded_height=720
has_b_frames=2
sample_aspect_ratio=1:1
display_aspect_ratio=16:9
pix_fmt=yuv420p
level=93
color_range=tv
color_space=bt709
color_transfer=bt709
color_primaries=bt709
chroma_location=unspecified
field_order=unknown
timecode=N/A
refs=1
id=N/A
r_frame_rate=24000/1001
avg_frame_rate=24000/1001
time_base=1/1000
start_pts=7
start_time=0.007000
duration_ts=N/A
duration=N/A
bit_rate=N/A
max_bit_rate=N/A
bits_per_raw_sample=N/A
nb_frames=N/A
nb_read_frames=N/A
nb_read_packets=N/A
DISPOSITION:default=1
DISPOSITION:dub=0
DISPOSITION:original=0
DISPOSITION:comment=0
DISPOSITION:lyrics=0
DISPOSITION:karaoke=0
DISPOSITION:forced=0
DISPOSITION:hearing_impaired=0
DISPOSITION:visual_impaired=0
DISPOSITION:clean_effects=0
DISPOSITION:attached_pic=0
DISPOSITION:timed_thumbnails=0
TAG:BPS=651629
TAG:BPS-eng=651629
TAG:DURATION=00:51:39.472000000
TAG:DURATION-eng=00:51:39.472000000
TAG:NUMBER_OF_FRAMES=74313
TAG:NUMBER_OF_FRAMES-eng=74313
TAG:NUMBER_OF_BYTES=252463300
TAG:NUMBER_OF_BYTES-eng=252463300
TAG:_STATISTICS_WRITING_APP=mkvmerge v9.6.0 ('Slave To Your Mind') 64bit
TAG:_STATISTICS_WRITING_APP-eng=mkvmerge v9.6.0 ('Slave To Your Mind') 64bit
TAG:_STATISTICS_WRITING_DATE_UTC=2018-09-07 09:36:09
TAG:_STATISTICS_WRITING_DATE_UTC-eng=2018-09-07 09:36:09
TAG:_STATISTICS_TAGS=BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
TAG:_STATISTICS_TAGS-eng=BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
[/STREAM]
[STREAM]
index=1
codec_name=aac
codec_long_name=unknown
profile=4
codec_type=audio
codec_time_base=1/48000
codec_tag_string=[0][0][0][0]
codec_tag=0x0000
sample_fmt=fltp
sample_rate=48000
channels=2
channel_layout=stereo
bits_per_sample=0
id=N/A
r_frame_rate=0/0
avg_frame_rate=0/0
time_base=1/1000
start_pts=3
start_time=0.003000
duration_ts=N/A
duration=N/A
bit_rate=N/A
max_bit_rate=N/A
bits_per_raw_sample=N/A
nb_frames=N/A
nb_read_frames=N/A
nb_read_packets=N/A
DISPOSITION:default=1
DISPOSITION:dub=0
DISPOSITION:original=0
DISPOSITION:comment=0
DISPOSITION:lyrics=0
DISPOSITION:karaoke=0
DISPOSITION:forced=0
DISPOSITION:hearing_impaired=0
DISPOSITION:visual_impaired=0
DISPOSITION:clean_effects=0
DISPOSITION:attached_pic=0
DISPOSITION:timed_thumbnails=0
TAG:BPS=64000
TAG:BPS-eng=64000
TAG:DURATION=00:51:39.605000000
TAG:DURATION-eng=00:51:39.605000000
TAG:NUMBER_OF_FRAMES=72647
TAG:NUMBER_OF_FRAMES-eng=72647
TAG:NUMBER_OF_BYTES=24796844
TAG:NUMBER_OF_BYTES-eng=24796844
TAG:_STATISTICS_WRITING_APP=mkvmerge v9.6.0 ('Slave To Your Mind') 64bit
TAG:_STATISTICS_WRITING_APP-eng=mkvmerge v9.6.0 ('Slave To Your Mind') 64bit
TAG:_STATISTICS_WRITING_DATE_UTC=2018-09-07 09:36:09
TAG:_STATISTICS_WRITING_DATE_UTC-eng=2018-09-07 09:36:09
TAG:_STATISTICS_TAGS=BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
TAG:_STATISTICS_TAGS-eng=BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
[/STREAM]
[STREAM]
index=2
codec_name=subrip
codec_long_name=unknown
profile=unknown
codec_type=subtitle
codec_time_base=0/1
codec_tag_string=[0][0][0][0]
codec_tag=0x0000
width=N/A
height=N/A
id=N/A
r_frame_rate=0/0
avg_frame_rate=0/0
time_base=1/1000
start_pts=3
start_time=0.003000
duration_ts=3099605
duration=3099.605000
bit_rate=N/A
max_bit_rate=N/A
bits_per_raw_sample=N/A
nb_frames=N/A
nb_read_frames=N/A
nb_read_packets=N/A
DISPOSITION:default=1
DISPOSITION:dub=0
DISPOSITION:original=0
DISPOSITION:comment=0
DISPOSITION:lyrics=0
DISPOSITION:karaoke=0
DISPOSITION:forced=0
DISPOSITION:hearing_impaired=0
DISPOSITION:visual_impaired=0
DISPOSITION:clean_effects=0
DISPOSITION:attached_pic=0
DISPOSITION:timed_thumbnails=0
TAG:BPS=65
TAG:BPS-eng=65
TAG:DURATION=00:49:21.500000000
TAG:DURATION-eng=00:49:21.500000000
TAG:NUMBER_OF_FRAMES=777
TAG:NUMBER_OF_FRAMES-eng=777
TAG:NUMBER_OF_BYTES=24256
TAG:NUMBER_OF_BYTES-eng=24256
TAG:_STATISTICS_WRITING_APP=mkvmerge v9.6.0 ('Slave To Your Mind') 64bit
TAG:_STATISTICS_WRITING_APP-eng=mkvmerge v9.6.0 ('Slave To Your Mind') 64bit
TAG:_STATISTICS_WRITING_DATE_UTC=2018-09-07 09:36:09
TAG:_STATISTICS_WRITING_DATE_UTC-eng=2018-09-07 09:36:09
TAG:_STATISTICS_TAGS=BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
TAG:_STATISTICS_TAGS-eng=BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
[/STREAM]

ffprobe output of the joined video
[STREAM]
index=0
codec_name=hevc
codec_long_name=unknown
profile=1
codec_type=video
codec_time_base=1001/24000
codec_tag_string=[0][0][0][0]
codec_tag=0x0000
width=1280
height=720
coded_width=1280
coded_height=720
has_b_frames=2
sample_aspect_ratio=1:1
display_aspect_ratio=16:9
pix_fmt=yuv420p
level=93
color_range=tv
color_space=unknown
color_transfer=unknown
color_primaries=unknown
chroma_location=unspecified
field_order=progressive
timecode=N/A
refs=1
id=N/A
r_frame_rate=24000/1001
avg_frame_rate=24000/1001
time_base=1/1000
start_pts=105
start_time=0.105000
duration_ts=N/A
duration=N/A
bit_rate=N/A
max_bit_rate=N/A
bits_per_raw_sample=N/A
nb_frames=N/A
nb_read_frames=N/A
nb_read_packets=N/A
DISPOSITION:default=1
DISPOSITION:dub=0
DISPOSITION:original=0
DISPOSITION:comment=0
DISPOSITION:lyrics=0
DISPOSITION:karaoke=0
DISPOSITION:forced=0
DISPOSITION:hearing_impaired=0
DISPOSITION:visual_impaired=0
DISPOSITION:clean_effects=0
DISPOSITION:attached_pic=0
DISPOSITION:timed_thumbnails=0
TAG:DURATION=02:35:10.922000000
[/STREAM]
[STREAM]
index=1
codec_name=aac
codec_long_name=unknown
profile=4
codec_type=audio
codec_time_base=1/48000
codec_tag_string=[0][0][0][0]
codec_tag=0x0000
sample_fmt=fltp
sample_rate=48000
channels=2
channel_layout=stereo
bits_per_sample=0
id=N/A
r_frame_rate=0/0
avg_frame_rate=0/0
time_base=1/1000
start_pts=0
start_time=0.000000
duration_ts=N/A
duration=N/A
bit_rate=N/A
max_bit_rate=N/A
bits_per_raw_sample=N/A
nb_frames=N/A
nb_read_frames=N/A
nb_read_packets=N/A
DISPOSITION:default=1
DISPOSITION:dub=0
DISPOSITION:original=0
DISPOSITION:comment=0
DISPOSITION:lyrics=0
DISPOSITION:karaoke=0
DISPOSITION:forced=0
DISPOSITION:hearing_impaired=0
DISPOSITION:visual_impaired=0
DISPOSITION:clean_effects=0
DISPOSITION:attached_pic=0
DISPOSITION:timed_thumbnails=0
TAG:DURATION=02:35:10.929000000
[/STREAM]
[STREAM]
index=2
codec_name=subrip
codec_long_name=unknown
profile=unknown
codec_type=subtitle
codec_time_base=0/1
codec_tag_string=[0][0][0][0]
codec_tag=0x0000
width=N/A
height=N/A
id=N/A
r_frame_rate=0/0
avg_frame_rate=0/0
time_base=1/1000
start_pts=0
start_time=0.000000
duration_ts=9310929
duration=9310.929000
bit_rate=N/A
max_bit_rate=N/A
bits_per_raw_sample=N/A
nb_frames=N/A
nb_read_frames=N/A
nb_read_packets=N/A
DISPOSITION:default=1
DISPOSITION:dub=0
DISPOSITION:original=0
DISPOSITION:comment=0
DISPOSITION:lyrics=0
DISPOSITION:karaoke=0
DISPOSITION:forced=0
DISPOSITION:hearing_impaired=0
DISPOSITION:visual_impaired=0
DISPOSITION:clean_effects=0
DISPOSITION:attached_pic=0
DISPOSITION:timed_thumbnails=0
TAG:DURATION=02:35:10.920000000
[/STREAM]

The source 1 is generated via the following command to match source 2,3,4
ffmpeg -loop 1 -i image.png -f lavfi -i anullsrc=channel_layout=stereo:sample_rate=48000 -i sub.srt -map 0:v $amap $smap -t 3 -vf 'scale=1280x720,fade=type=in:duration=1,fade=type=out:duration=1:start_time=2' -r 23.98 -crf 22 -c:v hevc -pix_fmt yuv420p -c:a libfdk_aac -profile:a 4 -ac 2 -ar 48000 -c:s copy wmv1.mkv"

The $amap $smap are PHP variable to match 2,3,4 configuration.
If I join video 2,3,4 without video 1 the output is fine. There is no error in encoding.
But when I include video 1 the encoding goes crazy by spamming my console with errors. No matter what I try or how differently I try. Outcome is same.
Concat demuxer command
ffmpeg -safe 0 -f concat -i list.txt -c copy -c:s copy ../videos/nnnnc.mkv
 and list.txt
file 'source1.mkv'
duration 3

file 'source2.mkv'
duration 3099.6

file 'source2.mkv'
duration 3099.6

file 'source2.mkv'
duration 3099.6

What am I doing wrong here?

@llogan ffmpeg -safe 0 -f concat -i list.txt -c copy -c:s copy out.mkv

The order of your streams do not match. Try ffmpeg -loop 1 -framerate 24000/1001 -i image.png -f lavfi -i anullsrc=channel_layout=stereo:sample_rate=48000 -i sub.srt -filter_complex '[0:v]scale=1280x720,fade=type=in:duration=1,fade=type=out:duration=1:start_time=2,format=yuv420p[v]' -map "[v]" -map 1 -map 2 -crf 22 -c:v hevc -c:a libfdk_aac -profile:a 4 -c:s copy -t 3 wmv1.mkv"

@llogan I didn't know that the ordering is also important. I'll try this now

I have tried that. But same result as before. It seems the generated audio is not identical to the other audios. I have tried many possible combination now and no luck :(

Can you provide a link to a small sample file that is similar to source 2,3,4?

@llogan https://letsupload.co/Rhv7/out2.2ch.mkv (stereo)
https://letsupload.co/Rhv8/out2.5.1ch.mkv (5.1)
2 minutes file


text:
Optimizing ffmpeg settings for high-entropy / HIGH-DETAIL ANIMATIONS towards uploading to youtube
Based on this older question, I am looking for a good "transfer video codec / compression" for rendering videos from BMPs and/or PNGs and uploading them to Youtube. I am dealing with a lot of entropy / details in my frames.
I built a small Python framework called "bewegung" around ffmpeg and a bunch of Python visualization libraries for animating scientific data. I am calling ffmpeg as follows, writing BMPs directly to stdin:
codec = subprocess.Popen([
    'ffmpeg',
    '-y', # force overwrite of output file
    '-framerate', f'{self.fps:d}',
    '-f', 'image2pipe', # force input format
    '-i', '-', # data from stdin
    '-vcodec', 'bmp', # input codec
    '-s:v', f'{self._width:d}x{self._height:d}',
    '-c:v', 'libx264',
    '-preset', 'veryslow',
    '-crf', '0',
    video_fn,
    ], stdin = PIPE, stdout = PIPE, stderr = PIPE,)

I originally started with PNGs, but the extra compression/decompression steps simply required too much time. BMPs are faster. The BMPs are using 24 bit RGB.
For content based on a few lines and polygons, this works just fine.

When attempting to visualize content with lots of details, points / dots, for instance (in combination with change of contrast and/or color), I am running into several problems:

The above example is based on roughly 1M points, aggregated into a density plot. During fade-in, fade-out and changes in density, the quality drops significantly. Ironically, the background is also affected: It should actually be a flat gray tone, but youtube somehow (temporarily) introduces a vertical color gradient with visible steps. While the raw video (before upload) is - as expected - virtually perfect, it comes with its own set of issues: The above example requires 523 MByte of space for 10 seconds at 60 fps 1920x1080 px and barely plays on VLC. Longer videos of this kind are therefore problematic.
I have to admit that I am new to this field: Where do I start reading? How do I optimize the output of ffmpeg for this kind of content for the intended purpose?

Try Vimeo. Both sites will always transcode user submissions, the file you upload is not what the viewer is served. But Vimeo applies less compression. You're likely to be disappointed if you expect close to perfect fidelity with fine textures.

@Gyan I know that I can not expect perfection. My problem is more like: I have seen better (on Youtube). So I think that there is still room for improvement ...

do i get you wrong about you want a lossless compression?
https://trac.ffmpeg.org/wiki/Encode/H.264

Choose a CRF value
The range of the CRF scale is 0–51, where 0 is lossless, 23 is the default, and 51 is worst quality possible. A lower value generally leads to higher quality, and a subjectively sane range is 17–28. Consider 17 or 18 to be visually lossless or nearly so ...

or
https://trac.ffmpeg.org/wiki/Encode/FFV1
FFV1 is a video codec developed within FFmpeg. It is lossless, meaning that it compresses video without introducing quantization degradations.
or
you can google lossless compression

It does not have to be lossless. I want to "optimize" the kind of compression artifacts that I get on Youtube. I'd like to "force the compression into the right direction", if this makes any sense, by "playing" with the compression of the uploaded video.


text:
Video editing with playable jump forward
I'm looking for an open source video editor for windows
https://en.wikipedia.org/wiki/List_of_video_editing_software
in order to cut out some parts of a video.
A necessary feature that I'm looking for is to be able to jump forward a few seconds while playing the video (to find where I need to cut it next).
So far, I checked:

OpenShot: doesn't have the ability.
Shotcut, Avidemux, Kdenlive: it can jump forward, but it stops playing the movie, and I need to press play again, which makes in clunky.

I came up with the following solution.
Find the durations using your favorite player.
Then, use the following python script that employs ffmpeg:
# Cut out clips from a video given a text file with times, e.g.:
# 0.0-12.20
# 14.28-15.58
# 53.25-53.31
# 54.47-55.05

import sys, re, os
import datetime

fin = "8-01.mp4"
flist = "8-01_cut_out.txt"

def main():
    with open(flist) as f:
        lines = f.readlines()
    #print(lines)

    print("Durations to remove:")
    times = ["00:00:00.000"]
    #for line in sys.stdin:
    for line in lines:
        line = line.rstrip()

        reg = re.compile('(\d+)\.(\d+)-(\d+)\.(\d+)')
        m = reg.match(line)
        if not m:
            print("Couldn't find pattern:", line)
            return

        m0, s0, m1, s1 = [int(m.group(i+1)) for i in range(4)]
        t0 = "00:%02d:%02d.000" % (m0, s0)
        t1 = "00:%02d:%02d.000" % (m1, s1)
        print(t0, "...", t1)
        times.extend([t0, t1])
    # append last
    times.append("10:00:00.000")

    print(">> \nDurations:")
    fclip = open("clip_list.txt", "w")
    for i in range( len(times)//2 ):
        t0 = times[2*i]
        t1 = times[2*i+1]
        fout = "clip%02d.mp4" % i
        dur = datetime.datetime.strptime(t1[:8], "%H:%M:%S") - datetime.datetime.strptime(t0[:8], "%H:%M:%S")
        dur = dur.total_seconds()
        print(">>", fout, t0, "...", t1, "%dsec" % dur)
        if dur == 0:
            continue
        fclip.write( "file " + fout + "\n" )

        cmd = "ffmpeg -y -ss %s -i %s -t %d -c copy %s" % (t0, fin, dur, fout)
        print(">>", cmd)
        os.system( cmd )
    fclip.close()

    print("\n>> Concatenate:")
    cmd = "ffmpeg -y -f concat -i clip_list.txt -c copy out.mp4"
    print(">>", cmd)
    os.system( cmd )

if __name__ == "__main__":
    main()

I'm a beginner, so apologies if this is obvious in your code, but does datetime handle SMPTE timecode?  If not, does your code account for different frame rates?  Curious, because I know I've seen python timecode modules on github.  Here's one:  https://github.com/eoyilmaz/timecode

The script is given as a suggestion. Feel free to change and use it as you like.


text:
Add 3sec fade out of the last frame to a video
For example, given a video 1.mp4 (no audio) of 17s, output a 20s video where the last frame fades out.
What I came up with:

Extract the last frame

ffmpeg -sseof -1 -i 1.mp4 -update true last.png

Create a 3s fade-out video

ffmpeg -r 60 -loop 1 -t 3 -i last.png -vf "fade=out:st=0:d=3" 2.mp4 -y

concatenate

ffmpeg -f concat -i list.txt -c copy 3.mp4 -y
where list.txt is
file '1.mp4'
file '2.mp4'

I was wondering if there's an easier method, e.g. something base on
How to use ffmpeg to fade in/out a veriable frame rate video clip with unknown duration

No shortcut while using ffmpeg. You have to write complex_filter to complete your task.

How do you do it with filter_complex?


text:
Practice Manual Focussing
I'm planning on shooting a short film in about 2 weeks with my Nikon d5300. Since its aAutofocus is unusable for video (it's great for photos, but too slow to be used for video in live view), I decided to manually focus. There will be many close-up shots (i.e. the actor's face, maybe a bit of the shoulders) with a shallow depth of field (up to f/1.8, 35mm). Often, the distance to the subject will vary throughout the shot as there will be camera movement.
So I figured I need to practice manual focussing. How? Do I simply take an object, record a video, move the camera and try to keep in in focus? Do you have any other tips?

Update
I still did not get to shoot the short film as planning didn't go as expected and then, I had a lot of stress with school. However, the answers so far are great in that they explain how MF is usually done on a higher budget. I still however miss how I can practice focussing manually.

Ever see the credit for "focus puller" in a film's credits? That's a single person's job, just to keep the camera focus where it should be on a moving shot (or even for changing the focus point at the right time in an otherwise static shot).
Usually the shot would be blocked out before hand, and they would work out exactly where the object of focus is going to be throughout the shot - they know in advance exactly where the focus needs to be at what time, and that person will make those focus adjustments as the shot is filmed, while other independent operators are moving, zooming, tracking, etc the camera. If your camera has the ability for the focus to be remote controlled via a pre-programmed sequence, that is also an option (usually you would remote control the camera movement as well, so it is all in sync).
Trying to manually track the focus while you're also operating the rest of the camera will be difficult to achieve accurately. I would consider breaking up your shots if possible, and cutting between more static shots. Otherwise just rehearse the shots as much as you can - it's not that it can't be done, but there's a reason films have an independent person working on just that task.

This is a good answer. I might add a mention of a "follow focus" device, and that the 1st AC (First Assistant Camera) position often acts as a focus puller when no separate focus puller is available.

Don't try to judge critical focus from the viewfinder on the back of the camera. They are usually far too low resolution to be able to tell if things are pin-sharp or not (even with a loupe device). You'll need an external monitor, the higher resolution the better. You can use focus assist if your camera has it, which adds a highlight colour to sharp edges. This is useful for run-n-gun situations but again for critical focus relying on that alone will often result in disappointment.


text:
How to recreate these effects I found on IG?
It is some kind of body glow, either blue or red with big 'chiaroscuro', everything else being black
https://i.sstatic.net/dGg7S.jpg
that'd be mega helpful for me, you'd make my day :))

You need a video editor that let you add curves to your video. Davinci Resolve is a great option.

Convert it to grayscale, you can simply reduce the saturation to 0.
Invert the curve. Augment the contrast making the curve more vertical.

Bring the green and Blue channels all the way down

Play a bit more. But that is the idea.

Option two for the final color is to add a color rectangle with different blending mode in the editor.

https://pixabay.com/es/photos/verano-flor-cabello-retrato-cara-4246927/


text:
What is the best version of After Effects to use on my workstation?
I have a HP Z600 workstation with these specs:
Processor: Intel Xeon x5650 x2
Memory (RAM): 6*8gb = 48GB total ram
Graphics card: Nvidia Quadro k620 2gb Vram
Windows 10
Which version of After effects should I use that will work fine with these workstation?

First use the trial to test if it runs well on your system. It's the same version as the full version. If you start After Effects it will ask if you want to start the trial now (unless they changed the procedure since the last time I looked).
Adobe has this cloud apps overview tool that let's you install and update apps. Here you could also choose to install an older version and I think you can even install multiple versions side by side. However my recommendation is to work always with the latest version.


text:
How to count datapoints in a JSON file with expressions in After Effects?
I load a JSON file with expressions in after effects. I need to know the number of datapoints  in that JSON file for further processing.
How can i count (or index?) Them with expressions?

Can you share the json file, or a dummy version of it? And an example of what you need to extract from the file?


text:
Export timeline with multiple audio tracks as video with single audio track in DaVinci Resolve 16
Disclaimer upfront: I'm a beginner when it comes to video editing, so I'm maybe using the wrong terms to describe my problem.
The task
I'm working on an OBS recording of myself, where I wanted to replace a part of the video with another video in DaVinci Resolve 16 on Windows.
Cutting the old video and inserting the new video was done quickly, and left me with two video and two audio tracks in the timeline (see screenshot). The audio clips are processed separately in Audacity and were later imported (from WAV), and are linked with the videos before cutting, if that matters.

The preview in Resolve looked and sounded satisfying, so I went to Deliver to get a final render of the whole clip. These were the initial settings in Video, Audio and File:

The problem
In the final video, the sound went silent in the section where the second audio track was supposed to be. Poking at the video with VLC revealed that there was indeed a second audio track with the sound only in that part. What I had hoped for was a single audio track much like there is only a single video track.
What I've tried
(I think) I then tried basically all alternatives I could find in the Deliver settings, threw quite a few combinations of "multiple" "audio tracks" "export" and "davinci resolve 16" at Google and the Video Production search, and also skimmed through the tutorial and reference manual of Resolve, but to no avail.
The only way that I could find to achieve what I wanted was to move the inserted clip's audio and video track to those of the original video. But I guess there has to be another "proper" way to do this, because my approach would e.g. not work for music.
The question
Can anybody give my a hint what it is that I'm missing? I reckon it has to be something very basic, that I should be ashamed of having overlooked it all the time :-D
Edit: I somehow managed to get it to work, but I'm unfortunately not sure how. So I'd still be happy if somebody could give a proper explanation.

The likely culprit is the Audio setting [Output Track 1], which should normally be "Main 1 (Stereo)", which is the default final bus/mix of the audio in the compiled video.
When setting it to "All timeline tracks" -- each audio track (stereo or mono) is rendered as separate tracks (stereo or mono) in the output file.

Seems like this would be the default. So maybe it was just me being a bit premature in trying to change settings.


text:
Davinci Resolve Fusion draw tail by track points
I hope someone will understand my question.
This is my fusion clip right now

I want to draw a tail of this purple circle.
Can't understand which tool will help me.
Nodes:

I want something like this:

You can get that result with the trails node.  It echoes previous frames to make light streaks, smoke whips, and similar effects.  You could use a scale value of less than one to get the tail of the object to shrink toward the end.  Playing with the gain would make it fade out with age.  For a sharp tail, like the ones in your example, leave the blur size at zero.
Be careful though, trails is a resource-hungry node which isn't optimized well.  It's an easy, direct way to get the result you're after, and the first one that comes to my mind, but it's probably not the most efficient.  Also, it requires the playhead to be moving, and skipping around on the timeline will give you weird results, which is what the "reset" button is for.  Play around with it a little, and you'll see what I mean.
One final tip: use small value increments.  Hold the alt/option key when you're adjusting parameters with trails to do fine adjustment, because the results stack exponentially.


text:
ffmpeg cancels extremely often with no apparent reason
I have a webcam running on my Wifi, and am saving its stream to my harddisc drive. This is called by a python script which continuously restarts the recording (I want to have 4h long video files, not infinitely long video).
My calling code:
"D:/Program Files/ffmpeg-4.2.2-win64-static/bin/ffmpeg.exe"  -y -err_detect ignore_err -re -rtsp_transport tcp -i rtsp://admin:123456@192.168.178.54:554/live/ch0 -t 14400 -vcodec copy -acodec copy .\200430\Falken-200430-2340.mkv

A sample output I get before the process stops:
ffmpeg version 4.2.2 Copyright (c) 2000-2019 the FFmpeg developers
  built with gcc 9.2.1 (GCC) 20200122
  configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libdav1d --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmpt
  libavutil      56. 31.100 / 56. 31.100
  libavcodec     58. 54.100 / 58. 54.100
  libavformat    58. 29.100 / 58. 29.100
  libavdevice    58.  8.100 / 58.  8.100
  libavfilter     7. 57.100 /  7. 57.100
  libswscale      5.  5.100 /  5.  5.100
  libswresample   3.  5.100 /  3.  5.100
  libpostproc    55.  5.100 / 55.  5.100
Input #0, rtsp, from 'rtsp://admin:123456@192.168.178.54:554/live/ch0':
  Metadata:
    title           : hysxrtpsion
  Duration: N/A, start: 0.533000, bitrate: N/A
    Stream #0:0: Video: h264 (High), yuvj420p(pc, bt709, progressive), 1920x1080, 20 fps, 24.83 tbr, 90k tbn, 40 tbc
Output #0, matroska, to '.\200430\Falken-200430-2339.mkv':
  Metadata:
    title           : hysxrtpsion
    encoder         : Lavf58.29.100
    Stream #0:0: Video: h264 (High) (H264 / 0x34363248), yuvj420p(pc, bt709, progressive), 1920x1080, q=2-31, 20 fps, 24.83 tbr, 1k tbn, 90k tbc
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
Press [q] to stop, [?] for help
[matroska @ 000002a85f765040] Non-monotonous DTS in output stream 0:0; previous: 0, current: -272; changing to 0. This may result in incorrect timestamps in the output file.
[matroska @ 000002a85f765040] Non-monotonous DTS in output stream 0:0; previous: 0, current: -232; changing to 0. This may result in incorrect timestamps in the output file.
[matroska @ 000002a85f765040] Non-monotonous DTS in output stream 0:0; previous: 0, current: -152; changing to 0. This may result in incorrect timestamps in the output file.
[matroska @ 000002a85f765040] Non-monotonous DTS in output stream 0:0; previous: 0, current: -111; changing to 0. This may result in incorrect timestamps in the output file.
[matroska @ 000002a85f765040] Non-monotonous DTS in output stream 0:0; previous: 0, current: -71; changing to 0. This may result in incorrect timestamps in the output file.
[matroska @ 000002a85f765040] Non-monotonous DTS in output stream 0:0; previous: 0, current: -31; changing to 0. This may result in incorrect timestamps in the output file.
frame=  725 fps= 20 q=-1.0 Lsize=    6387kB time=00:00:36.11 bitrate=1448.8kbits/s speed=0.991x
video:6381kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.100017%

If anyone wants to see it, this is my python wrapper which repeatedly simply calls ffmpeg to grab the camera stream:
import subprocess
from datetime import datetime
import os

def ensure_dir(directory):
    if not os.path.exists(directory):
        os.makedirs(directory)

while True:
    dateString = datetime.today().strftime('%y%m%d-%H%M')
    folderString = datetime.today().strftime('%y%m%d')
    folderString = '.\\' + folderString
    ensure_dir(folderString)
    videoFilename = folderString + "\\Falken-" + dateString + ".mkv"

    commandLine = "\"D:/Program Files/ffmpeg-4.2.2-win64-static/bin/ffmpeg.exe\"  -y -err_detect ignore_err -re -rtsp_transport tcp -i rtsp://admin:123456@192.168.178.54:554/live/ch0 -t 14400 -vcodec copy -acodec copy " + videoFilename
    print("\nCalling new ffmpeg process\n", commandLine)
    process = subprocess.Popen(commandLine, shell=True, stdout=subprocess.PIPE)
    process.wait(14404)
    process.kill()

The video grabbing should run for 4h (14400 seconds), and instead it usually halts after 5-15 minutes (at random points). If there are lost packets or similar, why doesn't ffmpeg just go on (ignore_err)?

Don't add -re for live inputs.

Okay, tested, I still get a lot of halts on the recording. I added verbose log output, and get No more output streams to write to, finishing. Searching for that though did not really help unfortunately, found no solid answer on this.


text:
Color profiles in videos
Does the AV-Kit of macOS use the color profiles that may be in the metadata of video files of some formats such as MP4? I am the manual author for GraphicConverter from lemkesoft and need to explain the usage of color profiles in pictures (what I konw about) and video (what is new to me). So I do not need help in a certain work situation but instead background knowledge.

Please don't take conversation off post and into email or offsite. Also, can you clarify what application you are running on macOS

I do not envy your position or the task set before you. Good luck, and Godspeed. https://xkcd.com/1882/


text:
Best ffmpeg configuration for universal video codec compatabiltiy across browsers
I intend to get a transcoding setting to support all browsers at the same time including, chrome, firefox and safari.
Currently I am using following, yet this does not provide a valid video with Safari :
ffmpeg -i ${f} -y -vcodec libx264 -acodec aac -preset faster videofile-new
What would be the suggestion here for the configuration ?

the -f mp4 is redundant if the file extension is .mp4

Show the complete log.


text:
Create a video from a changing jpg image with FFmpeg
I have this one jpg image which changes approx. every 4 seconds.
Based on this image, I want to make a 60 second long video.
I tried this.
ffmpeg -t 60 -loop 1 -r 1 -i input.jpg -r 1 output.mp4
This code makes a 60 second long video of the current image...
But I want a video of how the image has changed in the 60 seconds.
How can i do this with FFmpeg ?
Alternatively, I thought maybe I might be able to stream the image while grabbing this stream.

I do not think it would be practical to expect FFMpeg to do something like this. However, we can note, that there is no way to actually finish this task in less than 4 minutes anyhow, so the slight overhead needed to encode the video after grabbing all the images is minor.
Therefore, i would approach it in two steps:
First, grab all the frames:
for i in {01..60}; do cp input.jpg $i.jpeg; sleep 4; done

And only then do we encode:
ffmpeg -r 1 -i %02d.jpeg [other encoding options you may need] [output]

Once you are satisfied, simply remove the temporary files.

I'm not sure what you mean by "changing jpg image". If you mean that you have 15 images in total (x4 = 60 secs) then you could create an image sequence and use a framerate of 0.25 when encoding.
Files:
image01.jpg
image02.jpg
   ⁞     ⁞     ⁞
image15.jpg
Command:
ffmpeg -i image%02d.jpg -r 0.25 EncoderOptions output.mp4
(If the input isn't recognised, include the format: ffmpeg -f image2 -i ...)

EDIT: An example with encoder options:
ffmpeg -i image%02d.jpg -r 0.25 -pix_fmt yuv420p -c:v h264 -crf 21 -preset veryfast output.mp4


text:
Resolution loss by chromatic subsampling: is there a workaround?
I was trying to make some recordings of a game (with OBS), but it wasn't really good even with "lossless" options. Some part of the interface was just pixelated... After a while I realized that the chromatic subsampling should cause the problem, as the pixelated interface is red. (In OBS the default color format is NV12, using RGB instead - without subsampling - it was all good.)
Is there a workaround to keep the resolution of the interface intact, but still do some kind of chromatic subsampling? (Maybe with some other color encoding than YUV?)
It's Ok if I need to make the recordings without subsampling, and than convert/transcode the videos. I would do it anyway, as OBS can't record with hevc_qsv. Also I don't have an intent to publish these videos on the internet. (Probably I'd like to store the videos using H265 or AV1, to obtain the best compression.)

No. Almost all video on the planet is limited YUV420 (all Blu-rays, even HEVC ones with Dolby Vision, all Youtube, only some satellite FEEDs not for consumers use 4:2:2). Sorry. Of course, there is RGB and even mathematically lossless mode in all common encoders, H.264/AV1/VP9/HEVC... For lossless AV1 see https://trac.ffmpeg.org/ticket/7600
But, alas. It is not used at all.
Only Dolby Vision in profile 5 that is not HDR10 compatible (it uses IPTPQc2 color instead of YCbCr and FULL RANGE) can be good enough for you. It still uses 4:x:x chroma but because of new encoding it is much better looking!

Yeah, I suspected. Thanks for your answer. Anyway using OpenGL ("for Windows")  as video output instead of Direct3D(9) also helps a bit. It must use some kind of interpolation, so at least it's just a bit blurred, rather than pixelated.

Huh, I randomly found some options (with x265 encoder, but others might have this as well): "CrQPOffset" and "CbQPOffset". With these it is possible to apply different QP ("quality") values for the "Cr" and "Cb" components (relative to the overall QP value). This seems to be about as effective as chromatic subsampling, but more flexible. Using these and YUV444 colors there is no observable resolution loss. :) (Also I think these might be used with NV12/YUV420 or YUV422 to obtain even more compression, but I don't know how this would effect the colors.)


text:
Is there a way of creating a "natural" highlighter effect through Kdenlive?
On 15:20 of How To Make Vox Style Videos - After Effects Tutorial, YouTuber Mapal uses Turbulent Displace in After Effects to add a more natural look to the highlighter/marker effect typical of Vox videos. Note how the edges are imperfect, so they appear more natural:

Is there a way of doing something like that through Kdenlive?
The rest of the highlighter effect is shown in both these 2 videos:

Simple4Brain Tech Tutorials - Correct way✅ to highlight text in #kdenlive  23.08.1 (without changing opacity) | Simple4Brain
Fabiano from Brazil - KDENLIVE: Marker effect | Text highlighter effect in 2 minutes

I've also asked this question on r/kdenlive.

@Arkengheist suggested the effect pixs0r on r/kdenlive.


text:
After effects Trapcode Tao put image inside the sphere
I'm using Trapcode Tao plugin for an audio reactor sphere . Now the only view of my sphere is depended on the Material & Lighting > Image Based Lighting > Built-in Environment  and it is Dark Industrial mode
This Screenshot :

I just want to know is there a way to use an image (custom image) instead of this Environment inside the sphere ?

After some research I found a solution from the official Red Giant documentation

If Built-in Environment is set to None, you can choose a layer to use as a custom reflection map using the Reflection Environment Map pop-up menu. Any image can be selected, but to make a correct environment map it should be a spherical map (also called a “lat/long map” or an “equirectangular map.” Note that a “sphere map” is something else). Note that using a very large environment map uses a lot of space on the GPU.

Just import your image and select it from Reflection Environment menu
Material & Lighting > Image Based Lighting > Reflection Environment


text:
After importing object from illustrator it auto animates making it impossible to animate on my own
I import the file using right click and import.
Untitled1 is at position A at 0:00
Untitled1 is at position B at 0:01
Untitled1 is invisible on Composition at 0:02
Can't add keyframes to Untitled1 layer.
Why is this behavior so?
I'd like to animate Untitled1 normally.

You need to tell us what exactly you did (esp. how you've imported the file) and should provide a screenshot where we can see the problem. Also, I don't know what you mean with "auto animates". You can click "edit" below your text to add these details.

I saw you edited the question, but I'm still lost. Could you share the AI file and your After Effects project file?

Maybe it'¿s a computer glitch, I ended up abandoning the project altogether. will rellook at some given time in the future thank you musch.


text:
What is the little blue line above the timeline called?
i'm trying to find out what this thing is called,

it's the little blue line above the timeline, is there a name for it? what does it do? thank you.

It's not clear what you mean. I see a dark-teal-coloured bar at some time which is a selection, but I don't know if that's what you mean. Make a screenshot and mark the object of interest.

ok, how do i upload a picture in my post or comment? thanks

Click on "Edit" below the question and above the text input field there is a little picture, right next of the curly brackets, click on it.

ok i did it i think thank you.

They call that a "zone" which is something like a selection of the timeline. The video you've linked already shows how it can be used.
I don't know why it's already there at the beginning of the video, it seems intentional and a very short Zone-bar is always there by default. That's maybe to remind the user of this feature but in any case is a strange decision in regard of user experience.
The manual indicates such a zone can also be set via the program monitor. More in the manual.


text:
YouTube Video Tearing/Flickering - how to prevent?
I just recently started making videos. I am recording my 4k screen at 4k60fps with OBS studio and then edit and export using premiere pro also in 4k60fps (H.264). The exported footage does not have this issue however when I upload to youtube I get flickering and tearing especially in the background. Is this an issue with fps or target bitrate? Does it have something to do with using CBR vs VBR? Could I fix this by increasing target bit rate? Would exporting to pro res help instead of H.264 help?
To see what I mean I will link the video here:

You will see the issue especially on the upper third of the video on the background of the chart.
Could you please help me understand why this happens and how I can prevent it?

I don't see any tearing, or any problem at all, watching the 4k version on a 4k capable system. Maybe your browser's hardware accelaration is turned off? Otherwise, tearing is pretty much always related to the video driver. Try a driver update and check vertical sync settings (or Adaptive VSync, Smart VSync).

mhh strange i tried it with different browsers and machines and have the same issue with all of them. i also think the issue is that i exported with 24 fps by accident.