text:
Some H.264 videos that I have seem to have excessive bitrate, is there a way to determine/find their recommended bitrate?
So I have some videos that are Full HD, h264 but they have over 30M bitrate at 30 FPS, they are SDR and their quality is not very impressive so it seems excessive and unnatural for such unimpressive quality - I have seen much better looking h.264 content with 60 fps with even half of this bitrate. So what I did try to do is use -crf 17 (yes, without encoding), to see how much this will reduce them and it usually does do a good job for example it made the file to about 12M, I also tried -fs with even a higher number of size than the original, and it brought the file down to 5M bitrate, I don't know what actually happens behind the scenes with this, but I think the video looks a bit worse, not much though compared to the 30M that it was.
So how, if even possible, do I correctly determine the bitrate of a video if it seems excessive?

So how, if even possible, do I correctly determine the bitrate of a
  video if it seems excessive?

There's not a "correct" way.  That's why every encoder you come across presents bitrate as an option to the user.  The visual complexity of every video is different, and visual tolerance levels of artifacting is subjective in every case.  File size vs image quality will always be a tradeoff, and it takes an informed human being to decide where that tradeoff is most acceptable.
But to focus more on the "how" one best makes this decision, there's not much to say other than: trail and error.
You can bifurcate.  That is, pick a high number, try it, pick a low number, try it, then pick a number between whichever direction was more suitable, rinse and repeat.  It's still a subjective process.  If you search the internet, it's not hard to find ballpark ranges to get you started, given the specifics of your output requirements (resolution, framerate, etc).  When you do this, you should use a representative subset of your total output to test, so that you can iterate more quickly.
Also, be sure to consider your destination platform.  You don't mention it in the question, but it will affect your decision.  If you're delivering to bluray, for example, you have a hard limit on total file size, and you'll probably want to optimize quality for that specific target.  On the other hand, if you're delivering to an online streaming service, you might want to go for maximum quality because YouTube, Vimeo and the like will automatically generate lower-quality versions to serve to people with slower connections.  Conversely, you might value high-speed upload for quick turnaround times.  Only you can decide.

Thank you for your answer. So just to be clear, when someone does a compression to a video, and you can never get back to the same quality before the compression, if someone per se increases the bitrate non-organically and then you want to reduce to the bitrate/size as the original file (which technically is not compressing), you again can't do that without losing quality?

So, what I'm saying is: Let's call your high-quality source material (A), your test exports (Bx), and your final output (C), with x representing the bitrate you're evaluating.  For simplicity, say x is a value between 0 and 1.  You'd export A->B(.01), A->B(.99), A->B(.5), evaluate each, throw out the worst result, and pick a number between the other two, say A->(B.75).  You repeat the process until you're satisfied, and call the result C.  Notice you're always going from A to B.  You don't go A->(B.75) then B(.75)->B(.88).  You would go A->(B.75) A->(B.88).

So as far as generational loss goes, you're always only moving one step away from your master.  This process can get way more complicated when you're talking about very  large source files (4K and up, uncompressed RAW, etc), intermediate codecs for editing, proxies, round tripping, color correction from masters, and the different situations where these all come into play.  But the basic rule of thumb is:  Always work with the highest quality media your hardware can handle without hiccups.  Then deliver the highest tolerable compression you can by going straight from original to final.

When you say, "when someone does a compression to a video, and you can never get back to the same quality before the compression," if you don't have the original video that the person used to perform that compression, then you've essentially lost your "A", and whatever they've given you is the new "A."  So, you're right, you can never get back the same quality.  Dialing up your bitrate above where it was when they gave you the file doesn't do anything besides (potentially) make the file bigger.

But if you're saying you have a video that somebody already turned up past it's original bitrate, and you want to dial it back to the original value, yes you can do that and it should at least visually match and be the same file size as the original.  The amount of entropy you'll encounter probably depends on the codec/situation.  You could test by repeating the process over and over and check for image degradation.  i.e. go A->B(1.5)->B(1)->B(1.5)->B(1)... over and over, like the telephone game, then compare A to B.

Determining The best bit rate is more of an art form then a science. As soon as you go from a loss less to a lossy format, you’re accepting compromise. If the scene has a lot of natural blur, you may be able to get away with a surprisingly low bit rate before the effect is noticeable. Consumer playback systems may not be able to reproduce all the content contained in your  high bit rate stream. It’s a balance of audience, playback expectations and how much you can get away with.
With video, you’ll need a higher bit rate whenever there’s rapid change that you want to preserve or intricate detail that doesn’t compress well. With audio, there’s a point where you can hear the artifacts, but different people pick up the playback errors at different loss rates for different types of music. Classical guitar may not tolerate much compression because it’s high attack plucking. Rock guitar may compress well because the accuracy of the notes isn’t something you can pick out easily and, as Billy Joel would say...it’s still rock and roll to me. Animation with sharp lines may require a higher bit rate than expected because pixelation is immediately obvious.
Anyhow...my solution is to start with the cleanest, highest resolution uncompressed source, then drop bit rate until I can tell there are defects, then try to be a touch more generous.
If you’re doing video, you may be able to do a comparison mask that makes the discrepancies more obvious. With audio, if I can visually compare waveforms, I’ll reduce bitrate in the less important passages, but boost it if there’s a silent passage or one with lots of complexity. Almost any compression on a silky voice like Nat King Cole’s is quickly audible.
I guess I’m saying that you need to do manual comparisons until you’re sick of watching/listening to the material.
And be careful with VBR. it’s not a cure-all, unless you have control over where bits are spent.

Very well stated, Jason. You bring up the point that some media can’t store uncompressed, like Blu-Ray and DVD, and VCD. Always try to create a compressed version from the original. If you compress an already compressed video or audio track, errors build up that simply can’t be un-done.

Audio compression is a good analogy, and one good use of video scopes is to evaluate compression as you're describing by "visually compar[ing] waveforms."  In fact, one of the video tools people use is called a "waveform monitor."  The difference between 8bit and 10bit video, or the difference between proresLT and proresHQ, can be difficult to see with the naked eye, for example.  But video scopes such as waveform monitors and vectorscopes can show you exactly what you're losing.


text:
How to animate size parameter of ffmpeg zoompan filter?
How is it possible to dynamically evaluate the s (output image size) parameter of ffmpeg zoompan filter on each frame?
The parameter expectes its value in "WxH" format i.e. "1920x1080".
How to substitute an expression that would update the size as a function of, say, frame number?
Couldn't find a way to concatenate strings.
For a single number parameter I can do smth like y='(out_h-in_h)/2', but how to take two expressions and join them with an "x" string?

The zoompan size parameter cannot be animated. It has to be a fixed numeral size of the form WxH, or a size label like hd1080.

Thank You again, Gyan!
I was hoping to achieve less than 100% zoom without padding by tweaking output size )

source: Stack Exchange

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

sort: votes


text:
FFmpeg being killed when creating tiled overlayed video
I am trying to creeate a tiled video using FFmpeg - a result of putting several videos together, tiled, using -filter_complex with overlays.
Following the how-to here, I have created a script that can tile any number of videos.
The issue is, FFmpeg is being killed during the process. It seems that as few as 4 videos can eat all system resources and I think the Linux core kills FFmpeg.
Killed 8235 fps= 20 q=28.0 size=  107008kB time=00:59:22.17 bitrate= 246.1kbits/s speed=8.86x

The file sizes range but they are nothing too large - typically, FullHD. The files are on an EncFS virtual drive. I have 16 GB ram + 16 GB swap, and the fast SSD (Samsung EVO 850).
How can I prevent this? Is there some way to make FFmpeg use some on-disk buffer? Or perhaps some other approach other than -filter-compled?
I was thinking about joining 2 videos at a time and making it bottom-up, but that would be really very slow and tedious, even if scripted.
ffmpeg \
>      -i '1.mp4' \
>      -i '2.mp4' \
>      -i '3.mp4' \
>      -i '4.mp4' \
>      -i '5.mp4' \
>      -i '6.mkv' \
>     -filter_complex "nullsrc=size=1440x540 [lay0];
>           [0:v] setpts=PTS-STARTPTS, scale=480x270 [TILE_1_1];
>           [1:v] setpts=PTS-STARTPTS, scale=480x270 [TILE_1_2];
>           [2:v] setpts=PTS-STARTPTS, scale=480x270 [TILE_1_3];
>           [3:v] setpts=PTS-STARTPTS, scale=480x270 [TILE_2_1];
>           [4:v] setpts=PTS-STARTPTS, scale=480x270 [TILE_2_2];
>           [5:v] setpts=PTS-STARTPTS, scale=480x270 [TILE_2_3];
>           [lay0][TILE_1_1] overlay=shortest=1:x=0:y=0 [lay1];
>           [lay1][TILE_1_2] overlay=shortest=1:x=480:y=0 [lay2];
>           [lay2][TILE_1_3] overlay=shortest=1:x=960:y=0 [lay3];
>           [lay3][TILE_2_1] overlay=shortest=1:x=0:y=270 [lay4];
>           [lay4][TILE_2_2] overlay=shortest=1:x=480:y=270 [lay5];
>           [lay5][TILE_2_3] overlay=shortest=1:x=960:y=270     "      -c:v libx264 ./tiled.mp4
ffmpeg version 4.1-static https://johnvansickle.com/ffmpeg/  Copyright (c) 2000-2018 the FFmpeg developers
  built with gcc 6.3.0 (Debian 6.3.0-18+deb9u1) 20170516
  configuration: --enable-gpl --enable-version3 --enable-static --disable-debug
   --disable-ffplay --disable-indev=sndio --disable-outdev=sndio --cc=gcc-6
   --enable-fontconfig --enable-frei0r --enable-gnutls --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-libvorbis --enable-libopus --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc
   --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzimg
  libavutil      56. 22.100 / 56. 22.100
  libavcodec     58. 35.100 / 58. 35.100
  libavformat    58. 20.100 / 58. 20.100
  libavdevice    58.  5.100 / 58.  5.100
  libavfilter     7. 40.101 /  7. 40.101
  libswscale      5.  3.100 /  5.  3.100
  libswresample   3.  3.100 /  3.  3.100
  libpostproc    55.  3.100 / 55.  3.100
[h264 @ 0x6722b80] A non-intra slice in an IDR NAL unit.
[h264 @ 0x6722b80] decode_slice_header error
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '1.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 0
    compatible_brands: mp41avc1qt
    creation_time   : 2015-05-03T12:48:13.000000Z
    encoder         : vlc 2.1.6 stream output
    encoder-eng     : vlc 2.1.6 stream output
  Duration: 01:29:40.93, start: 0.000000, bitrate: 583 kb/s
    Stream #0:0(eng): Audio: mp2 (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 127 kb/s (default)
    Metadata:
      creation_time   : 2015-05-03T12:48:13.000000Z
      handler_name    : SoundHandler
    Stream #0:1(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 640x480 [SAR 1:1 DAR 4:3], 2230 kb/s, 15 fps, 15 tbr, 1000k tbn, 30 tbc (default)
    Metadata:
      creation_time   : 2015-05-03T12:48:13.000000Z
      handler_name    : VideoHandler
Input #1, mov,mp4,m4a,3gp,3g2,mj2, from '2.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 0
    compatible_brands: isom3gp4
    creation_time   : 2014-05-16T10:47:46.000000Z
  Duration: 00:33:58.60, start: 0.000000, bitrate: 18114 kb/s
    Stream #1:0(eng): Video: h264 (Baseline) (avc1 / 0x31637661), yuv420p, 1920x1080, 17919 kb/s, SAR 1:1 DAR 16:9, 19.85 fps, 24.83 tbr, 90k tbn, 180k tbc (default)
    Metadata:
      rotate          : 90
      creation_time   : 2014-05-16T10:47:46.000000Z
      handler_name    : VideoHandle
      encoder         :
    Side data:
      displaymatrix: rotation of -90.00 degrees
    Stream #1:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 190 kb/s (default)
    Metadata:
      creation_time   : 2014-05-16T10:47:46.000000Z
      handler_name    : SoundHandle
Input #2, mov,mp4,m4a,3gp,3g2,mj2, from '3.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: isommp42
    creation_time   : 2018-08-31T09:08:36.000000Z
  Duration: 00:09:44.19, start: 0.000000, bitrate: 7147 kb/s
    Stream #2:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709), 1920x1080 [SAR 1:1 DAR 16:9], 7017 kb/s, 29.81 fps, 29.81 tbr, 29809 tbn, 59.62 tbc (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #2:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 128 kb/s (default)
    Metadata:
      creation_time   : 2018-08-31T12:37:17.000000Z
      handler_name    : IsoMedia File Produced by Google, 5-11-2011
[h264 @ 0x6749140] A non-intra slice in an IDR NAL unit.
[h264 @ 0x6749140] decode_slice_header error
Input #3, mov,mp4,m4a,3gp,3g2,mj2, from '4.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 0
    compatible_brands: mp41avc1qt
    creation_time   : 2015-10-08T10:04:06.000000Z
    encoder         : vlc 2.1.6 stream output
    encoder-eng     : vlc 2.1.6 stream output
  Duration: 00:58:58.61, start: 0.000000, bitrate: 1099 kb/s
    Stream #3:0(eng): Audio: mp2 (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 127 kb/s (default)
    Metadata:
      creation_time   : 2015-10-08T10:04:06.000000Z
      handler_name    : SoundHandler
    Stream #3:1(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 640x480 [SAR 1:1 DAR 4:3], 966 kb/s, 15.07 fps, 15 tbr, 1000k tbn, 30 tbc (default)
    Metadata:
      creation_time   : 2015-10-08T10:04:06.000000Z
      handler_name    : VideoHandler
Input #4, mov,mp4,m4a,3gp,3g2,mj2, from '5.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: isommp42
    creation_time   : 2016-09-23T09:25:07.000000Z
    com.android.version: 6.0.1
  Duration: 00:18:43.67, start: 0.000000, bitrate: 17643 kb/s
    Stream #4:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1920x1080, 17500 kb/s, SAR 1:1 DAR 16:9, 29.98 fps, 29.97 tbr, 90k tbn, 180k tbc (default)
    Metadata:
      creation_time   : 2016-09-23T09:25:07.000000Z
      handler_name    : VideoHandle
    Stream #4:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 155 kb/s (default)
    Metadata:
      creation_time   : 2016-09-23T09:25:07.000000Z
      handler_name    : SoundHandle
Input #5, matroska,webm, from '6.mkv':
  Metadata:
    encoder         : android
  Duration: 00:05:29.41, start: 0.000000, bitrate: 22503 kb/s
    Stream #5:0: Audio: flac, 96000 Hz, stereo, s32 (24 bit) (default)
    Stream #5:1: Video: h264 (Baseline), yuvj420p(pc, smpte170m, progressive), 1920x1080, SAR 1:1 DAR 16:9, 30 fps, 30 tbr, 1k tbn, 2k tbc (default)
File './tiled.mp4' already exists. Overwrite ? [y/N] y
Stream mapping:
  Stream #0:1 (h264) -> setpts (graph 0)
  Stream #1:0 (h264) -> setpts (graph 0)
  Stream #2:0 (h264) -> setpts (graph 0)
  Stream #3:1 (h264) -> setpts (graph 0)
  Stream #4:0 (h264) -> setpts (graph 0)
  Stream #5:1 (h264) -> setpts (graph 0)
  overlay (graph 0) -> Stream #0:0 (libx264)
  Stream #0:0 -> #0:1 (mp2 (native) -> aac (native))
Press [q] to stop, [?] for help
[h264 @ 0x85cd140] A non-intra slice in an IDR NAL unit.
[h264 @ 0x85cd140] decode_slice_header error
[h264 @ 0x72c9100] A non-intra slice in an IDR NAL unit.
[h264 @ 0x72c9100] decode_slice_header error
[swscaler @ 0xa2858c0] deprecated pixel format used, make sure you did set range correctly
[libx264 @ 0x85b9d40] using SAR=1/1
[libx264 @ 0x85b9d40] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
[libx264 @ 0x85b9d40] profile High, level 3.1, 4:2:0, 8-bit
[libx264 @ 0x85b9d40] 264 - core 157 r2935 545de2f - H.264/MPEG-4 AVC codec - Copyleft 2003-2018 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=12 lookahead_threads=2 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to './tiled.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 0
    compatible_brands: mp41avc1qt
    encoder         : Lavf58.20.100
    Stream #0:0: Video: h264 (libx264) (avc1 / 0x31637661), yuv420p, 1440x540 [SAR 1:1 DAR 8:3], q=-1--1, 25 fps, 12800 tbn, 25 tbc (default)
    Metadata:
      encoder         : Lavc58.35.100 libx264
    Side data:
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
    Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 128 kb/s (default)
    Metadata:
      creation_time   : 2015-05-03T12:48:13.000000Z
      handler_name    : SoundHandler
      encoder         : Lavc58.35.100 aac
Killed 8235 fps= 20 q=28.0 size=  107008kB time=00:59:22.17 bitrate= 246.1kbits/s speed=8.86x

It seems that overlays are not suitable for this.
I have replaced overlay with xstack, and so far, the tiling with 5x5 tiles continues to run.
ffmpeg \
>      -i 'input1.mp4' \
... 24 other inputs ...
>     -filter_complex "
>           [0:v] setpts=PTS-STARTPTS, scale=480x270 [TILE_1_1];
>           [1:v] setpts=PTS-STARTPTS, scale=480x270 [TILE_1_2];
...
>           [24:v] setpts=PTS-STARTPTS, scale=480x270 [TILE_5_5];
>     [TILE_1_1][TILE_1_2][TILE_1_3][TILE_1_4][TILE_1_5][TILE_2_1][TILE_2_2][TILE_2_3][TILE_2_4][TILE_2_5][TILE_3_1][TILE_3_2][TILE_3_3][TILE_3_4][TILE_3_5][TILE_4_1][TILE_4_2][TILE_4_3][TILE_4_4][TILE_4_5][TILE_5_1][TILE_5_2][TILE_5_3][TILE_5_4][TILE_5_5]xstack=inputs=25:layout=0_0|480_0|960_0|1440_0|1920_0|0_270|480_270|960_270|1440_270|1920_270|0_540|480_540|960_540|1440_540|1920_540|0_810|480_810|960_810|1440_810|1920_810|0_1080|480_1080|960_1080|1440_1080|1920_1080"
> -c:v libx264 ./tiled.mp4

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


text:
What is the opposite of 360 video?
I would like to make a video out of N cameras all focusing a central area from different points of view.
In order to do it, I first need to know how is that kind of video called; I would like to obtain something like a 360 video, but at the same time it is the exact opposite of a 360 video, because 360 video allow the user to see all around an object, I want instead to allow user to see an object from all around.
(for example, something similar to the rotation you can do on a 3D object on 3D modeling softwares)
That said

How is that kind of video called?
Is it possible to make something like that with FFMPEG? (I accept a yes/no answer :) )

Thanks all!

I think what you're looking for is called "photogrammetry" and is produced by taking several images (or an image sequence from a video) and comparing the perspective, scale, and overall shape of the captured image and how it changes.
Using this method, you can both create quite realistic 3D-models of things you just filmed and furthermore, you can thus create animations using these models. Alternatively, you could just use an image-sequence, in which the object is captured from all sides or just rotated and let the viewer go back and forth between frames and / or perspectives.

Photogrammetry

only really works on stills, meaning that your subject won't move
gives you the opportunity to really zoom in and out, create parallaxe (moving the subject seperately from the background)

Skipping between different sequences

is comparable to how the famous bullet-dodge effect in the matrix works, only that the viewer can direct the movement of the camera himself (which is pretty cool indeed).
Needs a lot of cameras however, set up in a ring around the subject. So you need to erase the cameras filming themselves in post, which is quite tedious. (a setup of such rig can be seen here and here. This brings with it a big spike in production-cost.
also, if your subject is moving and you want your camera to follow it, you need to move the entire rig which, if you've seen the pictures of it, is quite a pain in the rear.

So while capturing a sequence with dozens of cameras to allow different perspectives of a subject in motion can be a very very cool and impressive effect, there is a reason why not a lot of movies use it. It's expensive, difficult to work with on set and takes a lot of time to stitch together the sequences in post.
Photogrammetry on the other hand side offers a completely free perspective for the viewer, enabling him/her to look at the subject from any angle imaginable (which the multi-cam setup doesn't offer - you can only view from the perspectives that the cameras were set up on, especially concerning the y-axis)
The downside however is, that the subject won't be moving, unless you use stop motion in which case you can "photogrammetice" the subject in different states of momentum (which again, is very tedious).
I hope you found out what is what you want and my answer was helpful to your question :)

Thank you very much for the explaination, it's really complete and well explained! So lets say that trying to achieve such a result with some videos will be really a pain. I would like to do that on a field with N moving persons (for example using all cameras over a Football field, with all players running and moving). I think it will be really hard to achieve; I'll make further investigations, thanks again!

In this case, I'd recommend using photogrammetry for modeling the placers and then using motion capture to animate the stiff 3D-models. The animated scene could then be flown-through with a camera :)


text:
What is the most efficient way to split up raw video into rough clips using Premiere Pro?
I've got a few hours of raw video that I want to split into individual clips for later work. Being somewhat new to Premiere, I'm not too sure of the workflow for doing this.
What I've been doing so far is scrubbing through the source video and hitting the m key to leave a marker where I want the breaks to be (bonus: if I hit the key at the wrong time, I can just drag the markers around).
So far so good - now I want to use those markers to slice the video accordingly.
How do I do this?
Better yet, is there a better workflow for this process?

You're probably better off making subclips.
Subclips are pieces of footage that have been pre-edited, and appear in the project window as a separate clip, although they reference the same footage. In newer editions of PP there is the option of creating hard and soft subclips.
NB you can use the keyboard shortcuts i and o for setting in and out points and ctrlu for making the subclip (instead of noobishly clicking with the mouse like the guy in the tutorial). That will save your carpal tunnel.


text:
Switching HDMI signals without break
I need to switch between two or three HDMI signals (1080p is sufficient) for a video stream to a beamer. For example, I would like have a presentation coming from a laptop, and one or two cameras and then switch between those devices as fast as possible.
I tested some simple switches from Amazon, but everytime the input signal is changed, the beamer/output devices needs to reconnect to the new device, creating a black screen for a couple of seconds.
Does anyone have a recommendation for a small, rather cheap HDMI switch that comes without that problem?
I have to remark that between the switch and the beamer, there is an HDMI-Extender that takes a few seconds to reconnect after an interrupt, so the output signal of the switch must be consistent.
Thanks in advance.

You could try it with a device like that one. It takes the responsibility on the HDCP-negotiation for you, what should be what you are looking for.

That specific device also takes a few seconds to switch, but as you stated, it will not disconnect from the beamer in the meanwhile. That looks much better now, thanks!


text:
Downsample in Youtube or in editing software?
Target platform: Youtube
Target resolution for audience: Full HD
I record 4K in order to get better image quality from smartphone (2x birate of FullHD).
Should I resample and export the project in Full HD or rather export 4K, upload 4K and let youtube downsample my video ?
Thank you

If 4K looks markedly better, and you don't mind waiting for longer upload, why not uploading the better version? YouTube will resample according to target device.

If you can afford the additional upload and processing time to You Tube, you should use 4k.
Not only will this look better for most people (Not actually look better, but rather it looks more modern to an average user to have 4k and some people don't even watch it if it says FHD). But also, YouTube gives 4k videos a higher bitrate which also FHD videos profit from.
So you will get an better FHD video from downsampling on You Tube, than do it yourself.
If you don't have the time tho to wait for upload and processing, most people won't notice the difference

YouTube will transcode your files regardless of what you upload. If you upload a 1080 file, it will create its own file using their new codec (which I am not sure is 100% deployed yet but is already widely in use), but its their propritary AV1 codec.
That said, Lukas above is correct, just upload a 4k if the project was mastered in 4k, and let youtube make its own down converted copies for variable bitrate streaming.


text:
ffmpeg: how to ignore an EDIT LIST?
I've got a 10-minute long mp4 file which plays just fine with VLC. Apple Quicktime however plays only the first 6.5 seconds, stops and can't be convinced to jump past that.
Similarly, when I try transcoding it with ffmpeg, it stops at precisely frame 336.
I have figured out the following: when I run ffmpeg with 'loglevel 48' it tells me that there's something called an 'EDIT LIST' inside the file which tells it to drop all frames beyond 336:
ffmpeg -i VIDEO.mp4 -t 20 -pix_fmt yuv420p -c:v rawvideo -loglevel 48 output.avi
(...)
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x5617d7c1a880] Processing st: 0, edit list 0 - media time: 0, duration: 6719
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x5617d7c1a880] drop a frame at curr_cts: 6727 @ 336
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x5617d7c1a880] drop a frame at curr_cts: 6747 @ 337
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x5617d7c1a880] drop a frame at curr_cts: 6763 @ 338
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x5617d7c1a880] drop a frame at curr_cts: 6786 @ 339
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x5617d7c1a880] drop a frame at curr_cts: 6803 @ 340
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x5617d7c1a880] drop a frame at curr_cts: 6816 @ 341
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x5617d7c1a880] drop a frame at curr_cts: 6847 @ 342
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x5617d7c1a880] drop a frame at curr_cts: 6863 @ 343
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x5617d7c1a880] drop a frame at curr_cts: 6884 @ 344
(...)

Question: is there a way to tell ffmpeg to ignore this EDIT LIST and carry on regardless?

Yes, there's a private option for the MOV demuxer.
ffmpeg -ignore_editlist 1 -i VIDEO.mp4 ...

Thanks! I was looking into why ffmpeg would not cut (-ss -to) from I-frame to I-frame, the 1st one would be skipped, playback image would freeze (but playback bar would scroll) until the 2nd one came, but not start from the point I would want it to. With ignore_editlist it plays right away from the right point. Really weird this one, it's as if if ss is a keyframe, it will ignore it and edit list in the next keyframe. Tested on multiple clips and I-frame time points, same thing on ALL of them. Must be a bug.

Which ffmpeg version are you using?

N-94664-g0821bc4eee @ 20190807, zeranoe builds

Well, I found something odd... been using pkt_pts_time to get time for mp4, but on wmv it was missing, found out it's pkt_dts_time but I ended up at some improper output. When digging further, I got varying outputs for when using skip_frame nokey vs just listing and filtering frame,1. Shouldn't skip_frame nokey match only the frame,1? In my case it matches only the preceding P frame.


text:
"stringy" polarized water effect
Scenario
I saw this on a vimeo video and I want to try and recreate it. I've been using the various particle systems in after effects CC but I can't figure out how to get the particles to be "sticky" to one-another.
Question
How can I create a stringy / ropey water dribble effect similar to the clip below?
https://cl.ly/a576fc863a00

Tried Blender? Might have some more success in there.

@mark great suggestion! I found someone who made the kind of "gooeyness" I'm looking for https://www.youtube.com/watch?v=hG7kBkGLJ30

Per @Mark's comment I used blender to do this. I followed this tutorial for making a stream of water and modified the water emitter to be 0.1x0.1 meters so that it makes a stringy / gooey like effect.


text:
ffmpeg : Copy all the streams (including cover art) except the first video stream from one MP4 file to another
I want to copy all the streams (including cover art) except the first video stream from one MP4 file to another, here is what I do :
$ time ffmpeg -hide_banner -i toto1.mp4 -map 0 -vn -c:v:1 copy -c copy toto2.mp4
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x5655577ffd00] stream 0, timescale not set
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'toto1.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    title           : LA GRACE by ISRAEL KINDOMBA
    artist          : Israel Kindomba
    comment         : Soyez édifiés par ces déclarations sur la grâce...
    date            : 20170421
    description     : http://www.youtube.com/watch?v=tt1yUlqoB-U
    encoder         : Lavf58.20.100
  Duration: 00:08:21.29, start: 0.000000, bitrate: 443 kb/s
    Stream #0:0(und): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p, 640x360 [SAR 1:1 DAR 16:9], 332 kb/s, 29.97 fps, 29.97 tbr, 30k tbn, 59.94 tbc (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 96 kb/s (default)
    Metadata:
      handler_name    : IsoMedia File Produced by Google, 5-11-2011
    Stream #0:2(eng): Subtitle: mov_text (tx3g / 0x67337874), 0 kb/s (default)
    Metadata:
      handler_name    : SubtitleHandler
    Stream #0:3(fra): Subtitle: mov_text (tx3g / 0x67337874), 0 kb/s
    Metadata:
      handler_name    : SubtitleHandler
    Stream #0:4(spa): Subtitle: mov_text (tx3g / 0x67337874), 0 kb/s
    Metadata:
      handler_name    : SubtitleHandler
    Stream #0:5(deu): Subtitle: mov_text (tx3g / 0x67337874), 0 kb/s
    Metadata:
      handler_name    : SubtitleHandler
    Stream #0:6: Video: mjpeg, yuvj420p(pc, bt470bg/unknown/unknown), 480x360 [SAR 1:1 DAR 4:3], 90k tbr, 90k tbn, 90k tbc
Output #0, mp4, to 'toto2.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    title           : LA GRACE by ISRAEL KINDOMBA
    artist          : Israel Kindomba
    comment         : Soyez édifiés par ces déclarations sur la grâce...
    date            : 20170421
    description     : http://www.youtube.com/watch?v=tt1yUlqoB-U
    encoder         : Lavf58.20.100
    Stream #0:0(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 96 kb/s (default)
    Metadata:
      handler_name    : IsoMedia File Produced by Google, 5-11-2011
    Stream #0:1(eng): Subtitle: mov_text (tx3g / 0x67337874), 0 kb/s (default)
    Metadata:
      handler_name    : SubtitleHandler
    Stream #0:2(fra): Subtitle: mov_text (tx3g / 0x67337874), 0 kb/s
    Metadata:
      handler_name    : SubtitleHandler
    Stream #0:3(spa): Subtitle: mov_text (tx3g / 0x67337874), 0 kb/s
    Metadata:
      handler_name    : SubtitleHandler
    Stream #0:4(deu): Subtitle: mov_text (tx3g / 0x67337874), 0 kb/s
    Metadata:
      handler_name    : SubtitleHandler
Stream mapping:
  Stream #0:1 -> #0:0 (copy)
  Stream #0:2 -> #0:1 (copy)
  Stream #0:3 -> #0:2 (copy)
  Stream #0:4 -> #0:3 (copy)
  Stream #0:5 -> #0:4 (copy)
Press [q] to stop, [?] for help
size=    6026kB time=00:08:21.10 bitrate=  98.5kbits/s speed=1.18e+03x
video:0kB audio:5873kB subtitle:44kB other streams:0kB global headers:0kB muxing overhead: 1.828688%

real    0m0.583s
user    0m0.524s
sys 0m0.060s

As you can see in the Stream mapping: the input Stream #0:6: Video: mjpeg stream has not been copied.
Can you help me ?

-map 0 will map all streams from the first input. A negative mapping can then be applied to disable an already mapped stream.
So,
ffmpeg -i toto1.mp4 -map 0 -map -0:v:0 -c copy toto2.mp4

As someone already replied, -map 0 is used to grab everything from the first given input, in your case -i toto1.mp4.
To achieve what you want you can remove a specific stream this way (notice the - sign):
-map -0:0 which removes the first stream of the input
or
-map -0:v:0 which removes the first video stream of the input
But if you need to remove the second video from the input:
-map -0:6 which removes the sixth stream of the input
or
-map -0:v:1 which remove the second video stream of the input

More info:

https://trac.ffmpeg.org/wiki/Map
https://ffmpeg.org/ffmpeg.html#Stream-selection
https://ffmpeg.org/ffmpeg.html#Stream-specifiers

Found the answer, I had to remove -vn and explicitly select all the streams I wanted to copy except the one I didn't want :
$ ffmpeg -hide_banner -i toto1.mp4 -map 0:a -map 0:s -map 0:v:1 -c copy toto2.mp4
....
Stream mapping:
  Stream #0:1 -> #0:0 (copy)
  Stream #0:2 -> #0:1 (copy)
  Stream #0:3 -> #0:2 (copy)
  Stream #0:4 -> #0:3 (copy)
  Stream #0:5 -> #0:4 (copy)
  Stream #0:6 -> #0:5 (copy)
Press [q] to stop, [?] for help
frame=    1 fps=0.0 q=-1.0 Lsize=    6038kB time=00:08:21.10 bitrate=  98.7kbits/s speed=1.07e+03x
video:12kB audio:5873kB subtitle:44kB other streams:0kB global headers:0kB muxing overhead: 1.825498%

The input Stream #0:6: Video: mjpeg has been copied :-)

-map 0 -map -0:v:0 will preserve original stream order if the other tracks are interspersed.

@Gyan I LOVE your solution, can you please convert it to an answer ?


text:
What's special about Apple-device generated HEVC files that (apparently) x265 can't produce?
Take this file, the first 10s of Hank Green's "editing challenge". It is H264 video + AAC audio. You can take that file and import it into Final Cut Pro X (FCPX for short), and edit it to your heart's content.
Now, take that file, and convert it using ffmpeg, like so:
ffmpeg -i hank_vlog_orig_short.mp4 -c:v libx265 -c:a copy hank_vlog_orig_short_hvec.mp4
...which produces this file. Same thing, but reencoded in HEVC (which FCPX supports). Only now

You can't drag/import the file into FCPX (won't let you)
If you have an .fcpxml file that refers to such a file, the session will be imported but instead of audio/video you'll get the "missing plugin" placeholder.
Quicktime player refuses to preview/open the file

Any HEVC file created with, say, an iPhone can be readily previewed in qt and imported into FCPX. Both Adobe Premiere and VLC open and play the file just fine (though I now see that firefox just plays the audio, and does not render the video... download the file if you want to play with it).
Given that HEVC is a standard, can someone tell me

Why does FCPX refuse to open the file?
Is there some special joo-joo in Apple's HVEC files that is needed? What?
Is it possible to generate such a file with, say, ffmpeg, or is it only possible through AVFoundation or similar?

BTW, this is with FCPX 10.4.6, QT player 10.5, on OSX 10.14.4.

"why" is not really a good question here. The answer is just that standards are not consistently applied. Especially with organisations like Apple.

Apple s/w are fussy about codec tags. Share the log of ffmpeg -i OpensInFCP.mp4

Ok, I recorded a video with my phone, and produced this output with ffprobe (which produces the same info as ffmpeg). I did try copying the file level metadata (com.apple.quicktime.X) to no avail, though. Are the Core Media Metadata streams the secret, then?

Well. Turns out that if you read this guide for HLS streams, it gives a bunch of details on how the actual video formats should be set up. In particular, for HEVC, it says:

1.10. You SHOULD use video formats in which the parameter sets are stored in the > sample descriptions, rather than the samples. (i.e., Use ‘avc1’, ‘hvc1’, or
  ‘dvh1’ rather than ‘avc3’, ‘hev1’, or ‘dvhe’.)

So I thought I could give it a shot.
ffmpeg, by default, uses hev1. So if I take my previous command line and add -tag:v hvc1:
ffmpeg -i hank_vlog_orig_short.mp4 -c:v libx265 -c:a copy -tag:v hvc1 hank_vlog_orig_short_hvec.mp4
Presto, it works.


text:
What is this kind of video artifact called (grafitti)

This lyrics video contains multiple examples, ie. 0:41 to 0:43 and 1:00 to 1:02 and 1:31 to 1:38.
I mean the grafitti zipping quickly through. I've seen this effect earlier, but I don't know what it's called.
Thanks in advance.

That is neither an artifact nor graffiti. That is a (simulation of) writing directly onto a film leader.


text:
AE Counter Expression (0.0M views)
I'm trying to work out a counter that simply goes like:
2.5M views
At the moment I've got this expression working along with a Slider Control:
var num = effect("Slider Control")("Slider")
num = Comma(num) + "M views";
[num]

function Comma(number)
{
number = '' + Math.round(number);
if (number.length > 3)
{
var mod = number.length % 3;
var output = (mod > 0 ? (number.substring(0,mod)) : '');
for (i=0 ; i < Math.floor(number.length / 3); i++)
{
if ((mod == 0) && (i == 0))
output += number.substring(mod+ 3 * i, mod + 3 * i + 3);
else
output+= ',' + number.substring(mod + 3 * i, mod + 3 * i + 3);
}
return (output);
}
else return number;
}

This though only makes my text layer go like:
2M views
I've tried already replacing the first line with:
effect("Slider Control")("Slider").value.toFixed(2)

But this adds a decimal followed by a comma normally, it doesn't work anyways on this expression but maybe it can help.
Thanks in advance.

Here's my cheat sheet for numeric text animations like this:
slider = (effect("Slider Control")("Slider").value);
tidying = (Math.round(slider * 100))/100;
SourceText = "$" + tidying + "bn" +"\r" +"DEBTS";

the .value is sometimes needed to force AE to look at the slider as a number, not as an object.
tidying is being done to round up to 2 decimal places
\r gives a line break
text is appended with +”text”+
you can comment out some text   /* like this */
So in the example above, you would get an output like this:
$5.23bn
DEBTS

So for your specific example, try something like this:
slider = (effect("Slider Control")("Slider").value);
tidying = (Math.round(slider * 10))/10;
SourceText = tidying + "M views";

To specify showing a decimal place at all times (displaying "2.0" when your slider is set to "2"), use the "toFixed" function, like this:
slider = (effect("Slider Control")("Slider").value);
tidying = ((Math.round(slider * 10))/10).toFixed(1);
SourceText = tidying + "M views";

Screenshot:

Also, any way to keep the 0 when the number goes without decimal? Like 2.0 instead of 2

yes, you can use "toFixed(1)" to round to show one decimal place at all times - so:
slider = (effect("Slider Control")("Slider").value);
tidying = ((Math.round(slider * 10))/10).toFixed(1);
SourceText = tidying + "M views";


text:
Black/silent video with specific duration with ffmpeg
I'm trying to generate video files that follow a "prototype" file as much as possible (frame rate, dimensions, container format, codecs, etc.) but show a black screen with silent audio. Here's one command line that works fine, and produces a 3-second-long file:
ffmpeg -f lavfi -i color=c=black:s=3840x2160:r=25/1 -c:v h264 -f lavfi -i anullsrc=cl=mono:r=48000 -c:a pcm_s16be -t 3 out.mov

Sometimes, the prototype file has codecs that ffmpeg can read but not write, like pcm_bluray. So instead of trying to use the same codec as the prototype, I omit this parameter and let ffmpeg pick a default:
ffmpeg -f lavfi -i color=c=black:s=3840x2160:r=25/1 -c:v h264 -f lavfi -i anullsrc=cl=mono:r=48000 -t 3 out.mov

To my surprise, I get a file that's 3.022s long. What's interesting is that both the streams are 3.0s long, but container duration is longer:
{
    "streams": [
        {
            "index": 0,
            "codec_name": "h264",

            "time_base": "1/12800",
            "start_pts": 0,
            "start_time": "0.000000",
            "duration_ts": 38400,
            "duration": "3.000000",

            "nb_frames": "75",
        },
        {
            "index": 1,
            "codec_name": "aac",
            "codec_long_name": "AAC (Advanced Audio Coding)",
            "profile": "LC",

            "start_pts": 0,
            "start_time": "0.000000",
            "duration_ts": 144000,
            "duration": "3.000000",
        }
    ],
    "format": {
        "nb_streams": 2,
        "nb_programs": 0,
        "format_name": "mov,mp4,m4a,3gp,3g2,mj2",
        "format_long_name": "QuickTime / MOV",
        "start_time": "0.000000",
        "duration": "3.022000",
    }
}

ffmpeg version 4.0.2-2 Copyright (c) 2000-2018 the FFmpeg developers
  built with gcc 8 (Ubuntu 8.2.0-7ubuntu1)

see also Create muted video and black screen video with FFmpeg

Specify a PCM codec. The default codec is AAC, which has a priming sample that format in ffprobe accounts for, but stream won't, since the demuxer will have discarded it before sending it to the decoder for analysis.
P.S. your syntax is wrong - it should be ffmpeg -f lavfi -i color=c=black:s=3840x2160:r=25/1 -f lavfi -i anullsrc=cl=mono:r=48000 -c:v h264 -c:a pcm_s16be -t 3 out.mov
Options before an input are applied to the input. You've gotten away with it because -c:v h264 sets the video decoder for the following input. However, since it is an audio-only input, the effect is inert. And the default codec for MOV happens to be H264, so the outcome is what you desired.

Ouch. Thank you for pointing out the argument-order problem.

So if I play the file out, it will still play for 3.0s, correct? So if I want an accurate duration for a file with AAC streams, do I need to sum up the durations and start times of individual streams instead of relying on the container?

Which file? The one with AAC or PCM?

MOV with AAC. With PCM, all durations agree, so there's no question.

If your player's decoder knows to skip the priming sample, then 3.0s else 3.022s

Huh. So with MOV I can use PCM and avoid the ambiguity. But with other containers, like MP4, I don't think they accept PCM. Is there a way to avoid the ambiguity there?

Output to MOV with PCM and use mp4box to remux.

If you want to concatenate, use this to use the same tbn, fps is not enough: https://superuser.com/q/1555225/ -video_track_timescale 30000.


text:
Can you keep the edges of vector elements smooth past 100% zoom in After Effects?
I often make animations in After Effects that use vector resources made in Illustrator.
Often times, I need as much accuracy as I can get, to align anchor points to the center of rotating elements for example.
However, when I zoom further than 100% in my After Effects timeline, vector assets get pixelated.
I do understand that it is After Effect's way of showing the user what the result will look like, however, this seems to defeat the purpose of using vectors and the precision they can add to a workflow.
Here's an example:
I made a dot in the middle of the helix to be able to align the anchor point to the middle and then rotate it endlessly without axis shift (yes it's very tiny):

But in After Effects, aligning the Anchor Point to the red dot is very imprecise even at 800%:

One way would be obviously to scale up and start projects at 1000% of final size - which, for computer memory and time reasons I would only do in last resort.
How do I get precise zoom on vectors in After Effects?

Don’t zoom in on your display to do this.
Adjust the scale on the layer to zoom in further.
If the sun icon is enabled on the layer, you will get sharp edges as you scale up. Then position your anchors accordingly and scale back down if necessary.
Zooming in on the display will only show you pixel level accuracy for the resolution of your comp, so if you comp is HD you will never see higher resolution than 1920x1080, as that is the resolution at which the comp will be rendered.

Thanks, I thought that if I did this I would lose the alignment when scaling back down. I'll have to try it. Was hoping there was a way to turn off the pixel-accurate preview the way you can turn it off in AI.


text:
Adobe Premiere is slow. Please recommend
My Adobe premiere is slow running on my pc. Playing video slow, edit text slow.
Below is my computer spec. What else can I upgrade so my Premiere can running fast.

You seem to have a low-end $50 GPU on a low-to-mid range Windows PC (Core i5) with the bare minimum of RAM (24 GB). I'm betting you're using a "spinning rust" drive instead of an SSD as well.
If you're serious about video editing, you should START with the recommended requirements described at this link: https://helpx.adobe.com/premiere-pro/system-requirements.html
A "decent" system for Premiere will typically have an nVidia Quadro GPU, possibly 2 of them.
Premiere will take all the hardware you can give it and still come back for more. Adobe gives short shrift to non-CUDA GPU. Plan on buying at least an $800 GPU for serious editing work.
Please describe the type of video work you want to do. Premiere requires a serious investment to get real work done, but you may be able to use a lesser tool for what you need to do. Nowadays I tell a lot of beginners to get an iPad Pro and use iMovie or LumaFusion, or on Windows - Camtasia/Vegas.

I can't agree that you need a Quadro.  GeForce cards will give more bang for the buck if you don't need high precision floating point for 3D rendering work.  You also definately don't need dual GPUs for a "decent" system.  I use Resolve rather than Premiere, but a single GTX1080 is enough to edit 4K raw video in real time.  You can get by with a $450 or so graphics card to be "decent".

Depending on what you are working on, your RAM is probably fine.  More would help with RAM preview in AE and would help if you have buffering issues, but mostly you have a GPU and CPU problem.
GPU is underpowered by a lot.  Getting at least a $450-$500 GTX card would significantly boost your mercury playback engine support.  CUDA capable GPUs will give you the most bang for your buck in general.
Hard drive, if you don't have SSDs is also a huge limiting factor depending on what your working with for video.  If video can't transfer to/from the drive fast enough to supply Premiere, then it is going to stutter while it waits for the data to load.  Magnetic drives can't read from random locations well and if they have to read multiple video files and renders at the same time, it will have to do a lot of seeking that absolutely destroys the data retrieval speed.  SSDs, even a fairly slow one, remove this limitation and greatly improve performance.  Probably not quite as much as improving the graphics card, but if you have to choose between a $450 graphics card and an SSD or an $800 graphics card and no SSD, I'd take the $450 graphics card with an SSD (or preferably a few SSDs.)
The i5 is also a bit limiting.  There's a lot of media related instructions supported on the i7 and i9 CPUs that are not supported by the i5, resulting in more work having to be done when things are offloaded to the CPU rather than CUDA cores.  Overall this is probably a much smaller limitation than GPU and file I/O though.


text:
Is it possible to add easing to a looping, time remapped precomp in After Effects?
I have a 1 second precomp that is a rotating wheel using LoopOut(). Using Time Remap this animates during my entire main composition which is about 20 seconds.
I'd like to include an ease in so that the wheel starts turning gradually before rotating at a constant velocity. Doing this to the first time remap keyframe is obviously wrong, as the ease then happens every second. Is there a way of doing this without making the precomp 20 seconds long? (I found a longer precomp was slowing down the rendering.)

Add an expression control slider to the layer (Effects>Expression Controls>Slider Control). This will be what we use to control the rotation of the wheel.
now add this expression to the time remap property:
effect("Slider Control")("Slider") % 1

You could also drag the expression pickwhip from the time remap property to the slider property, and then type % 1 after the result.
The % 1 is the modulus operator, it returns the remainder when the first term is divided by the second, in this case the part after the decimal point, so if the slider is at 12.34 it will return 0.34.
Now you can animate the slider using whatever easing you like.


text:
FFmpeg No such filter error
I'm trying to use FFmpeg to create a new video with some frames repeated and black frames inserted inside. Here is my command:
#! /bin/sh
fn="Drifting with Cars.mp4"

#
ffmpeg -y -i "${fn}" -ss 00:00:05 -to 00:00:06 -r 1/1 _05.png
ffmpeg -y -i "${fn}" -ss 00:00:10 -to 00:00:11 -r 1/1 _10.png
ffmpeg -y -i "${fn}" -ss 00:00:15 -to 00:00:16 -r 1/1 _15.png
ffmpeg -y -i "${fn}" -ss 00:00:20 -to 00:00:21 -r 1/1 _20.png
ffmpeg -y -i "${fn}" -ss 00:00:25 -to 00:00:26 -r 1/1 _25.png
ffmpeg -y -i "${fn}" -ss 00:00:30 -to 00:00:31 -r 1/1 _30.png
ffmpeg -y -i "${fn}" -ss 00:00:35 -to 00:00:36 -r 1/1 _35.png

#
ffmpeg -y -i "${fn}" \
-i _05.png \
-i _10.png \
-i _15.png \
-i _20.png \
-i _25.png \
-i _30.png \
-i _35.png \
-filter_complex "
[0:v]trim=0:5,setpts=PTS-STARTPTS[0v_1];
[1:v]loop=loop=25*3:size=2
,drawtext='fontsize=40:fontcolor=0x0000FF@0.7
:text=pause -> fade-out':x=920:y=20:shadowcolor=black@0.7:shadowx=1:shadowy=1
,fade=t=out:st=2:d=1[pause1];
[0:v]trim=5:10,setpts=PTS-STARTPTS
,fade=t=in:d=1[0v_2];
[2:v]loop=loop=25*4:size=2
,drawtext='fontsize=40:fontcolor=0x0000FF@0.7
:text=pause -> fade-out':x=920:y=20:shadowcolor=black@0.7:shadowx=1:shadowy=1
,fade=t=out:st=3:d=1[pause2];
[0:v]trim=10:15,setpts=PTS-STARTPTS
,fade=t=in:d=1[0v_3];
[3:v]loop=loop=25*5:size=2
,drawtext='fontsize=40:fontcolor=0x0000FF@0.7
:text=pause -> fade-out':x=920:y=20:shadowcolor=black@0.7:shadowx=1:shadowy=1
,fade=t=out:st=3:d=2[pause3];
[0:v]trim=15:20,setpts=PTS-STARTPTS
,fade=t=in:d=1[0v_4];
[4:v]loop=loop=25*6:size=2
,drawtext='fontsize=40:fontcolor=0x0000FF@0.7
:text=pause -> fade-out':x=920:y=20:shadowcolor=black@0.7:shadowx=1:shadowy=1
,fade=t=out:st=3:d=3[pause4];
[0:v]trim=20:25,setpts=PTS-STARTPTS
,fade=t=in:d=1[0v_5];
[5:v]loop=loop=25*7:size=2
,drawtext='fontsize=40:fontcolor=0x0000FF@0.7
:text=pause -> fade-out':x=920:y=20:shadowcolor=black@0.7:shadowx=1:shadowy=1
,fade=t=out:st=3:d=4[pause5];
[0:v]trim=25:30,setpts=PTS-STARTPTS
,fade=t=in:d=1[0v_6];
[6:v]loop=loop=25*5:size=2
,drawtext='fontsize=40:fontcolor=0x0000FF@0.7
:text=pause -> fade-out':x=920:y=20:shadowcolor=black@0.7:shadowx=1:shadowy=1
,fade=t=out:st=3:d=2[pause6];
[0:v]trim=30:35,setpts=PTS-STARTPTS
,fade=t=in:d=1[0v_7];
[7:v]loop=loop=25*3:size=2
,drawtext='fontsize=40:fontcolor=0x0000FF@0.7
:text=pause -> fade-out':x=920:y=20:shadowcolor=black@0.7:shadowx=1:shadowy=1
,fade=t=out:st=2:d=1[pause7];
[0:v]trim=35,setpts=PTS-STARTPTS
,fade=t=in:d=1[0v_8];

[0v_1][pause1]
[0v_2][pause2]
[0v_3][pause3]
[0v_4][pause4]
[0v_5][pause5]
[0v_6][pause6]
[0v_7][pause7]
[0v_8]
concat=n=15:a=0:v=1[v]
" -map '[v]' -an "DriftingWithCars_pf.mp4"

But when running (the filter part), I get the following error:
[AVFilterGraph @ 0x2261560] No such filter: 'loop'
Error initializing complex filters.
Invalid argument

What is the problem? Where does it come from? I'm using an updated version of ffmpeg: version 2.8.15 Copyright (c) 2000-2018

The 2.8 branch is too old. The loop filter was added on 2016-02-18. The 2.8 branch was cut from the master branch on 2015-09-05. Release branches do not get new features backported (only occasional bug fixes).
Don't use such an old FFmpeg. Compile or download a recent build.
You can see a list of available filters for your build with ffmpeg -filters.

Yes my update did the trick! Didn't know loop was added recently! Thanks.

@TinaJ It was added more than three years ago which is a few epochs in terms of FFmpeg development. Always use a recent version.

Thanks. Now the problem is your freezedetect command in the other question doesn't detect any on this generated video :-/

@TinaJ Experiment with the values for the two options. My example only used the default values.

oh no...sorry, it did. Input was the original video! lol

do you happen to know what is the license for freezedetect filter? Can we use it from the source code?

@TinaJ According to the contents of libavfilter/vf_freezedetect.c it is licensed LGPL 2.1 or later. Not sure what you are asking in your 2nd question.

yeah I meant, if we can use this filter source code in an enterprise level.

@TinaJ Of course you can. You Just need to comply with the LGPL.


text:
How to record system sound without video?
I installed Soundflower with brew cask install soundflower and I see it listed:
$ ffmpeg -f avfoundation -list_devices true -i ""
[AVFoundation input device @ 0x7f9a32515e80] AVFoundation video devices:
[AVFoundation input device @ 0x7f9a32515e80] [0] FaceTime HD Camera
[AVFoundation input device @ 0x7f9a32515e80] [1] Capture screen 0
[AVFoundation input device @ 0x7f9a32515e80] AVFoundation audio devices:
[AVFoundation input device @ 0x7f9a32515e80] [0] Soundflower (2ch)
[AVFoundation input device @ 0x7f9a32515e80] [1] Built-in Microphone
[AVFoundation input device @ 0x7f9a32515e80] [2] Soundflower (64ch)

I found several threads on recording the screen without system sound (one, two, three) and one about recording audio on Linux with ALSA. I could not find how to record audio only, without video.
I also tried this command to record the audio along with the screen ffmpeg -f avfoundation -i "1:0" ~/Downloads/Screen.mov, and I got an error Conversion failed!.
How can I record system sound to a file with FFMPEG?

Try ffmpeg -f avfoundation -i ":0" output.wav. If it fails provide the complete log.

Yes, it worked, and it was that simple. Can you write an answer?

With 1:0 you're including the video input from FaceTime HD Camera. Try:
ffmpeg -f avfoundation -i ":0" output.wav

This only selects audio device 0 which is Soundflower (2ch).
See avfoundation input device documentation for more info.


text:
Encoding: Insert keyframes at certain positions
I am trying to improve the perceived quality of certain predefined frames (like the frames 45, 99, 154, ...). Reason is, that the video is interactive and pauses at these keyframes until the user clicks next. So the quality should be higher just for these frames.
Using ffmpeg, I am currently splitting the video in segments so that each segment starts with one of those important frames as a key frame and then merge it again as a single video. This is suboptimal as lookahead and various other encoder/decoder tweaks can not benefit from this segmented video encoding
Is there a simpler option using -force_key_frames? Unfortunately, this option only seems to allow inserting key_frames using an interval, but the keyframes i require do not follow a rhythm.
P.S. the video is running at a constant 30fps and is merely 32 seconds long. Encoded as x264, vp9 and vp8 for web, so it won't feature a high bitrate.

Is there a simpler option using -force_key_frames? Unfortunately, this option only seems to allow inserting key_frames using an interval
Not so. To force keyframes for frames 45, 99 and 154 where first frame has index 0, use
-force_key_frames expr:eq(n,45)+eq(n,99)+eq(n,154)

You may need to escape the commas, depending on your shell.

That makes things so much easier and it works very nicely. Thanks a ton Gyan!


text:
Color leakage effects with ffmpeg blend=all_expr
I generate two test videos (the first a test pattern, the second solid red) with
ffmpeg -f lavfi -i testsrc=duration=5:size=1280x720:rate=30 pattern.mp4
ffmpeg -f lavfi -i color=c=red@0.2:duration=5:size=1280x720:r=10 red.mp4

If I blend these together with the solid red as background, I see the expected output: left half test pattern, right half solid red.
ffmpeg -i pattern.mp4 -i red.mp4 -filter_complex "[0:v][1:v]blend=all_expr=if(lt(X\,600)\,A\,B)" output.mp4

However, when blending in the opposite order, the output is not as expected, with the solid red "bleeding" over the entire image.
ffmpeg -i red.mp4 -i pattern.mp4 -filter_complex "[0:v][1:v]blend=all_expr=if(lt(X\,600)\,A\,B)" output.mp4

Why is the "A" video leaking into the "B" zone?

The default pixel format for testsrc filter is rgb24, which gets converted to yuv444p for encoding to H264. The default pixel format for color is yuv420p, which is kept as-is.
The blend filter requires both inputs to have the same pixel format, and will, where possible, convert the pixel format of the 2nd input to match that of the first. When red.mp4 is the first input, the frames from pattern.mp4 are converted to yuv420p. In yuv420p. the chroma planes are half the width (and height) of the luma plane, so in this case, 640x360.
Your blend expression, which is applied to all planes is, if(lt(X\,600)\,A\,B). For the chroma planes of a 1280x720 frame in yuv420p format, X = 600 is at ~6% from the right edge, hence the result you're seeing. You can modify the expr to if(lt(X\,SW*600)\,A\,B) to get the expected result. SW is the scale factor for the processed plane and represents the ratio of the current plane to the luma plane.


text:
What do I need to take into consideration to take video of molten glass which I will later postprocess?
I want to take video of one part of the of production process of glass pressing: gob delivery. I want to assess the shape of the gob, dimensions, and position in the mold.
I do not know much about video techniques, so I tried to use my cellphone camera with very bad results. The main problem seems to be the brightness of the glass.
So I was wondering, what are the most important factors to take into consideration when taking this kind of footage? Should I use special camera? Maybe I should use filters, or maybe I need to know a particular postprocessing technique.
Can anybody shed some light on this issue?

If the video is to bright, you can buy a ND-Filter. Sadly good ones cist around 200$. But you may find some for rentinf.

What this comes down to is what's referred to as dynamic range. The wider the dynamic range the more detail you will see between the darkest darks and brightest lights. The human eye has a very large dynamic range, much larger than a camera. Cell phones are alright but dont have a very large dynamic range compared to a dslr or camcorder.  (This is immediately evident if youve ever tried to take a photo with your phone of a beautiful sunset only to be underwhelmed by the resulting photo compared to the reality.)
It sounds like all you need to do is manually adjust the exposure down a few stops until just the glass is exposed. If you have a dslr try snagging a set of ND filters for the lens you'll shoot with. The ND filter (neutral density filter) works to allow you to adjust the exposure of the image if you are dealing with extreme brightness either from the environment or due to your aperture/shutter/ISO settings.
Hope this helps! Feel free to message me if you need any help!


text:
Make clip reference (link to) different media file(s) in Premiere
After editing a Premiere project and seeing a final video, I often want to change the underlying media, whether that means processing the audio file differently or re-rendering some frames of an animation.
So far, I've been achieving this effect by appending '_old' to the names of the old media files and then saving new versions with the name I used when importing to Premiere, so Premiere will be oblivious to the difference. To be safe and organized, though, I want to do this without the renaming trickery.
Searching so far, I've only been able to find solutions for relinking missing or moved media. I can't seem to figure out how to link to different media. If I could just break the link between a clip and media without deleting/moving the media, that would be good enough, since I could just break the link and then pick the new file when repairing the link. (I think)

Right click, set Media Offline
Right click again, Relink Media
Select your new clip.

Thanks. I was confused and thought "make offline" meant to internalize the data into to project file so it didn't need a reference, similar to what offline operation means in various other apps/services. Will upvote once I have the reputation. Can you can offer any insight into why this is called "offline" rather than unlinking?

I guess this is just the way Adobe named their UI, I admit though that it can be confusing as you mentioned.


text:
use ffmpeg to convert interleaved raw yuv/pcm to compressed
I'm always impressed how smart FFmpeg has been designed so giving this a go. Can I use FFmpeg to convert part of a file to a compressed video file w/audio? The file I have consists of YUV420 frames interleaved with (floating point) audio PCM. So raw video & audio. I would like to convert part of it, so would want to give an offset into the file. It is part of a ring buffer so the file is opened and growing, but I have full control over this.

All raw demuxers expect a single stream. Can you deinterleave it yourself?

@Gyan Ah, I was hoping to avoid this as resource usage is at a premium. De-interleave to file or memory would not be my first choice. First time FFmpeg lets me down! If this is not possible I probably prefer to first look into some container format that supports the interleaved raw data, I can then copy it and slap a header in front of it. If something like that exists. It would not be compressed, but at least it can be exported.

what's the interleaving interval in bytes?

@Gyan It's VAVA.. The interval depends on the video resolution, e.g. a typical video frame would be 1382400 bytes, followed by 7680 bytes of audio. Repeat.

I may be able to do something about this. Give me a day or two.

Can ffmpeg write to intermediate files ? And can multiple ffmpeg instances be run?

@Gyan sure, but resources are at a premium.. So if what you have in mind requires more than me de-interleaving then you might overshoot my goal. Unless there's a way to add throttling when writing to disk. Mmm..

Here's a method that should, in principle, work. It assumes VAVA interleaving and for somewhat efficient processing requires the packet sizes for both video and audio having a reasonably large greatest common divisor.
The examples below assume a video packet size of 1382400 bytes and audio of 7680 bytes. As it happens, the former is exactly 180 times the latter. The idea is we can ingest the raw stream as a raw "audio" stream and deinterleave using a selection expression, which routes 180 "frames" to one output and the 181st frame to another. Then the separated outputs are dumped into regular or fifo files which can then be read by another ffmpeg process with a sane interpretation of the input.
Command 1:
ffmpeg -f u8 -channels 1 -i raw-input-url -filter_complex "asetnsamples=7680,aselect='1+not(mod(n+1,181))':n=2[vid][aud]" -map [vid] -f u8 file-vid -map [aud] -f u8 file-aud
Command 1 with input offset:
ffmpeg -f u8 -channels 1 -i "subfile,,start,3248615,end,0,,:raw-input-url" -filter_complex "asetnsamples=7680,aselect='1+not(mod(n+1,181))':n=2[vid][aud]" -map [vid] -f u8 file-vid -map [aud] -f u8 file-aud
where 3248615 is in bytes and should point to the start of a video frame for this to work.
Command 2:
ffmpeg -f rawvideo -pixel_format yuv420p -framerate F -video_size WxH -i file-vid -f f32le -channels N -sample_rate R -i file-aud { -encoding parameters } output

Thanks Gyan. Weird as SE did not notify me of this answer. I'll let you know how it turns out.

I am thoroughly impressed. Except for a required vflip this worked the first time. Thanks!


text:
Is it possible to edit a still image in Photoshop which is part of a sequence in Premier Pro?
I'm very new to Premier Pro, and I'm working on a project which encompasses some still artwork which I've created in Photoshop.  I'm finding that as I apply vignettes etc that I'm wanted to go back and tweak the original artwork in Photoshop from time to time to get the results I want.
What's the best way of doing this?  I've been exporting JPGs from Photoshop thus far and adding them to Premier.  Is it possible to avoid this and have the documents linked together so that I can edit the still frame which are part of my movie?

You can import Photoshop files to Premiere Pro, so that whatever change you make in the Photoshop file also appears in Premiere, like this:

Thanks so much, that's working great for me :-)


text:
Blackmagic RAW get Thumbnail in Windows Explorer
Is there any known Plug In or similair which can show BRAW Thumbnails in Windows Explorer? Or does anyone know how one could write such an Plug In?

I've created a thumbnail provider available from here https://github.com/tom-gangemi/braw-thumbnail-provider/releases/tag/v1.0.
All you need to do is extract to your desired install location and run register.cmd.

Nice! Thank you and thank you for making it Open Source :)


text:
What is the difference between VP9 and WebM?
The ffmpeg manual states that:

libvpx-vp9 is the VP9 video encoder for WebM, an open, royalty-free media file format.

What is the difference between the VP9 and WebM?

VP9 is a video format. Another example is H.264.
WebM is a container format that VP9 goes into. It is equivalent to the MP4 container format for the H.264 video format.
libvpx is a video encoder (or codec) which outputs the VP8 or VP9 video formats. Another encoder example is x264 which outputs the H.264 video format.

Note that codec can typically be put in multiple containers, and a container can typically accept multiple codecs.

Since I don't do video work frequently, I always forget this important distinction. I wish I had a cheat-sheet showing what goes with what.

@LonnieBest Comparison of video container formats might be helpful.


text:
ffmpeg - blend video with images
So I want to create videos that had a red overlay, effect and I assume that blend is the right options filter for this. Here my command :
ffmpeg -i dogs.mp4 -i red.jpg -filter_complex '[1:v]scale=1280:720[ckout];[0:v][ckout]blend=all_mode='multiply'[out]' -map '[out]' output.mp4

But when i tried this I always got :
Press [q] to stop, [?] for help
[swscaler @ 00000263f19a9560] deprecated pixel format used, make sure you did set range correctly
[Parsed_blend_1 @ 00000263f192fa20] First input link top parameters (size 1920x1080, SAR 0:1) do not match the corresponding second input link bottom parameters (1280x720, SAR 1:1)
[Parsed_blend_1 @ 00000263f192fa20] Failed to configure output pad on Parsed_blend_1
Error reinitializing filters!
Failed to inject frame into filter network: Invalid argument
Error while processing the decoded data for stream #0:0
Conversion failed!

What is the right command for this?

Do you want to add a red tint on top?

@Gyan Yes, I'm blending red tint png actually and, overlay it on top of video with multiply rule

As Gyan's answer indicates, any filter involving two or more videos being put together in any way, requires that those videos have the same resolutions. Exceptions would be filters like the vstack where only one line of the resolutions need to match. Scale red.jpg before starting the blend. Several ways to do this, Gyan's solution being pretty handy.

The blend filter requires both inputs to have the same resolution. You can use the scale2ref filter to resize the overlay.
ffmpeg -i dogs.mp4 -i red.jpg -filter_complex '[1:v][0:v]scale2ref[ckout][vid];[vid][ckout]blend=all_mode='multiply'[out]' -map '[out]' output.mp4

scale2ref That's a handy filter. So it scales the res of the first input [1:v] to match the second [0:v]?

Yes, it just gives access to the attributes of a reference video. The target size does not have to be the same as the reference. That's the behaviour of the default values. See https://ffmpeg.org/ffmpeg-filters.html#scale2ref

Hmm, interesting, the scale works but the error still happens First input link top parameters (size 1920x1080, SAR 0:1) do not match the corresponding second input link bottom parameters (1920x1080, SAR 1:1) Failed to configure output pad on Parsed_blend_1 I'm using 3.4.

I got it working with this. ffmpeg -i red.jpg -i dogs.mp4 -filter_complex "[0][1]scale2ref[a][b];[a]setdar=16/9[c];[b]setdar=16/9[d];[c][d]blend=all_mode=overlay:all_opacity=1[out]" -map "[out]" output6.mp4 actually your command should be right.
can't edit my comment because of StackOverflow so I add a new one

Recent versions of ffmpeg blend filter no longer require matching aspect ratios.


text:
Trimming MOV clips / Saving as mp4
I am trimming extraneous time from some MOV files using the Microsoft Movies Anywhere app on my desktop. They're saved as MP4 files and have proportionately much smaller file sizes than the trimmed length would suggest (e.g. 18 sec, 228 MB MOV file / trimmed to 10 sec, 50 MB MP4 file). The content is relatively static so that wouldn't explain the difference. My principal concern: Am I losing quality by doing this? Would I be better off trimming in Resolve and saving in the same MOV format? Thanks.
Phil

My two cents...Video quality can be determined by several things (e.g. codec, bitrate, compression, etc.), so just looking at the container (i.e. MOV vs. MP4) isn't a sufficiently in-depth way of finding out the best option.

In addition to that,i'd like to add that you best keep high bitrate stuff while you edit and only output low bitrate (small filesize) for the final result or for archiving.


text:
Convert video with ffmpeg to have the same quality
I want to make some present for my grandma. And prepare some video. Unfortunately here video player is old and could not read some file formats. She is not at home now, so I don't know which player she has. But I have a file which is OK for here system:
File which is in a correct format:
General
Complete name                            : let.avi
Format                                   : AVI
Format/Info                              : Audio Video Interleave
File size                                : 688 MiB
Duration                                 : 1 h 35 min
Overall bit rate                         : 1 002 kb/s
Writing application                      : VirtualDubMod 1.4.13
Writing library                          : VirtualDub build 14328/release
FileExtension_Invalid                    : avi

Video
ID                                       : 0
Format                                   : MPEG-4 Visual
Format profile                           : Simple@L3
Format settings, BVOP                    : No
Format settings, QPel                    : No
Format settings, GMC                     : No warppoints
Format settings, Matrix                  : Default (H.263)
Codec ID                                 : XVID
Codec ID/Hint                            : XviD
Duration                                 : 1 h 35 min
Bit rate                                 : 800 kb/s
Width                                    : 544 pixels
Height                                   : 416 pixels
Display aspect ratio                     : 4:3
Frame rate                               : 25.000 FPS
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Scan type                                : Progressive
Compression mode                         : Lossy
Bits/(Pixel*Frame)                       : 0.141
Stream size                              : 549 MiB (80%)
Writing library                          : XviD 0.0.09 (UTC 2003-03-25)

I have the following file, which here system could not read:
File in the incorrect format:
General
Complete name                            : amf.avi
Format                                   : AVI
Format/Info                              : Audio Video Interleave
Overall bit rate                         : 2 167 kb/s

Video
ID                                       : 0
Format                                   : MPEG-4 Visual
Format profile                           : Advanced Simple@L5
Format settings                          : BVOP1
Format settings, BVOP                    : 1
Format settings, QPel                    : No
Format settings, GMC                     : No warppoints
Format settings, Matrix                  : Default (MPEG)
Codec ID                                 : DX50
Codec ID/Hint                            : DivX 5
Bit rate                                 : 1 710 kb/s
Width                                    : 720 pixels
Height                                   : 528 pixels
Display aspect ratio                     : 4:3
Frame rate                               : 23.976 (24000/1001) FPS
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Scan type                                : Progressive
Compression mode                         : Lossy
Bits/(Pixel*Frame)                       : 0.188
Stream size                              : 1.15 GiB (79%)
Writing library                          : XviD 64

Could you help me to convert the second file to a format of the first? (It would be nice if output would be of the similar quality)
I have Ubuntu, and I think ffmpeg should be able to do it.

The differences between your "works" and "doesn't work" examples are:

resolution
framerate
Codec Tag
Codec Level

and you can set these using ffmpeg:
ffmpeg.exe -i /temp/input.mp4 -c:v mpeg4 -level 3.0 -vtag XVID -s 544x416 -r 25 -qscale 0 /temp/out.avi

Qscale 0 will produce a large file but maintain the best quality.
Please note that changing the resolution and frame rate will not produce the best output quality, so check if you can just omit the -s and -r parameters to maintain the best quality. Possibly you need to set the bitrate to 800kBit as in your "works" example to make it work on the target device of your grandmother.

-qscale 0 did it for me


text:
What's the difference between "visually lossless" and real lossless and what does this mean for future encodes?
In FFmpeg's H.264 Video Encoding Guide we are told:

Tip: If you're looking for an output that is roughly "visually lossless" but not technically lossless, use a -crf value of around 17 or 18 (you'll have to experiment to see which value is acceptable for you). It will likely be indistinguishable from the source and not result in a huge, possibly incompatible file like true lossless mode.

This raises some questions. The first and obvious one is "how did they decide that?" The important question is the one in the title. What's the literal difference and if I need to encode from this output later (e.g. I want to compress and archive old data), will a second encode on a crf 18 encoded file give me problems that a crf 0 encoded file wouldn't?

Technically lossless, or real lossless, means that when the output is decoded by a conformant decoder, the result is mathematically identical to the input.
Visually lossless is a non-rigorous term that indicates subjective transparency i.e. output which to the lay human eye looks indistinguishable from the original. The output may look different if a viewer scrutinizes it in fine detail, but not in normative viewing conditions. As to how 'visual-losslessness' is determinined: there are video quality metrics, like PSNR and SSIM, that provide a quantitative measure of the difference of an image with respect to a reference. Subjective opinion tests have been carried out to establish threshold values for these metrics that can be used to define 'visual losslessness'
From Performance Analysis of Visually Lossless Image Compression,

Note  that  there  are  several  visual quality metrics (indices)
  such as MSSIM [6], PSNR-HVS-M  [7],  WSNR  [8]  and  some  others
  that  are  able  to characterize  well  enough  quality  of  lossy
  compressed images  [9].  Recently,  it  has  been  shown  for
  grayscale images  [5]  that  it  is  enough  to  provide  MSSIM
  values larger  than  0.985  or  PSNR-HVS-M  values  larger  than 40dB
  in  order  to  guarantee  practically  invisibility  of distortions
  in  lossy  compressed  images.

As for re-encoding resilience, depends on what the goal of the re-encoding is. For viewing-only or casual re-editing purposes, CRF 18 in x264 should be fine. For professional re-editing, I would drop the CRF to, say, 12 or 14. Information, once lost, can't be perfectly recovered. But you can set your own standards by encoding at different CRFs and comparing manually. See https://video.stackexchange.com/a/17639

Are PSNR and SSIM consistent across codecs or just x264?

These metrics compare decoded frames i.e. pixels, so the codec doesn't really matter.

In addition to "visually lossless", there's the concept of "visually almost lossless":

"Visually almost lossless" is usually established by static side-by-side viewing. This is probably what the CRF is about, since it "looks lossless". I believe Gyan's mention of "scrutiniz[ing] in fine detail" is about this one too.
"Visually lossless" has a stricter requirement. It is established by a "flicker" test or a "panning" test. The former is the accepted standard under ISO/IEC 29170-2 written by the JPEG. The latter is a proposal for addition used in an evaluation experiment for Display Stream Compression in DisplayPort. It is apparently more sensitive.

Although both measures are inevitably subjective, humans do appear quite consistent with their judgements as the one large-scale experiment shows.

How did they decide that?
To answer literally, I am the original author of that article and added the claim years ago that CRF ~18 is visually lossless (but not technically lossless like CRF 0). I got that information directly from the main x264 developer (Glaser aka Dark_Shikari) in the #x264dev IRC room, and it looked lossless to me.
Re-encoding: 0 vs 18
If you need an intermediate and/or temporary file for re-encoding, use -crf 0 or some other lossless compressed format, such as UT video or FFv1, that works within your workflow. Might as well avoid any unnecessary compression artifacts and provide the best quality you can to your clients.


text:
What is the terminology for AR text in a video?
I'd like to learn how to add text in a video that's anchored to a 3d space in a video like augmented reality, but I'm having trouble finding out what this kind of effect is called.
Example:

In the example the text is also 3d, but I'm mostly interested in the AR style text effect itself, I plan to add 2d text to a video, basically moving credits that move like an AR object.
Thanks,

There's not much to it, the effect could be called "3D tracking Text" or something like that.
Open up After Effects. Load up your file that you want to put the text in. Use the camera tracker that natively comes in After Effects. Now, you can attach a null to one or more points that are automatically generated and detected, which will follow the geometry and movements from the footage. Once you're happy with where the null is positioned, you can create a new text layer and parent it to the null, so that the text is following its position, rotation and scale. That's it.
Creating a 3D-Text however is a different story. For that, you could use the element3d plugin for aftereffects, but that's quite expensive. Alternatively, you could track the camera and export the tracking data to a 3D-environment. I'd recommend using pfTrack for the tracking part. Then, inside the 3D-Program (like Cinema4D, Modo, 3Dsmax, Maya, etc.) you can import the tracking data which will give you a camera that matched the movements of your footage. If you then just place an object, like 3D-Text in the 3D-Space and render the footage from the perspective of the aforementioned camera, you can place that footage on top of your original footage and the object will stick.


text:
Why trimming in ffmpeg eats up so much memory?
Basically, I want to take two rectangles ouf of sixth minute of the video and overlay them at an earlier point in the video.
If I use ffmpeg three times like this:
ffmpeg -i a.mp4 -filter_complex "[0:v]trim=start_frame=9000:end_frame=9001,crop=1280:100:0:0,null,setpts=PTS-STARTPTS[v]" -map [v] -c:v libx264 -c:a null -crf 15 -preset slow -y -t 0.1 still1.mp4
ffmpeg -i a.mp4 -filter_complex "[0:v]trim=start_frame=9000:end_frame=9001,crop=100:100:600:500,null,setpts=PTS-STARTPTS[v]" -map [v] -c:v libx264 -c:a null -crf 15 -preset slow -y -t 0.1 still2.mp4
ffmpeg -i a.mp4 -i still1.mp4 -i still2.mp4 -filter_complex \
"[0:v][1:v]overlay=0:0:enable='between(t,60,61)'[v0]; \
[v0][2:v]overlay=600:500:enable='between(t,60,61)'[v1]" \
-map [v1] -c:v libx264 -crf 17 -preset slow -y -t 362 p.mp4

The consumption of RAM as measured by top stays around 3 GB. However, when I  try it in one command, it quickly eats up 13GB of my free memory and the process quickly gets killed by OOM killer:
ffmpeg -i a.mp4 -filter_complex \
"[0:v]trim=start_frame=9000:end_frame=9001,crop=1280:100:0:0,setpts=PTS-STARTPTS[still1]; \
[0:v]trim=start_frame=9000:end_frame=9001,crop=100:100:600:500,setpts=PTS-STARTPTS[still2]; \
[0:v][still1]overlay=0:0:enable='between(t,61,62)'[v0]; \
[v0][still2]overlay=600:500:enable='between(t,61,62)'[v1]" \
-map [v1] -c:v libx264 -crf 17 -preset slow -y  p.mp4

I suspect ffmpeg keeps all the frames decoded in memory when trimming, but is there any way around this? It sounds wastefull, I am interested in two little frames, that should not eat up GB of memory!


text:
How to deal with reflections in a space helmet
I am currently working on a short sci-fi film, and one scene involves a character going on a space walk. I've made a helmet, which has a plastic visor. The problem is that this visor is very reflective. All shots are in front of a green screen. My setup is fairly small, with a green screen stand and two soft-box lamps. The crew and equipment is fairly visible in the helmet, and I have also had keying issues with some test shots. There will be some lights within the helmet as well, but I don't think those will be enough. What can I do to reduce reflections both on set and in post?
I have read this question, but the only real answer was to use a polarizer, and I don't know how well that will work for me.
My editing software is DaVinci Resolve 15.

The best thing you can do is get as much right on set as possible. Cover cast, crew, and equipment with black fabric, hide them behind black curtains,  Get your talent as far away from the green screen as far as you can while still maintaining its utility; choose your angles carefully, and keep the shots short, because whatever you do, you're going to have to fix something in post. In a perfect world, all that would be would be the key, but the world is never perfect.
Additionally, you might consider removing the plastic visor and adding it back in post.   You'd need to capture clean plates and a mirror ball on set, so that you can re-cast the reflections on the visor (after photo shopping out cast and crew, etc) . Then you'd use object motion tracking and (if your camera moves) camera motion tracking to insert 3d geometry.where the visor should be. This approach removes some of the complexity of keying a spherical, reflective surface, but adds complexity with the motion tracking, which can really mess up your shot if the solve is even a fraction of a hair off.
In any case, don't underestimate the complexity of what you're trying to do. Hire a qualified person or persons to do the work if you have the budget. If you don't, make sure you test your workflow thouroughly before you commit.


text:
Trouble in Cut a portion of an audio file, and add fade in and fadeout Effect
ffmpeg -i track1.wav -ss 00:00:38.160 -t 00:00:20.720 -vn -codec:a libmp3lame -ac 2 -b:a 256k -map a -af afade=t=in:ss=38:d=3,afade=t=out:st=55:d=3 output.mp3

This is how I am cutting the audio file.
My problem is, Fade in not working and fadeout working very well.
                   But if I cut audio from the beginning (0:0), Fade in and fade out working perfectly.


text:
What does Ma10p stand for?
i.e. a file is listed as being "1920x1080 HEVC Ma10p FLAC"
So....resolution / h.265 video codec / ? / .flac audio codec
On its own I'd guess the 10 stands for 10 bit depth, but the Ma is unknown to me. Other guesses is its some kind of h.265 preset.

"Main 10" stands for 4:2:0 10-bit color, and I'm Pretty sure "Ma10p" is just another way of saying Main 10.

I think it might be a format profile - MainConcept 10 bit profile, as described here?
https://www.mainconcept.com/us/products/for-developers/video/hevch265.html


text:
ffmpeg - get green overlay instead of red when using multiply?
multiply should result in a darker image according to this website. However every multiply options with input that I'm using resulted in darker green videos instead of layering it with colour that I use for layering.
Many people refer that as format issue and resolved by using format=rgba options, however in my case there I'm still stuck.
FFMPEG command :
ffmpeg -i red.jpg -i car.mp4 -y -filter_complex [0][1]scale2ref[a][b];[a]setdar=1/1[c];[b]setdar=1/1[d];[c][d]blend=all_mode=multiply:all_opacity=1[out];[out]eq=contrast=2:brightness=0.5[ckv] -map [ckv] output.mp4

with format=rgba
ffmpeg -i red.jpg -i car.mp4 -y -filter_complex [0][1]scale2ref[a][b];[a]setdar=1/1[c];[b]setdar=1/1,format=rgba[d];[c][d]blend=all_mode=multiply:all_opacity=1[out];[out]eq=contrast=2:brightness=0.5[ckv] -map [ckv] output.mp4

assets in case someone want to try it.
- Images
- Videos
FFMPEG version 4.1

Do you want to overlay a red tint on the video?

Yes exacly. I want to overlay it with blend mode multiply,

If you want a tint, don't use mode multiply, use mode overlay.

Shame on me, I just wanna try to replicate photoshop effect with multiply, so multiply on photoshop doesn't have the same effect in FFmpeg? HTML Canvas behave same like photoshop does


text:
How to overlay an image over video in percent

I want to overlay an image on top of a video and have reached these two links:

How to overlay/place an image on a video in ffmpeg [duplicate]

Add an image overlay in front of video using ffmpeg

And this is my command:

ffmpeg -i flower.mp4 -i rose.png \
-filter_complex "[0:v][1:v] overlay=W-w/2:H-h/2" \
-pix_fmt yuv420p -c:a copy flowers.mp4 -y

But I have not reached the thing I want yet.

I want the image be placed in top right with 10 percent space from right and 3 percent from top, or 10px from right and 5px from top right.

How to reach this to work with my desired percent?

There are some other videos with different scales, so I cannot use fix x and y for all of them.

Thanks in advance

Use
for 10% space from right, and 3% from top,
"[0:v][1:v] overlay=x='0.90*W-w':y='0.03*H'"

for 10 px from right, and 5 px from top,
"[0:v][1:v] overlay=x='W-10-w':y='5'"


text:
Advice on Creating Montage of TV Advertisements
I want to to attempt to create something like this for the modern age. It's a series of bits and pieces of advertisements from the early 70's that seeks to critique consumer culture. The maker of the film said that he was able to make it by getting access to some reels of advertisements and then editing it like crazy.
So here's my question: How would one get access to commercials of today? For example, what if I just see a commercial on my TV and want to incorporate that into my montage? How would I would access to it so that I can then put it into my editing software and get to work? I was thinking of maybe YouTube, but for one not all commercials are on YouTube and two the quality can often be spotty.

As a person who works for TV and does commercials on a regular basis, I'm afraid to tell you that a youtube-rip is probably your best option. The progress for a commercial usually goes like this:
You've got your customer. The customer speaks to an agency. That agency usually hires a production-company that actually makes the commercial. After that, the final files (usually prores 4444, 422 or rarely an h.264) will be transmitted to the customer for approval, and then go directly to the TV-Station which will broadcast the piece.
So from someone who is not directly part of the creating-progress, it's virtually impossible to get your fingers on the final files. Your best chance would be to ask politely, but I can tell you that those files are almost always exclusive to the people working on it.
Your best option might be to record the signal directly from the TV via something like an elgato capture card. If that doesn't work (or you don't want to spend the money on the hardware required) youtube and reuploads are your only option.


text:
Static on Mic line in when using EOS Utility on 600d
I've noticed quite a loud static noise on the line in of my camera when recording with EOS Utility. I've tried using different cabled for everything, and it works fine when the computer is not plugged in, or when it is, internal audio works fine. This one really has baffled me, and no matter what I do, it seems to persist. Thanks in advance for any help anyone can offer.

Thanks for your answer. I tried your suggestion, and it works! Again, thanks very much.

You are welcome. I re-posted it as an answer so that you can mark it as accepted.

The computer is probably inducing interference on the unbalanced mic cable. Try putting a ferrite bead/choke on the tethering cable.


text:
How to export many small clips in a sequence out as separate video files in Adobe Premier?
I have a video that I've chopped up into many small segments within the main sequence:

You might notice that I took one main video and then used markers to select exact frames and then used the razor tool to slice it up and then deleted the parts I do not want to export
Instead of putting all of these segments together into a single video, I need to export each clip or segment (sorry not sure of the actual term of these clips in Premier) as a separate video file.
Is this possible with Adobe Premier and if so, how might I do this?

Sounds like you want to create sequences for each of your clips and batch export those sequences.


text:
what could prevents MPC-HC from opening and playing mov file?
... and the strangest thing is that the very same file plays back just fine on a different (but very much identical) Win 10 system.
The file is a .mov prores video file. Both system have prores codec installed.
I reinstalled MPC-HC and reset all to default.
The file is playing in QuickTime Player (v7.7.9).

ProRes is only one of codecs using for encoding / decoding video into / from the .mov files container. You need other codecs, too, to be able play back all .mov files.
The Quick Time Player is the native player for the Apple's .mov files, so it has its own codecs for playing back them.
For Media Player Classic you need the appropriate codecs to be installed in your operating system (Windows 10).
Probably the simplest and most reliable method is to download and install the free K-Lite Codec Pack - the decision between its different versions (Basic, Standard, etc.) is up to you, all versions will cause that all media players will be able to play back all .mov files (and almost all others, too).

Downloading is installing the Standard version solved it. prores hq, yuv422p10le must somehow have been missing.


text:
ffmpeg: map 4 stereo pairs into 7.1 audio in FLV/RTMP
I am trying to get this ffmpeg command right, and think I am close but not quite there.  I have a source that has 4 stereo pairs in it (RTSP), so the source looks like this in ffmpeg:
Input #0, sdp, from '/tmp/sdp':
  Duration: N/A, start: 0.000000, bitrate: N/A
    Stream #0:0: Video: h264 (Main), yuv420p(progressive), 1280x720, 30 fps, 30 tbr, 90k tbn, 60 tbc
    Stream #0:1: Audio: aac (LC), 48000 Hz, stereo, fltp
    Stream #0:2: Audio: aac (LC), 48000 Hz, stereo, fltp
    Stream #0:3: Audio: aac (LC), 48000 Hz, stereo, fltp
    Stream #0:4: Audio: aac (LC), 48000 Hz, stereo, fltp

And what I want to do is output a single RTMP stream with 7.1 audio.  This is what I have so far (just a command fragment to leave off the output url):
ffmpeg -protocol_whitelist file,udp,rtp -threads 4 -loglevel info -i /tmp/sdp -filter_complex '[0:1][0:2][0:3][0:4]join=inputs=8:channel_layout=7.1[a]' -map 0:0 -map '[a]:1' -c:v copy  -c:a aac -b:a 384k -ac 8 -ar 44100 -f flv

In the output it throws:
Cannot find a matching stream for unlabeled input pad 4 on filter Parsed_join_0
What am I missing?

The inputs option in ffmpeg filters refers to number of streams, not channels.
ffmpeg -protocol_whitelist file,udp,rtp -threads 4 -loglevel info -i /tmp/sdp -filter_complex '[0:1][0:2][0:3][0:4]join=inputs=4:channel_layout=7.1[a]' -map 0:0 -map '[a]' -c:v copy  -c:a aac -b:a 384k -ac 8 -ar 44100 -f flv URL

That was it! Thanks so much!