text:
How to resolve ffmpeg error "input contains (near) nan/+-inf"?
I'm trying to convert some old WMVs into MP4s, but ffmpeg will not do it. I keep getting the following error:
 input contains (near) nan/+-inf
 audio encoding failed

Exact command used is:
 ffmpeg -i input.wmv -vf "scale=320:240,setsar=1" -crf 24 -c:a aac -b:a 48k -ac 1 -movflags +faststart output.mp4

If it helps, ffprobe gives the following:
Users\name>ffprobe input.wmv
ffprobe version N-90143-gb6652f5100 Copyright (c) 2007-2018 the FFmpeg developers
  built with gcc 7.3.0 (GCC)
  configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-bzlib --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libmfx --enable-amf --enable-cuda --enable-cuvid --enable-d3d11va --enable-nvenc --enable-dxva2 --enable-avisynth
  libavutil      56.  7.101 / 56.  7.101
  libavcodec     58. 12.102 / 58. 12.102
  libavformat    58.  9.100 / 58.  9.100
  libavdevice    58.  2.100 / 58.  2.100
  libavfilter     7. 12.100 /  7. 12.100
  libswscale      5.  0.101 /  5.  0.101
  libswresample   3.  0.101 /  3.  0.101
  libpostproc    55.  0.100 / 55.  0.100
[wmv3 @ 0000020416485e40] Extra data: 8 bits left, value: 0
Input #0, asf, from 'input.wmv':
  Metadata:
    WMFSDKNeeded    : 0.0.0.0000
    DeviceConformanceTemplate: MP@LL
    WMFSDKVersion   : 11.0.5358.4827
    IsVBR           : 0
  Duration: 00:27:02.46, start: 0.000000, bitrate: 205 kb/s
    Stream #0:0(eng): Audio: wmav2 (a[1][0][0] / 0x0161), 32000 Hz, 2 channels, fltp, 32 kb/s
    Stream #0:1(eng): Video: wmv3 (Main) (WMV3 / 0x33564D57), yuv420p, 320x240, 168 kb/s, 14.99 fps, 14.99 tbr, 1k tbn, 1k tbc
[wmv3 @ 00000204164fe740] Extra data: 8 bits left, value: 0

Definitely related to the audio. I was able to run the following: ffmpeg -i input.wmv -crf 24 -an -movflags +faststart output.mp4. However, I got a lot of "past duration x.xxxxxx too large" warnings.

I tried to run the original command with higher and lower -b:a values, but got the same errors.

Can you share the file?

@Gyan Sure: https://www.dropbox.com/s/0fkrw8vqzyjjsa7/A4M-083SS402.wmv

If you have a ffmpeg build with libfdk_aac then you can use that encoder since it doesn't report that error.
With your current build, you have to convert the audio to 16 bit integer samples first.
ffmpeg -i input.wmv -vf "scale=320:240,setsar=1" -crf 24 -af aformat=s16p -c:a aac -b:a 48k -ac 1 -movflags +faststart output.mp4

Thank you. What is the actual problem though? What's wrong with the wmv's audio that I would have to do this first?

During a transform process, some of the coefficients generated were too large in some frequency bands, as best as I can tell. No connection with the input codec or format.

Thanks, renders as expected now. Have you seen this before? I only have this happen to me on these old WMVs I have. And they're quite old. This one was captured in 2008, with tech from 2002.

No, this is an esoteric error from inside the encoding machinery. It's sort of strange that the encoder doesn't just smooth over the coefficients.


text:
How can I remove the background of a video if the background is still?
In example,
I have this exported Image from a video001

then someone enter to the room without move anything from the image and then leave.
There is a way to use the image as a keymap to remove every match from the video001 with the image?
The result should be only the differences between the video001 and the image.
I use Adobe Premiere Pro CC 2018, but if there is other tools to obtain that result, tell me please.
Thanks! :)

In your sequence, place a still frame of the background with your footage place above.

V2: Footage
V1: Still frame of background

In the Effects panel, find Video Effects > Keying > Difference Mask. Drag this effect onto your footage (the top-most track).

In the Effects Control panel, set the 'Difference Layer' to match the track with the still frame.

Hide the still frame (bottom track) using the 'Toggle Track Output'. The background will now be transparent.

Inconsistencies of lighting, shadows and movement of the background will have a big effect on the quality of the outcome.
Avoid casting shadows on the background by keeping the scene well lit. Be aware of objects in the background moving.
If necessary, use a combination of color keying (a wall with a solid colour that contrasts with the subject) as well as masks to hide parts of the footage where no movement occurs.

source: Stack Exchange

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

sort: votes


text:
Lossless A/V delay with ffmpeg
I downloaded this video but its' audio has approximately a 600ms advance compared to its' audio.
How can I fix that in a lossless manner (i.e -c copy) with ffmpeg ?

Basic method is
ffmpeg -i in.mp4 -itsoffset -0.6 -i in.mp4 -map 0:v -map 1:a -c copy new.mp4

FFmpeg will write an editlist in new.mp4. Players like VLC, Potplayer which parse the editlist will honor the delay whereas players like WMP, which don't, will start the streams at the same time.

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


text:
How does shutter speed affect the video?
As shutter speed affects the coming light on sensor.But has it any affect on movement of subjects in video?

Two things

The video gets brighter
The lower the shutter speed means more motion blur which makes it look more natural for the viewer

A high shutter speed can make individual frames look more crisp but make large motion look like it is stuttering. e.g. fast panning looks like it is flickering or jumping
A low shutter speed can make individual frames look blurred and make the motion look smooth.

A simple rule of thumb is to set shutter speed to double (x2) your project framerate.
EG: PAL project 25fps / Choose 50 shutter speed


text:
Unknown bitstream filter prores_metadata
When I type the following ffmpeg command:
```
ffmpeg -i input.mov -c:v prores -profile:v 3 -c:a pcm_s16le -bsf:v prores_metadata=bt709 output.mov
I have the following error:

Unknown bitstream filter prores_metadata

However this bitstream filter is documented here: https://ffmpeg.org/ffmpeg-bitstream-filters.html#prores_005fmetadata
My ffmpeg version is 4.1 downloaded from Homebrew on macOS 10.13.
Any idea what is going wrong?

The bitstream filter was added after 4.1.
Get a recent static git binary, like this one: https://ffmpeg.zeranoe.com/builds/macos64/static/ffmpeg-20181127-1035206-macos64-static.zip

I tried it on windows and it doesn't work. Is it possible that it's included only on macos/linux version?

Did you get the Windows 64-bit static dated build? I see it in there.

sorry my mistake it works.


text:
"shift +" while rendering in ffmpeg, how to undo?
I was rendering a video in ffmpeg and accidentally pressed "shift" and "+", and the below started happening.
What is this doing and how do I stop it and is it creating something I need to delete or worry about? And what do I do to delete it if so?

Don't worry, all you did is increase verbosity. The Shift had no effect, but the + increased it. Press - to cycle back to a lower verbosity level.
Press ? to see a list of all available commands.
If you want to not worry about accidental keypresses, you can add -nostdin to the command. Don't do this if one of your inputs is a pipe.


text:
How does an optical viewfinder on a film camera work?
As we all know, a DSLR camera works by moving a mirror out the sensors way when taking a picture and then going back to start, not exposing the sendor.
How does this process work, on an optical motion picture camera, while filming?
How can the dop/camera operator see what's beeing recorded?

There are three ways that film cameras do this:

Using a rangefinder, i.e. a viewfinder that doesn't actually view
through the lens. Common on cheaper consumer format cameras such as
super-8
Using a beam splitter. The ubiquitous Bolex 16mm cameras
have a prism in the light path that splits the light coming through
the lens, so that some of it goes to the film gate, and the rest
goes to the eyepiece.
This has the advantage of being through the
lens, and continuous, but at the cost of brightness for the viewer
and a stop or so of exposure for the film. From personal experience,
in low light it can be really hard to focus a Bolex.
Using a rotating mirror. In this setup a reflective mirror interrupts the
light path to the film, similar to a DSLR, but instead of hinging up it rotates.
When the camera is
stopped the mirror is parked so that it sends the light to the
viewer, and when shooting it rotates, acting as the shutter. While
the mirror is sending light to the viewfinder the film is being
pulled down to get the next frame in position in the gate. Then the
frame is exposed, during which time the viewfinder will be black. This cycle is repeated for each frame
This has the advantage that all the light available goes to expose
the film, but at the cost of some flickering in the viewfinder (I
found that helpful: it lets you know that the camera is running—on
silent cameras it can be almost impossible to tell otherwise).


text:
After Effects - Can Expressions read from Extend Script?
Backstory
I'm trying to learn about After Effects' different abilities.
Question
If I make a function using extend script like so
function alertStuff() {
    alert("stuff")
}

Can I call this using a layer expression?
alertStuff();

Short answer: no.
Long answer: There may be an unknown, undocumented hack that enables this, like modifying some of the core classes, or a workaround, like writing to a file and reading the results, but I've never heard of such a thing.
You probably know this, but it might be worth spelling out the differences between the two.
Expressions are evaluated every time a frame is rendered, either during preview or final render (this can be multiple times per frame when motion blur is turned on). They can access the properties of layers and compositions and other project items, as well as making some system calls and reading external files and a few other undocumented JS functions like time and date. They can not change any part of the project, they are limited to returning one value—the value applied to the property they belong to.
This is different to the way scripts work, which is to basically replicate anything the user could do, but programatically. They are not called at render time. Since scripts can change the content of compositions, there would be problems with calling them at render time: just using your example, the alert might be displayed 64 times per frame if motion blur was set really high—that would get old pretty quickly. But even for a non-trivial example: suppose you had a script that added a layer to the current comp. If it was called from an expression it would run every time the frame was rendered, whether it was at final render time, or during previewing, or when the user parked the playhead on the frame. With MB on that could mean 64 new layers could be added per frame—while the comp was being rendered. The results would get pretty messy.

You can read/write the expressions from ExtendScript ;)
For example for changing placeholders:
var propertyExpression = property.expression;
if (property.expressionEnabled && propertyExpression) {
  try {
    property.expression = propertyExpression.replace(new RegExp(placeholder, 'g'), 'string for replacement');
  } catch(e) {
  }
}

I had to make 6 nested loops to get into all expressions...
(The layers have properties, which have sub properties, which also have sub properties, ...)
So I guess you can insert alert("stuff") directly into an expression.


text:
FFmpeg/FFprobe marks non-idr keyframes as keyframes
I have a video clip I want to get the positions of all keyframes from. To achieve this, I tried running various ffmpeg/ffprobe commands, but all of them return similar output. From first 20 seconds of the video I always get keyframes at:
frame,0.000000
frame,3.000000
frame,5.000000
frame,6.416667
frame,10.000000
frame,15.000000
frame,19.041667

All of those also have the is_key value set to 1. The problem is, that the 'real' keyframes are only at intervals of 5. So of those above, the working keyframes are:
frame,0.000000
frame,5.000000
frame,10.000000
frame,15.000000

but if I try actually using other ones to, for instance, -c copy a part of video out, ffmpeg actually skips the non-idr keyframes and copies from previous keyframe to the point I requested.
Also in Avidemux if I load the file into it, the option 'jump to next/previous keyframe' only jumps between the keyframes at interval of 5.
How can I get ffmpeg/ffprobe to only return information about the usable keyframes, without knowing the file beforehand?
link to the file I worked on (it's big, but it's the only one I have right now)
https://drive.google.com/open?id=1aV3BLCrxNMhZX4uSBJzoiuNUhSm9CFap
full log output
ffprobe -loglevev verbose -skip_frame nokey -select_streams v -show_entries frame=key_frame,pkt_pts_time -of" csv=print_section=1 -read_intervals 0%+20 srcFile.mp4

ffprobe version n4.0-39-gda39990 Copyright (c) 2007-2018 the FFmpeg developers
  built with gcc 4.9.x (GCC) 20150123 (prerelease)
  configuration: --target-os=linux --cross-prefix=/root/bravobit/ffmpeg-android/toolchain-android/bin/arm-linux-androideabi- --arch=arm --cpu=cortex-a8 --enable-runtime-cpudetect --sysroot=/root/bravobit/ffmpeg-android/toolchain-android/sysroot --enable-pic --enable-libx264 --enable-ffprobe --enable-libopus --enable-libvorbis --enable-libfdk-aac --enable-libfreetype --enable-libfribidi --enable-libmp3lame --enable-fontconfig --enable-libvpx --enable-libass --enable-yasm --enable-pthreads --disable-debug --enable-version3 --enable-hardcoded-tables --disable-ffplay --disable-linux-perf --disable-doc --disable-shared --enable-static --enable-runtime-cpudetect --enable-nonfree --enable-network --enable-avresample --enable-avformat --enable-avcodec --enable-indev=lavfi --enable-hwaccels --enable-ffmpeg --enable-zlib --enable-gpl --enable-small --enable-nonfree --pkg-config=pkg-config --pkg-config-flags=--static --prefix=/root/bravobit/ffmpeg-android/build/armeabi-v7a --extra-cflags='-I/root/bravobit/ffmpeg-android/toolchain-android/include -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fno-strict-overflow -fstack-protector-all' --extra-ldflags='-L/root/bravobit/ffmpeg-android/toolchain-android/lib -Wl,-z,relro -Wl,-z,now -pie' --extra-cxxflags=
  libavutil      56. 14.100 / 56. 14.100
  libavcodec     58. 18.100 / 58. 18.100
  libavformat    58. 12.100 / 58. 12.100
  libavdevice    58.  3.100 / 58.  3.100
  libavfilter     7. 16.100 /  7. 16.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  1.100 /  5.  1.100
  libswresample   3.  1.100 /  3.  1.100
  libpostproc    55.  1.100 / 55.  1.100
Adding 'key_frame' to the entries to show in section 'frame'
Adding 'pkt_pts_time' to the entries to show in section 'frame'
Parsed log interval id:0 start:0 end:+20
[h264 @ 0xe9fa9380] Reinit context to 1280x720, pix_fmt: yuv420p
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/storage/emulated/0/Movies/Capture/bobross.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: isommp42
    creation_time   : 2016-08-22T05:06:42.000000Z
  Duration: 10:00:27.90, start: 0.000000, bitrate: 1127 kb/s
    Stream #0:0(und): Video: h264, 1 reference frame (avc1 / 0x31637661), yuv420p(left), 1280x720 [SAR 1:1 DAR 16:9], 997 kb/s, 24 fps, 24 tbr, 90k tbn, 48 tbc (default)
    Metadata:
      creation_time   : 2016-08-22T05:06:42.000000Z
      handler_name    : ISO Media file produced by Google Inc.
    Stream #0:1(und): Audio: aac (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 125 kb/s (default)
    Metadata:
      creation_time   : 2016-08-22T05:06:42.000000Z
      handler_name    : ISO Media file produced by Google Inc.
Processing read interval id:0 start:0 end:+20
Seeking to read interval start point 0
[h264 @ 0xe9fa9e00] Reinit context to 1280x720, pix_fmt: yuv420p
ffprobe version n4.0-39-gda39990 Copyright (c) 2007-2018 the FFmpeg developers
  built with gcc 4.9.x (GCC) 20150123 (prerelease)
  configuration: --target-os=linux --cross-prefix=/root/bravobit/ffmpeg-android/toolchain-android/bin/arm-linux-androideabi- --arch=arm --cpu=cortex-a8 --enable-runtime-cpudetect --sysroot=/root/bravobit/ffmpeg-android/toolchain-android/sysroot --enable-pic --enable-libx264 --enable-ffprobe --enable-libopus --enable-libvorbis --enable-libfdk-aac --enable-libfreetype --enable-libfribidi --enable-libmp3lame --enable-fontconfig --enable-libvpx --enable-libass --enable-yasm --enable-pthreads --disable-debug --enable-version3 --enable-hardcoded-tables --disable-ffplay --disable-linux-perf --disable-doc --disable-shared --enable-static --enable-runtime-cpudetect --enable-nonfree --enable-network --enable-avresample --enable-avformat --enable-avcodec --enable-indev=lavfi --enable-hwaccels --enable-ffmpeg --enable-zlib --enable-gpl --enable-small --enable-nonfree --pkg-config=pkg-config --pkg-config-flags=--static --prefix=/root/bravobit/ffmpeg-android/build/armeabi-v7a --extra-cflags='-I/root/bravobit/ffmpeg-android/toolchain-android/include -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fno-strict-overflow -fstack-protector-all' --extra-ldflags='-L/root/bravobit/ffmpeg-android/toolchain-android/lib -Wl,-z,relro -Wl,-z,now -pie' --extra-cxxflags=
  libavutil      56. 14.100 / 56. 14.100
  libavcodec     58. 18.100 / 58. 18.100
  libavformat    58. 12.100 / 58. 12.100
  libavdevice    58.  3.100 / 58.  3.100
  libavfilter     7. 16.100 /  7. 16.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  1.100 /  5.  1.100
  libswresample   3.  1.100 /  3.  1.100
  libpostproc    55.  1.100 / 55.  1.100
Adding 'key_frame' to the entries to show in section 'frame'
Adding 'pkt_pts_time' to the entries to show in section 'frame'
Parsed log interval id:0 start:0 end:+20
[h264 @ 0xe9fa9380] Reinit context to 1280x720, pix_fmt: yuv420p
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/storage/emulated/0/Movies/Capture/bobross.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: isommp42
    creation_time   : 2016-08-22T05:06:42.000000Z
  Duration: 10:00:27.90, start: 0.000000, bitrate: 1127 kb/s
    Stream #0:0(und): Video: h264, 1 reference frame (avc1 / 0x31637661), yuv420p(left), 1280x720 [SAR 1:1 DAR 16:9], 997 kb/s, 24 fps, 24 tbr, 90k tbn, 48 tbc (default)
    Metadata:
      creation_time   : 2016-08-22T05:06:42.000000Z
      handler_name    : ISO Media file produced by Google Inc.
    Stream #0:1(und): Audio: aac (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 125 kb/s (default)
    Metadata:
      creation_time   : 2016-08-22T05:06:42.000000Z
      handler_name    : ISO Media file produced by Google Inc.
Processing read interval id:0 start:0 end:+20
Seeking to read interval start point 0
[h264 @ 0xe9fa9e00] Reinit context to 1280x720, pix_fmt: yuv420p
frame,1,0.000000frame,1,3.000000frame,1,5.000000frame,1,6.416667frame,1,10.000000frame,1,15.000000frame,1,19.041667

The decoder is marking recovery points as keyframes
e.g. take the frame with PTS 3.00s
This is a recovery point* and the packet contains an I-slice (slice_type 7). Furthermore, as recovery_frame_cnt is 0, the decoder can immediately display frames from this point onwards.
Packet: 25021 bytes, pts 270000, dts 266250, duration 3750.
Supplemental Enhancement Information
0           forbidden_zero_bit                                          0 = 0
1           nal_ref_idc                                                00 = 0
3           nal_unit_type                                           00110 = 6
8           last_payload_type_byte                               00000110 = 6
16          last_payload_size_byte                               00000001 = 1
Recovery Point
24          recovery_frame_cnt                                          1 = 0
25          exact_match_flag                                            1 = 1
26          broken_link_flag                                            0 = 0
27          changing_slice_group_idc                                   00 = 0
29          bit_equal_to_one                                            1 = 1
30          bit_equal_to_zero                                           0 = 0
31          bit_equal_to_zero                                           0 = 0
32          rbsp_stop_one_bit                                           1 = 1
33          rbsp_alignment_zero_bit                                     0 = 0
34          rbsp_alignment_zero_bit                                     0 = 0
35          rbsp_alignment_zero_bit                                     0 = 0
36          rbsp_alignment_zero_bit                                     0 = 0
37          rbsp_alignment_zero_bit                                     0 = 0
38          rbsp_alignment_zero_bit                                     0 = 0
39          rbsp_alignment_zero_bit                                     0 = 0
Slice Header
0           forbidden_zero_bit                                          0 = 0
1           nal_ref_idc                                                10 = 2
3           nal_unit_type                                           00001 = 1
8           first_mb_in_slice                                           1 = 0
9           slice_type                                            0001000 = 7
16          pic_parameter_set_id                                        1 = 0
17          frame_num                                                1111 = 15
21          pic_order_cnt_lsb                                       10000 = 16
26          adaptive_ref_pic_marking_mode_flag                          0 = 0
27          slice_qp_delta                                        0001111 = -7
34          disable_deblocking_filter_idc                               1 = 0
35          slice_alpha_c0_offset_div2                                  1 = 0
36          slice_beta_offset_div2                                      1 = 0
37          cabac_alignment_one_bit                                     1 = 1
38          cabac_alignment_one_bit                                     1 = 1
39          cabac_alignment_one_bit                                     1 = 1

*see https://mailman.videolan.org/pipermail/vlc-commits/2010-October/003615.html

If your inputs are MP4s, you can examine the packets to get the IDR key status
ffprobe -loglevel verbose -skip_frame nokey -select_streams v -show_entries packet=pts_time,flags -of csv=print_section=1 -read_intervals 0%+20 srcFile.mp4

For the first 6 seconds, this will show only the frames at 0 and 5.
packet,0.000000,K_
...
packet,3.000000,__
...
packet,5.000000,K_

Out of curiosity, how did you generate the above table?

trace_headers bitstream filter.

Thanks, I totally forgot about this one.


text:
edit after effects projects with aerender and extend script
I want to edit after effects project (.aep file) with aerender. i used this command

aerenderer -project E:/AE/template.aep -comp Example -output E:/AE/video.avi

to render .aep file to .avi and every thing is fine. now i want to change the text in the .aep file and then render it with the new text. the question is: Is it possible to change the text with just aerender or i have to use extend script?

Aerender does what it says on the tin: it just renders. It can save a comp after rendering if there's a post-render action like setting proxies, but AFAIK it has no other capability to modify projects (figures, because it is available to put on as many machines as you want, so they don't want to be giving away a program capable of editing .aep files).
To modify an After Effects project you have to have a licensed instance of After Effects running. You can do it with extendscript in headless mode, so AE will run, but won't show the UI, but you can't run extendscripts without AE installed.
A better way to do what you want is to use the new data-driven animation features. You can use an expression so that the content of the text layer is linked to an external data file. Changing this file (which can be JSON, a piece of JS or just plain text) will change the contents of the text layer.
Using that workflow you

Set up your template with AE,
set the data file with Node (or whatevs) render,
replace the data in the file,
move the previous render,
render again, change the data, render, and so on.

One gotcha with that technique is that you have to move the rendered file between renders, because you can't change the destination of the comp in the render queue so it will try to over-write the old one.
If you're using older versions of AE you can still use external data files to drive the contents of a text layer using eval() in an expression. The technique is explained here (full disclosure: my personal blog).

first thank you for your answer. so these are the steps?
1- i must create animations in AE in data-driven mode with .aep format to be able to edit them
2- install an AE with licence
3- use extendScript to change data in the .aep files like text, image and etc.
4- use aerender to render .aep file and make video
(I want do this on the web server with nodejs or php)
are these steps OK ?

I made a typo. I said to modify a script you need AE installed, I meant modify a project. So with the data-driven animation the only file you have to modify is your data file, which can be JSON, or even just a text file, so you can use Node or anything. In that case once you have the template created in AE you only need aerender to render out the results, changing the input data each time with whatever you choose.

so i have a website that has say 1000 AE templates and each one has a logo and a 2 or 3 texts that must be changed by every user(users logins and writes the text and uploads the logo to make his/her video from .aep). in that case i must make data-driven AE templates and get the data from user and put the data in template data file and then render the project with aerender. and no need for extendScript. is that right?

Correct. Adobe have made this much more possible with the recent upgrade, I think they're pushing AE as a tool for server side content creation. There's probably more info on their site.

uhh, with the logo, you'd have to rename the image file so that it was the same each time, so that aerender would use it as the source for the logo layer.

hi @stib. would you please look at this question?
https://video.stackexchange.com/q/25445/23860


text:
Is it possible to modify a single precomp instance via scripting?
The Setup
- PreComp1
-- PreCompLayer1
--- simpleRectangleLayer

- Main Timeline
-- layer1
--- [PreComp1]
-- layer2
--- [PreComp1]

Question
Using only scripting is it possible to modify the inside of a single precomp instance? eg. change the color of layer1.PreComp1.simpleRectangleLayer

Scripting can do anything you can do with the UI. This isn't something you can do with the UI, so no, you can't do it with scripting. If you change the colour of precomp1.layer1.simpleRectangleLayer then it changes for all instances of precomp1. That's how precomps work.
You'd have to make a script that would do the same thing you'd have to do with the UI—duplicate precomp1 to make precomp2, change the colour of the layer and replace the source of layer2 to precomp2. I did make a script that does this kinda. It lets you duplicate a layer and make a duplicate of its source so that it can be changed. Available (free, open source) here (caveat: there are some bugs I've never found the time to iron out).

That's cool, thanks! I also figured out that I can use a hue/saturation effect on the precomp to make the background color change. Since the stroke is black it doesn't change at all.


text:
Final Cut Pro X — Connect audio clip to another audio (not video)
I have a simple video with some background noises added and a background audio track.
However, background audio track is too long, so I carefully cut it into multiple pieces and seamlessly mix:

It works fine, but my second audio part is now connected to the video on top — every next change in the timeline will break my carefully mixed audiotracks.
I want it to be connected to the first audio part instead.
Is it possible?

Create a compound clip with the music on the audio track. This will fix them in place. Replace the individual clips with the compound clip.

Perfect, thank you! (To create a compound clip you select clips and press ⌥G)


text:
FFMpeg - why recording a video and then compressing it produces a smaller size video than recording with combined options
I played a recorded video to test this, so video content would be same in both cases.
Recorded video length is 1 Minute in both cases.
There may be a split second difference in the videos as I start FFMpeg command in cmd window and then switch to VLC player to playback video.
1) command to record:
ffmpeg -f gdigrab -framerate 30 -i desktop -f segment -segment_time 60 out12Dec1%03d.flv

This recorded video of 1 min is 9.99 MB.
2) command to compress:
ffmpeg -i out12Dec1000.flv -vcodec libx264 -crf 20 output.mp4

This compresses the video to 1.76 MB
3) Now I am trying to use the parameters to directly capture in compressed mode instead of using 2 steps.
ffmpeg -f gdigrab -framerate 30 -i desktop -f segment -segment_time 60 -vcodec libx264 -crf 20  outvcodec12Dec19%03d.mp4

I tried both with and without framerate option, and used flv / mp4 for output.
The output videos are between 2.24 to 2.57 MB.
Why is the recorded output in case 3 not close to 1.76 MB?

Your first command is transcoding using FLV1 codec to store in .flv. This is not the same input provided to the x264 encoder as when directly encoded to H264. In fact, it's quite worse, since the default target bitrate set for FLV1 is 200 kbps (although for full desktop capture, it will overshoot by a lot). This has less complex detail in general so it's easier for x264 to encode than the full fidelity raw desktop input.

You might want to expand a bit on what you mean by "worse". I take it that you're saying that the material is already compressed, so there is less detail, which makes it easier to recompress into a smaller file.

Indeed. Added..

Thanks. Can we conclude that recording a video and then compressing will always create a smaller file size, or can I use some other options while recording?

With your current commands, yes, but the quality will be worse. I would recommend encoding to H264 directly, with these settings: ffmpeg -f gdigrab -framerate 30 -i desktop -pix_fmt yuv420p -c:v libx264 -crf 20 -preset veryfast -f segment -segment_time 60 out12Dec1%03d.flv.


text:
Extending a static PNG
is there a way in Premier Pro 2019 with a keyboard shortcut to extend a static png to the end of a clip?  For instance, I've edited the program and its ready.  I then insert the program or network logo (think the CBS EYE as an example) onto the its own video layer.  I want that watermark now to stay up for the entire program.  I've been doing it manually for quite a while, just dragging the end point to the end of the program, but that is quite tedious.  Anyone know of a shorter way?

Select the end of the png clip, so that the edit is highlighted. Then move your playhead to the end of the program, and hit e, which is the shortcut for extend edit. More info can be found by reading the manual.


text:
Hardware and internet requirements for 1080/30p streaming, if video source is external
I have a Panasonic X1 camera that can be connected to a pc using an acquisition card. In that case its video stream could be broadcasted using OBS or similar programs.
What I miss are the requirements of the pc hardware and of the internet line. If I understood well the first should be pretty low considering that all the videomaking would be demanded to the camera and to the acquisition card, and OBS would only have to throw it online. Yet, I don't even know which parte of the PC would be needed for such a job. The CPU? The video card? The RAM?
Concerning the line, I really have no clue. Streaming 1080/30p sounds heavy but there are cell phones able to do that with a 3G connection. Would a tethering connection to a 3G/4G phone be enough?

Connection Speed
For H.264 1080p30 streaming with typical compression (6 Mbps), I would recommend an Internet upload speed of around 10 Mbps minimum.
Hardware
OBS Studio suggests the following system requirements:

AMD FX series or Intel i5 2000-series processor (dual or 4-core
preferable) or higher.
At least 4 GB of RAM (recommended, but not necessary).

For Windows:

DirectX 10.1 compatible GPU.
Windows 7 SP1 or newer.

For macOS:

Intel CPU (PPC is not supported).
OpenGL 3.2 compatible GPU.
macOS 10.11 or newer.

As for mobile streaming, 4G LTE (between 2-5 Mbps) can manage 1080p30 - albeit with high compression.

Thank you for your reply. Sorry for my late one.
I have to admit that these don't look like terribly high requirements, I thought it could be worse.


text:
Rotate only a certain part of a frame
I tried to solve this for quite some time now and could not find the solution. I would like to select a certain "subarea" of a video and rotate/flip only that "subarea". Like a combination of these two one liners:
ffmpeg -i IN.mov -filter:v "hflip,vflip" -c:a copy out.mov
ffmpeg -i IN.MOV -filter:v "crop=out_w:out_h:x:y" out.mp4

Thank you for any help.

Do you want to discard the rest of the image?

No, I want to keep it.

What should appear in the background after the area is rotated?

Yes, select an area rotate it and paste it back into the same vid rotated. Background stays the same. Thanks

Use
 ffmpeg -i IN.MOV
        -filter_complex "[0]split=2[full][crop];
                         [crop]crop=W:H:X:Y,transpose=cclock[crop];
                         [full][crop]overlay='X+h/2-w/2':'Y+w/2-h/2'"   out.mp4

The video is split with one copy getting cropped and rotated. The other full copy remains full-sized. Then the edited portion is overlaid on the full portion.
The variables in capital letters should be replaced with your numerical values.


text:
Do video re-encoding operations affect the container's audio file?
Say I have a video file with contained audio file. So a container with audio and video codecs.
If I'm applying an operation in ffmpeg that will re-encode the video, such as applying filters or changing the container (assume it supports the audio codec) or video codec or whatever, does this also re-encode or affect the audio of the output file in any way?
Does the audio codec just automatically get a kinda pseudo -c copy command applied and translated over to new video file?
I'm trying to understand whether I need to specify a -c copy for the audio every-time I do an operation to the video part. Whether for the purpose of speeding up the operation or for avoiding quality-loss.
Like when setting an audio input and a video input and combining you need to specify a -c copy to get it to simply combine them. But I'm just a bit confused if you need to worry about it once the audio codec is already safely in the container and I'm applying operations to this video afterthefact.

In ffmpeg, copy mode for -codec / -c always needs to be expressly set.
So for
ffmpeg -i in -c copy out

ffmpeg will perform automatic stream selection and copy all those streams.
For
ffmpeg -i in -c:a copy out

ffmpeg will perform automatic stream selection and copy audio stream. Video stream will be transcoded.
I suggest you read the above link on stream selection fully. It covers stream handling.

Will I always get an error message and/or corrupted video when I specify -c copy or -c:v or -c:a when encoding of the specific type does infact need to happen? I'm just curious with -c copy if there might be instances, that I haven't tested, where it might drop the copy for say...the video stream if in my command its assumed I need to re-encode the video. Or will -c copy always tell me or make the video unplayable if there is any contradiction in the command that makes either the video or audio have to re-encode? Will ffmpeg ever make assumptions if there is contradiction without letting mekno

Encoding only needs to happen if you're filtering the stream or if the input codec is not supported in the output. Else if you set copy, ffmpeg will copy the stream over.

When you say filtering the stream does that refer to filters specifically? Or is there something else to that. Cause if I do -i input.mkv -c copy output.avi. it won't work. So isn't that an example where avi supports the .wav audio codec within the mkv and the h.264 8 bit format of the video codec? Is it the fitlering the stream part that plays into that then? I thought re-encoding always needed to happen when I'm changing containers, except in certain exceptions like mkv to mp4. re-encoding and encoding are referring to the same general thing right?

Filtering happens with -vf / -af / -filter_complex / -lavfi . -i input.mkv -c copy output.avi is an example of remuxing / rewrapping. If all streams are supported, this won't fail. Share log if it does.

https://imgur.com/a/esIJRIb ; I tried it on a few input videos and same error code. adding -bsf:v h264_mp4toannexb like it said in the error code fixed it though. Which I suppose functions as some kind of decoder as far as I can read into it. So I think I'm good, learned alot here.

ffmpeg -i %d.png -c:v libx264 -crf 0 -pix_fmt yuv420p -c:v copy output.mkv ; can you explain what is going to happen to the video in this relationship with -c:v copy there? Is it going to negate the -c:v libx264 part and simply store the png in the mkv without re-encode or does the "-c:v libx264 -crf 0 -pix_fmt yuv420p" apply to the image and then it stores itself still as this downgraded png in the mkv?

@kite -bsf:v h264_mp4toannexb is a bitstream filter, which is the rare exception to what Gyan was saying (technically not an exception, but for the sake of using the word 'filter').

@kite try it and see.  You can only specify one encoder per input file

ffmpeg -i %d.png -c:v libx264 -crf 0 -pix_fmt yuv420p -c:v copy output.mkv; says for the output the data is in png. So the c:v copy is preventing it from changing from png. Removing the -c:v copy says it converts from png to h.264 as written. "Input data: png, rgb48be(pc), Output data: png (MPNG/0x473E504D), rgb48be(pc)" Are what the info's of the inputs and outputs say for top command with -c:v used. I don't know what MPNG/0x etc.... means and my question is unchanged from before. Also I don't get if png are classified video codecs or how a h.264 codec applies to them without converting it.

Does the audio codec just automatically get a kinda pseudo -c copy command applied and translated over to new video file?

No, use -c:v for your video codec, and then -c:a copy to instruct the stream copy of the audio stream.
For example:
ffmpeg -i "inputfile" -vf "filter" -c:v libx264 -crf 18 -c:a copy "output.mp4"
Another note about ffmpeg defaults:
Not all things need to be explicit, only experience and reading the documentation gives you the best feel for this.  Notice that we had to explicitly specify the audio stream copy, yet in my example above, I haven't explicitly set -f mp4 container.  This is because the file extension of the output file (mp4) selects the default container for that file extension, which is something one may or may not want.

I'm not familiar with what -f mp4 or -f anything does in ffmpeg. The full command as you had written I'm familiar with, but not any extra variation on it with -f. What should I google to find more on that? And when would there be an instance of the extension of the output not being the container I want to use for my video? I always assumed the output extension existed to specify the container of my video and audio codecs and no other reason.


text:
Is there any difference between changing video containers with ffmpeg vs just renaming with windows?
For example say I use the command:
ffmpeg -i input.mkv -c copy output.avi

(In my case I need to add -bsf:v h264_mp4toannexb)
Well I can also just copy and rename the file from input.mkv to output.avi manually in windows. When I callup their info in ffmpeg...it's almost same. With the exception that ffmpeg also does slightly different video durations...which is kinda worrisome but from the listed information online it doesn't affect anything other than if you potentially gutted the video into 2 sections and were trying to recombine it using the old times.
But I mean between the two, windows is providing a more accurate and possibly more easy method...no?
Are there just exceptions and for some formats windows won't let you change the containers with filename changes by default?
Or is this just a generic function ffmpeg does in order to facilitate its more advanced commands?
Just curious if I'm missing something.

No, a Windows (or Mac or Linux) file rename will not change the container. They are inherently different file formats. They store data differently. They reference the audio and video tracks differently. Re-wrapping from one container to another can actually be a fairly complex operation depending on how the two formats store essence tracks. It may seem like ffmpeg isn't doing any "real work" compared to a transcode, but that is because the video doesn't have to be decoded in a re-wrap. The compressed bits only need to be re-written in a new order with some new metadata.
Think about it this way: just renaming a Word document from .docx to .xlsx doesn't make it an Excel workbook. Your story doesn't get turned into a spreadsheet just because you changed the extension. You need to a use a program to convert every tab into a cell.
The only exception where a simple rename works is where the extensions are synonyms of each other. For example, if you have a program that is expecting all QuickTime wrapped files to be .qt, but you have a .mov, you can rename the file to get it to work. But that is only because they are two different extensions that identify the same container format.

It's pretending to change the container and it's just tricking ffmpeg and everything into believing its an avi container now? Again, is there a way to confirm this? I believe I understand your post, windows lets me change the extension of a .txt file to a .png and it'll read as a png and all that in ffmpeg as well. But in the case of the avi.....it plays fine...reads as an avi....what is the real difference in that case? I'm just tricking everything into thinking an mkv is an avi? Couldn't that be useful for other purposes?

I just find that kinda disturbing if there's no way to confirm for real, as doesn't that mean you can trick anything into believing something is something else? A .exe can be hidden as an image file.....etc?

Most programs will actually verify the format of the file using more than just the extension.


text:
Can Davinci Resolve convert a movie into (png) pictures...?
I'm a new user of Davinci Resolve. I would like to know if I can use it for converting a video into its pictures ? Do you have a tutorial that explains to me how is the workflow ? maybe on Youtube ? very thanks.

With a simple search on a very popular search engine I found the answer on the BlackMagic Davinci Resolve forum.

man,I haven't asked which kind of graphic files da vinci supports,but what's the workflow if I want to convert a video into its pictures...

We will need a lot kore information on your workflow. System setup  current apps etc.

use Apple compressor (assuming your using an Apple Mac to convert from video file to png)

From the Blackmagic Forum "You can only export TIFF files (which then can be converted to png's with an external tool), not PNG's directly. "


text:
Are there only a maximum of 1 re-encodes per stream in an ffmpeg command?
Does ffmpeg only re-encode a maximum of 1 times per stream, when you execute any command no matter the number/kinds of operations/flags?
For example very simply I tried:
ffmpeg -i input -r 33 -r 54 output

To see if there was any indication that it did re-encode twice, and the streams seemed to show the same changes as if there was only a single -r flag there.
Given my limited understanding of the information on the official site (I looked through this stuff again: https://ffmpeg.org/ffmpeg.html#toc-Detailed-description) documentation I'm leaning towards the notion that there's only 0-1 re-encodes happening per stream based solely on whether I specify copy or not (outside of errors). Is this the correct understanding of things?

Yes, each output stream undergoes, at most, one encoding. If you map an input stream to multiple output files or multiples times in one output file, those count as distinct output streams.
copy must be set as the codec value for an output stream in order to avoid re-encoding it.


text:
How can I crop and export a video to be 480x480 in Premiere?
I've seen several posts regarding how to resize a video to have a 1:1 aspect ratio, but all of the posts show how to do it by making a Sequence in Adobe Premiere Pro CC and crop to 1080x1080 or 720x720. My video is 774x632, and I'd like to export it to 480x480. I tried importing a 480x480 image and overlaying it on the video, then cropping the video to fit that, but when I went to export it, the settings were stuck at 720x480 with black spacing on the sides of the video, and I couldn't change settings. Is there a good way to do this with Premiere or any other software? For what it's worth, I'm a DevOps engineer and not proficient in video editing so there may be an obvious solution I missed, and any advice would be appreciated!

Downscaling video
By scaling down a video, you are essentially compressing an amount of pixels to a less amount, which per definition means quality loss. While modern techniques and algorithms are not bad at their job, scaling videos, especially to odd multiples, can give odd results. But if you are really sure that this is what you want, here's how you can do it in Premiere Pro:
Setting up the sequence
In Premiere, you first create a new sequence of the desired resolution for your video. In the New Sequence pop-up, under the Settings tab, select Editing Mode: Custom. Now fill in the Frame Size to 480 horizontal and 480 vertical. Fill in other values in the screen as desired and appropiate for the project.

Resizing the video
Add your video to the just created sequence. Now we need to calculate the values at which we are going to scale the video:
480 / 774 ≈ .62 as vertical scale value
480 / 632 ≈ .76 as horizontal scale value

So then we simply fill in these values in the Effect Controls of the video. (Make sure the Uniform Scale option is not selected, otherwise you wont be able to set a different value for the width.)

And thats it! You can now export the sequence, Premiere Pro will automaticly take over the sequence settings.


text:
4:3 - 16:9 Aspect Ratio Conversion with Pillarbox and Textbox
I'm trying to use FFMpeg to adapt 4:3 (SD) to 16:9 (HD) and reverse function.

When SD is converted to HD, I need to add pillarboxes around the content.
When HD is converted to SD, I need to add textboxes.
Reverse of 1, I need to remove the pillarbox to convert to SD.
Reverse of 2, I need to remove the textbox to convert to HD.

For 1, I already found a solution:
ffmpeg -i input43.mp4 -vf "scale=640x480,setsar=1,pad=854:480:107:0" out43HD.mp4

But what are the commands to do 2, 3, and 4?

A small bit on terminology :- SD and HD refers to resolution - in the basic sense of the word, not dimensions. A given video can be wide or tall or square while being SD or HD. It's the legacy of television broadcast standards that SD content is 4:3 and HD 16:9 but display aspect ratio and visual definition aren't connected. That nitpick aside..
For 4:3 to 16:9 and back.
ffmpeg -i input43.mp4 -vf "scale=iw*sar:ih,setsar=1,pad=ih*16/9:ih:(ow-iw)/2:0" out43in169.mp4

ffmpeg -i out43in169.mp4 -vf "crop=ih*4/3:ih" backto43.mp4

For 16:9 to 4:3 and back.
ffmpeg -i input169.mp4 -vf "scale=iw*sar:ih,setsar=1,pad=iw:iw*3/4:0:(oh-ih)/2" out169in43.mp4

ffmpeg -i out169in43.mp4 -vf "crop=iw:iw*9/16" backto169.mp4

The crop filter automatically crops from the center of the input frame so it's not necessary to specify the x and y offsets. Audio is transcoded, always. Add -c:a copy to avoid that.

Thanks. Video has to be encoded anyways, right? We can not use -c:v copy?

Btw, does ffmpeg use multi-threading by default? I'm thinking how we can make it run faster. How about running on GPU?!

FFmpeg does processing in multiple threads where possible.

-c:v copy is not possible here.

this is ok for 1 shot encoding when you eyeball control your input, in any batch stuff you should cropdetect first (https://www.nab.org/documents/resources/paperTandberg.pdf) and use logic for correct cropping/scaling the area of interest depending on your i/o dar, it can be quite pain in the butt in fact to automate it in a bulletproof way...


text:
How to transcode HEVC footage on a mac if you don't have CC2018 yet
Is there a good free way to convert iPhone HEVC footage to .mov prores or something similar using a Mac (MacOS 10.12) with Premiere CC 2017?  Googling provides lots of unreliable looking apps from companies I haven't heard of. Any good (preferably free) recommendations?

The other question says Windows/Linux, but the top voted applies to macOS as well.

Not really. I’m not using windows or Linux. I don’t necessarily need ProRes, just any high quality format suitable for editing on Premiere CC 2017

Please read the first answer of the linked question.

Go with handbrake.  It's a free GUI program for performing transcodes.  It is even used to benchmark processors and graphics cards.

Install Homebrew.
Open Terminal.
Install FFMPEG with extra features by entering the following on a single line:
brew install ffmpeg --with-fdk-aac --with-ffplay --with-freetype --with-libass  --with-libvorbis --with-libvpx --with-opus --with-x26

Wait about 10 minutes for it to install.
From the Terminal, run FFMPEG, using a line like this:
ffmpeg -i input.mov -c:v prores -profile:v 3 -c:a pcm_s16le output.mov

input.mov is the name of your HEVC file.  It can also include a full path, but spaces need to be preceded by backslashes  “\”
output.mov is an exported ProRes quicktime movie that will play in Premiere
Do process more than one file at a time:
In terminal, go to the directory where your files are.
for i in *.mov; do ffmpeg -i "$i" -c:v prores -profile:v 3 -c:a pcm_s16le "${i%.*}_out.mov"; done

Output files will appear in the same folder appended with “_out.mov”


text:
MPEGTS & HLS: Only second segment onwards is valid
When i use hexadecagonal audio channel layout in an mpegts container, I can receive and play back the stream fine only if I configure the hls server to allow serving the very first segment, and then concatenating subsequent segments.
I.e. If I probe segment 1414:
[mpegts @ 0x7faf58001200] Could not find codec parameters for stream 1 (Audio: aac (LC) ([15][0][0][0] / 0x000F), 0 channels, fltp, 1464 kb/s): unspecified sample rate
Consider increasing the value for the 'analyzeduration' and 'probesize' options

Input #0, mpegts, from '1414.ts':
  Duration: 00:00:02.07, start: 2834.393367, bitrate: 9079 kb/s
  Program 1
    Stream #0:0[0x100]: Audio: aac (LC) ([15][0][0][0] / 0x000F), 0 channels, fltp, 1430 kb/s
    Stream #0:1[0x101]: Audio: aac (LC) ([15][0][0][0] / 0x000F), 0 channels, fltp, 1464 kb/s
    Stream #0:2[0x102]: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p(progressive), 1920x1080 [SAR 1:1 DAR 16:9], 59.94 fps, 59.94 tbr, 90k tbn, 119.88 tbc
    Stream #0:3[0x103]: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p(progressive), 1920x1080 [SAR 1:1 DAR 16:9], 60 fps, 60 tbr, 90k tbn, 120 tbc
However if I probe the first segment:
Input #0, mpegts, from '0.ts':
  Duration: 00:00:02.02, start: 1.412033, bitrate: 11598 kb/s
  Program 1
    Stream #0:0[0x100]: Audio: aac (LC) ([15][0][0][0] / 0x000F), 48000 Hz, 16 channels, fltp, 1353 kb/s
    Stream #0:1[0x101]: Audio: aac (LC) ([15][0][0][0] / 0x000F), 48000 Hz, 16 channels, fltp, 744 kb/s
    Stream #0:2[0x102]: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p(progressive), 1920x1080 [SAR 1:1 DAR 16:9], 59.94 fps, 59.94 tbr, 90k tbn, 119.88 tbc
    Stream #0:3[0x103]: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p(progressive), 1920x1080 [SAR 1:1 DAR 16:9], 60 fps, 60 tbr, 90k tbn, 120 tbc
The playlist file is very simple and looks like this:
#EXTM3U
#EXT-X-VERSION:3
#EXT-X-MEDIA-SEQUENCE:0
#EXT-X-TARGETDURATION:4

#EXTINF:2.000,
0.ts
#EXTINF:2.000,
1.ts
#EXTINF:2.000,
2.ts
#EXTINF:2.000,
3.ts
#EXTINF:2.000,

etc ...

With say an 8 channel layout, this does not happen.. every segment contains the correct headers.  But my preference is to keep 16 channels because my application at the receiving end uses 16 channel files, and this avoids the need to transcode when downloading.
I am using FFmpeg to upload the mpegts stream.
Any insight to the mechanics behind what's going on here, and what I can do to achieve the desired independence of segments ?

For non-conventional layouts, the native AAC encoder writes a PCE section in the bitstream header as part of the AudioSpecificConfig. However, it does so only at the beginning, therefore subsequent files have AAC streams with this missing.
Workaround is to change to a different packetization scheme for AAC in MPEG-TS.
Add -hls_ts_options mpegts_flags=latm when generating the HLS package.

this seemed to fix the issue, thanks.  (In my case I used -mpegts_flags latm directly).  Is there any unintended consequence that may surface from this ?  Having a read through ANSI/SCTE 193-2 2014 suggests that LATM is in fact the preferred encapsulation anyway.

Not all HLS players may accept AAC-LATM.


text:
How can I resize Final Cut Pro X to fit on the screen with the dock on the left visible?
Sometime after upgrading to MacOS 10.14 Mojave, FCPX has resized wider and seems to have a minimal width. I can't make the main window smaller than the screen width. This means it either hides behind the dock (located on the left side of the screen) or part of it disappears on the right side of the screen. I don't want to move the dock to the bottom, I don't want the autohide, and don't want the full screen option.
How can I resize FCPX to fit on the screen with the dock on the left visible?

Try under the ”Window” menu the ”Zoom” function. That should resize the FCPX window (and any other Mac OS window) so that all is visible.

Didn't work at first, because I had hidden the dock, but this fixed the problem. Thanks.


text:
Export an image frame with FFmpeg
This article describes how you can use ffmpeg to export a frame of a video file as a PNG image using the following command:
ffmpeg.exe -i input.mkv -vf select=gte(n\,360) -vframes 1 output.png

My question is what -vf select=gte(n\,360) really does and how it works. I could not find any documentation on this, neither in the official documentation or elsewhere on the internet.
From the context I know this tells FFmpeg to use the 360th frame, but I would like some further documentation on how to use this. What does gte mean and what is n\,?

In
-vf select=gte(n\,360),
-vf declares a video filterchain i.e. a sequence of one or more filters to be applied to the video stream.
The select filter allows the user to keep or discard individual frames, based on the result of the expression presented to it. For each frame, the expression is evaluated. If the result is zero, the frame is discarded, else kept. Here, the expression is gte(n\,360) which checks if the index i.e. presentation serial number, of the current frame is equal to or greater than 360. So, this expr will result in all frames with index 0 to 359 to be discarded, and all frames with a higher index to be selected.
See https://ffmpeg.org/ffmpeg-utils.html#Expression-Evaluation for a list of functions available.
See the docs for the select filter to see the list of variables which can be tested.
Since -vframes 1 is present, ffmpeg will stop after one frame has been received from the select filter.

"Expression Evaluation" that was the name I was looking for


text:
After Effects: Jagged edges on shape layer and white borders in general
The two white shapes are virtually the same but on different layers in picture 1. I don't know why I'm getting these jagged edges on one of them. I've already toggled 'quality and sampling' but it doesn't fix it. I tought it was just a preview issue but they end up being rendered like this.
It happens in another comp also, but in footage's borther (picture 2).
I'm using after effects CC 2017

Is the footage interlaced? Are you rendering interlaced?

It's embarrasing, but it was a blending mode issue.
I must have accidentaly fiddled with blending and couldnt percieve it.
sorry for the dumbness.


text:
Why is image stabilization in my smartphone so much better than in post production?
I recently bought Google Pixel and have gotten into blogging. Occasionally I'll turn off image stabilization when using a tripod, but if I forget to turn it back on it drastically affects the quality of videos.
I recently filmed an entire evening worth of un-stabilized video and tried to fix it in iMovie with the "stabilize shaky video" feature, but it did a bad job and couldn't match what the Pixel is ordinarily capable of.
How is it a tiny smartphone can do such a better job in real time compared to post production? Is it all just algorithms, or is something else going on in hardware?


text:
Fix vertical panning
I have a video i want to loop (about 6  seconds long) that gradually moves downwards. Which video tool or filter can I use to realign the image?
I experimented with Davinci resolve but it the panning/stabilizing tool has no option to limit it to vertical only.

Glad you found a solution, but to set the record straight, DaVinci's stabilization tool can limit its effect to a single axis.  Here are steps which work on as of version 15.2.1:

Open the color tab.
Activate the tracker panel (it looks like a crosshairs reticle)
Change the tracker's mode from window to stabilize.  Do this by clicking on the dropdown disclosure triangle next to the word "Window" or on the word itself.  (this UI behavior is inconsistent in other parts of DaVinci).
Change the Stabilizer mode to "Classic Stabilizer."  This option exists under the ellipsis dots menu just to the right of the word "Stabilizer."  It's the second item from the bottom of the list.
You should now see boxes for Pan, Tilt, Zoom, and Rotate.  What you call "vertical pan" is usually called, "tilt" in the industry, so make sure that's the only box that's checked.
At the bottom of the tracker interface, change the dropdown menu from "Point Tracker" to "Cloud Tracker" if necessary.
Click "Stabilize."  Additional settings and options are described in the Chapter 119 of the user manual, "Sizing and Image Stabilization."  DaVinci's manual is pretty unwieldy, so it's easy to miss.

I fixed it with a panning / zoom plugin I found for virtualdub

Please add details of your solution, so future readers are helped. Thanks.

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


text:
cuvid - slow performance when used 4 devices
Has 4 nvidia devices:
nvidia-smi topo --matrix
        GPU0    GPU1    GPU2    GPU3    CPU Affinity
GPU0     X      PHB     SYS     SYS     0-5,12-17
GPU1    PHB      X      SYS     SYS     0-5,12-17
GPU2    SYS     SYS      X      PHB     6-11,18-23
GPU3    SYS     SYS     PHB      X      6-11,18-23

Legend:

  X    = Self
  SYS  = Connection traversing PCIe as well as the SMP interconnect between NUMA nodes (e.g., QPI/UPI)
  NODE = Connection traversing PCIe as well as the interconnect between PCIe Host Bridges within a NUMA node
  PHB  = Connection traversing PCIe as well as a PCIe Host Bridge (typically the CPU)
  PXB  = Connection traversing multiple PCIe switches (without traversing the PCIe Host Bridge)
  PIX  = Connection traversing a single PCIe switch
  NV#  = Connection traversing a bonded set of # NVLinks

We want to re-code h264 videos to lower resolution.
When we run 2-3 processes per 0 and 1 devices:
ffmpeg -v error -y -hwaccel cuvid -hwaccel_device 0 -c:v:0 h264_cuvid -gpu 0 -i /mnt/worker/6797/be2c96e8f0fd7/objects/133607/fb3/8279fb61a4d0bf66c3f871bdb30e5fb3/1530758904.34570.data -map_metadata -1 -map_chapters -1 -map 0:v:0 -map 0:a:0 -c:v:0 h264_nvenc -gpu 0 -b:v:0 650000 -filter:v:0 scale_npp=-2:360 -c:a:0 aac -gpu 0 -b:a:0 96000 -ac:a:0 2 -max_muxing_queue_size 9999 -movflags +faststart -f mp4 /home/uploads/tmp/out.mp4

all works fine
nvidia-smi dmon -c 1
# gpu   pwr gtemp mtemp    sm   mem   enc   dec  mclk  pclk
# Idx     W     C     C     %     %     %     %   MHz   MHz
    0   102    48     -    20     9    14   100  3304  1189
    1   105    54     -    25     9    17    99  3304  1201
    2    15    27     -     0     0     0     0   405   135
    3    15    27     -     0     0     0     0   405   135

but when works 2-3 processes per each device, then performance gets low.
Summary compared to 2 devices:
nvidia-smi dmon
# gpu   pwr gtemp mtemp    sm   mem   enc   dec  mclk  pclk
# Idx     W     C     C     %     %     %     %   MHz   MHz
    0    89    45     -     8     3     5    37  3304  1189
    1    92    50     -     9     3     6    30  3304  1201
    2    76    42     -     9     3     6    29  3304  1201
    3    87    44     -     9     3     6    33  3304  1189

htop,top,iftop,atop show nothing overloaded
Sometimes performance rises higher, or drops below (i`m suspect it depending on input files)
How to I can utilize all decoders ?

Realistically - get a faster machine. That's pretty much the fix.

@DrMayhem what means faster? We have 2 CPU - Xeon(R) CPU E5-2620 v3. 20% loaded.

Faster/more CPUs. Faster pipeline. Greater concurrency.

@dr-mayhem cpu is not loaded more than 15% when hwaccel is used

Hett - it's everything. cpu was one of many things worth looking at.

@DrMayhem I`m wrote: "htop,top,iftop,atop show nothing overloaded"

Problem was resolved by replace
scale_npp=-2:360

to
scale_npp=-2:360,hwdownload,format=nv12

now decoders fully loaded:
nvidia-smi dmon -c 1
# gpu   pwr gtemp mtemp    sm   mem   enc   dec  mclk  pclk
# Idx     W     C     C     %     %     %     %   MHz   MHz
    0   101    50     -    27     8    15   100  3304  1189
    1   105    54     -    25     8    12   100  3304  1201
    2   104    52     -    48    10    19   100  3304  1316
    3    97    50     -    23     9     8   100  3304  1189

NVidia boards has a limit number of concurrent encoding tasks, according number of encode engine chips on board. Look at specifications of boards you are using.
Even if you have a board with unrestricted number of sessions to it, you will have a speed degradation, because of some task pipelining on host side.

you are not right! I use full hardware transcode (learn about hwaccel) https://trac.ffmpeg.org/wiki/HWAccelIntro

processes outside of limits lead to an error


text:
Realtime time overlay with ffmpeg
I'm using the following ffmpeg command to create an H.264 encoded MPEG transport stream from a single png file with a text overlay.
ffmpeg -re -loop 1 -i smpte-color-bars-1080p.png -vf drawtext="fontfile=monofonto.ttf: fontsize=96: box=1: boxcolor=black@0.75: boxborderw=5: fontcolor=white: x=(w-text_w)/2: y=(h-text_h)/2: text='MY OVERLAY'" -r 25 -vcodec libx264 -f mpegts udp://0.0.0.0:1234

This seems to be working well, but as it is static you cannot easily tell if the encode has stopped. I'd therefore also like to add a timecode overlay so that the image has some changing content.
It is important that the stream is generated from a single static frame as I want the stream to be absolutely continuous and not a looped pre-encoded TS file.
Is there any way to add this dynamic overlay using ffmpeg? (I'm currently thinking piping one stream into another but that seems a bit hacky)
I'm trying to do this on a linux (Ubuntu) platform.

Wow... ffmpeg never ceases to amaze.. it's built in!
ffmpeg -re -loop 1 -i smpte-color-bars-1080p.png -vf drawtext="fontfile=monofonto.ttf: fontsize=96: box=1: boxcolor=black@0.75: boxborderw=5: fontcolor=white: x=(w-text_w)/2: y=((h-text_h)/2)+((h-text_h)/4): text='%{gmtime\:%H\\\\\:%M\\\\\:%S}'" -r 25 -vcodec libx264 -f mpegts udp://127.0.0.1:1234

The important bit for the timecode being: text='%{gmtime\:%H\\\\\:%M\\\\\:%S}'
There is some crazy escaping in there to get the colons to display(in bash), but that is UTC/GMT time of day timecode burnt in... just need to figure out the syntax for multiple drawtext functions now and I'm all set...

What is the -re option for?


text:
Keep fixed symbol on a source text linked expression
I have a text layer (property: Source Text) connected to a slider control, in the way that the slider goes from 0 to 40 and the text layer simply follows the same amount.
Now, I want to have a fixed symbol which it will be "%" next to the number but of course with the current expression:

effect("Slider Control")("Slider")

It is not possible to have a symbol since the expression tells the text layer to follow the value of the slider.
Must be super simple but I don't have the knowledge to fix the expression.

The final result would be the text layer going from 0% to 40%
Thanks in advance.

To add text items together in Javascript is super easy, you just use the + operator, which is 'overloaded' so that when the either term in an expression x + y is a string, the output is the first and second terms concatenated, as a string.
So you can just use + "%" to add a "%" symbol to the end of a number. Works for any character, e.g. 123 + "-foo" would result in 123-foo.
TL;DR:
effect("Slider Control")("Slider") + "%"

Note that the result of the slider will be a float (i.e. a number with lots of decimal places). That might not be what you're looking for. You can round it to an integer by using the Math functions, specifically Math.round (rounds to nearest integer) or Math.floor (always rounds down).
Math.round(effect("Slider Control")("Slider")) + "%"

For extra credit: If you did want some decimal places, say 2 decimal places, then multiply the number by 100, round it and then divide by 100:
Math.round(100 * effect("Slider Control")("Slider"))/100 + "%"

It was easy! Thank you so much, your answer will be really helpful when playing with this kind of string.

The Adobe docs for expressions are here: https://helpx.adobe.com/after-effects/using/expression-basics.html I'd also suggest having a look at some basic JavaScript tutorials such as the ones at https://www.w3schools.com/js/default.asp Although aimed at Web development a lot of it is applicable for expressions, including some JS features not documented in the Adobe docs.


text:
Adobe Software: Make low quality videos out of folder with videos
I have a folder with 212 videos in 4k in it, I'd like to make kinda like proxy files out of them, low quality 360p.
It should end up in a seconde folder and still be h.264 so that it can easily be shared and opened everywhere.
Is there a way inside Adobe Creative Cloud to make that?

This feature is supported through Adobe Media Encoder (AME) which is basically the background rendering engine for a number of the cloud apps including Premiere and AE.
You need to set up watch folders. So long as AME is running, (I also believe you can have AME run as a background service now - but you may want to double check that) - and you have your preferences in AME correctly set up, any files placed into a watch folder will be processed based on attributes you specify - per watch folder. So you can have a folder where any files that you download or place there will be automatically trans-coded into XYZ format, only when system is idle, etc, then original file should be kept, or moved, or renamed.
AME also allows you to do a number of post processing on the files automatically, such as watermarking, basic image enhancements, etc.
Essentially you specify a watch this folder, then create a template to bake the files placed there.
Documentation for this is online at Adobe and countless tutorial videos exist on YouTube detailing basic and advanced setup solutions.

Thank you! Exactly what I was looking for. May I also ask if there is a way to burn filenames onto it?

I found it myself, Effects -> Text Overly -> Filename

Adobe Premiere appears to support a managed proxy workflow.  This article includes details on using the official proxy workflow through the Premiere Pro Media Browser, using the Create Proxies option.
If you are looking at doing distributed editing, you may also want to consider looking at something like DaVinci Resolve Studio.  It has an even nicer managed proxy workflow and also supports shared distributed projects to make working in a team easier.


text:
H.265(libx265) codec for 8K videos, using same compress settings, why yuv444 10-bit is saving bitrates than yuv420 8-bit?
Our workflow involves huge 8K clips(i.e., 8192x8192). The inputs are mostly very high bitrates 264/265 clips, though we are using ProRes or  DNxHD for post-production within the process, we do not want to archive such huge files as the "master" copies(easily over 100GB for 1 minute).
My current approach is, using FFMPEG to compress the ProRes/DHxHD clips into H.265 clips using a very high-quality setting (crf=12, slow profile).
Another quality related setting is the pixel format config. Then my question comes up:
Targeting the same clips(5 of them), using the same compress settings, one with yuv420 8-bit, one with yuv444 10-bit, yuv444 outputs are constantly smaller than yuv420 outputs(5%-10%), i.e, lower bitrates.
If yuv444 10-bit needs to store more information, how could this be possible?

I can't answer your question, but may I ask which camers you are using? As not even RED's r3d codec at 8k uses so much storage. Thanks.

Yes, this is not from a single camera, they are VR content, a multiple camera setup.

From Why does 10-bit save bandwidth (even when content is 8-bit)?

When encoding with the 10-bit tool, the compression process is
  performed with at least 10-bit accuracy compared to only 8-bit
  otherwise. So there is less truncation errors, especially in the
  motion compensation  stage, increasing the efficiency of compression
  tools. As a consequence, there is less need to quantize to achieve a
  given bit-rate.
The net result is a better quality for the same bit-rate or conversely
  less bit-rate for the same quality: between 5% and 20% on typical
  sources.

See the link for additional info.


text:
Surround sound for cinema feature film (Pricing of Dolby Surround)
We are planning to shoot our first feature film with a budget of around 100'000-2'000'000$. And we'd like to master it in 5.1 Surround sound.
Normal procedure would be to do it with Dolby Surround, is there a source where I can find out how much this will cost? Or do I need to contact them?
Will it be realistic for our budget?
If not, what is the best way to make Surround sound for cinema?
We use Adobe CC and probabbly easyDCP for export.

If your plan is to deliver the end product as a DCP, you don't need any Dolby licensing or approval, you can just deliver the theater mix as a 6 discrete channels 5.1 mix in the DCP container.
Nevertheless, you will need an experienced sound mixer and appropriate dubbing theater. Budgeting the audio production and post-production will depend on many factors and the help of a sound person might be needed.

Thank you, yeah. We will employee a semi-professional sound mixer :) Pr professional if the budget is higher. I have a pretty solid Surround Sound setup at home, would you say this isn't enough to make the mix? If it ain't, can we mix the film at home, go to a professionall studio and do the fine adjustments there?


text:
Camera configuration - Should I select an AVCHD interlaced format over MP4?
I just bought a 2016 Full HD (not 4K capable) video camera and it supports encoding in AVCHD (I believe this is AVCHD 2.0) and MP4. The available Full HD formats are:
AVCHD

1080:60p 1920x1080 60p 28mbps
MXP 1920x1080 60i 24mbps
FXP 1920x1080 60i 17mbps

MP4

1920x1080 60p 35mbps
1920x1080 30p 24mbps
1920x1080 30p 17mbps

I read multiple sources of information online saying that AVCHD was of higher quality and that it should be the preferable option. However my concern is that, unless I choose the high bitrate AVCHD 108060p option, AVCHD is an interlaced format. Here are my questions:

Isn't interlaced a thing of the past that should be avoided nowadays because interlaced screens are just don't available anymore ?
When editing my video, I will plan for the final product to be encoded in a 1080:30p mp4 file. Will the deinterlacing process reduce the quality when compared to shooting in 30p right from the camera ?
Like mentioned earlier it is often mentioned that AVCHD is of better quality, in my camera I have 24mbps and 17mbps options for both formats, will AVCHD look better even if the bitrate is the exact same (and as far as I'm concerned the codec used is also the same H.264 but I guess encoding parameters may differ) ?
Finally, when AVCHD 2.0 was defined, 1080 at 60p was included in the standard, why wasn't 1080 at 30p also included since most if not all video equipment is now using progressive displays.

Sorry for the long question but I think this is all related and I never found a good source of information online that was answering these questions.
Thanks.

If you post mediainfo readouts for a clip recorded as AVCHD 60p and one for MP4 60p, we can give more informed answers, but off the top of my head, the video coding layer of both formats is the same. In which case, the MP4 60p, due to having the highest bitrate, is your best option.

AVCHD as a format is a combination of containers, file naming conventions, and directory structure. It is not inherently better or worse than any other container types.
Interlaced video is a thing of the past, forget about it.
If your final product is 30p, you can shoot at 30p, edit at 30p and render at 30p. Or you can shoot at 60p and edit at 30p - this allows you to use 60p for 0.5x slo-mo. If you don't want slo-mo, then just drop 60p into 30p timeline, and any decent editor will simply throw away every other frame.
Yes, deinterlacing reduces quality unless you shoot PsF or 24P with pulldown. Even then, if you do not properly remove the pulldown, your video will be ruined. Even if you remove the pulldown, your chroma still may remain interlaced. Long story short, prefer native progressive formats for any and all frame rates. If you really need to deliver interlaced, converting from progressive to interlaced is much easier than deinterlacing.
Clearly, your camera shoots with better quality in MP4 mode simply because it provides higher bitrate, which is always better provided all other settings are equal.
I believe that 1080p30 is included in AVCHD standard. Many camcorders shoot in this format.

I will answer only to the 'interlaced' part.
Yes, it's a thing from the past. Deinterlaced video always will be looking worse than progressive. It's like shooting through the cracked lens and then trying to fix the footage on post. In any circumstances don't shoot a scene with chromakey in interlaced mode. I won't go into details but the results will be terrible.
Advantages of 60p: you will always be able to make slow motion; due to less motion blur, it'll be easier to key the footage.

I'll take on the whole answer.  If your target delivery format is interlaced, because it says so in the specifications, then shoot interlaced.  But if you are not shooting for commercial, and not bound to interlaced specifications, then progressive is where it's at.
The fundamental choice of interlaced vs. progressive (based really on your intended delivery format) has a far greater effect on your perceived video quality than AVCHD vs. MP4 for similar bit rates.  Yes, there are multi-thousand dollar converters that will do a half-decent job interpolating between the interlaced and non-interlaced worlds, but they, too, will introduce greater artifact problems that if you shot according to your intended delivery format.
If you cannot get the video quality you want from a 35Mb/sec 1080p60 or a 24Mb/sec 1080p30 video file, the solution is to get a camera that does meet your quality specs, chances are high that you will also not get it from a 28Mb/sec 1080i video format from that camera.

"All playback devices... are progressive" is overstating things greatly. There are many, many older interlaced only displays out there. Consumers don't replace things the second something new comes out. Also, the majority of transmission systems, except OTT, are still interlaced. Depending on what your target audience/distribution is, it can make more sense to stick to interlaced.

Can we agree that somebody who is creating content on a consumer digital device with decidedly non-Class 1 specifications is not so worried about broadcast distribution, thus mooting the transmission system leg of your argument.

Network? Probably. But in the US, local cable and even broadcast advertising production is done with some pretty questionable quality equipment so I'm reluctant to make generalizations without knowing what the target usage is.

"If your target delivery format is interlaced, because it says so in the specifications, then shoot interlaced." - even if your target format is interlaced, still shoot in progressive if you can get the same image rate, like 60p for 30i delivery or 50p for 25i delivery. In particular, EBU has been advocating using 1080p50 for initial acquisition and mastering for the last 20 years, even if delivering in interlaced format. Now the Europeans are reaping benefits of this fateful decision, as Europe is switching to 1080p50 broadcast.

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


text:
DaVinci Resolve: hide timeline viewer
I was playing around with Resolve, and managed to show a second window thingy (the black one in the screenshot) via View > Source/Timeline Viewer. Now I can't seem to make it disappear. I have tried Workspace > Layout > Reset UI Layout, but it doesn't remove the second window. How can I remove it?

The current way to accomplish this is to either:
1) Toggle the menu [Workspace] > [Single Viewer Mode]
- or -
2) Toggle the [ ] / [][] button (top right of the viewer)

NOTE: Resolve will only enable the options and allow the use of two viewers if it has enough screen space (screen real estate) to do so. And that is probably the reason why opening/closing the Inspector affected the dual view.
(Resolve 15)

I stumbled upon one way of doing this, and that is to click "Inspector" at the top right of the UI:

actually, as soon as you play something in the source viewer, the inspector window closes and the timeline viewer closes, so this doesn't help.

I can't remember my workflow, but it certainly worked for me.


text:
Add overlay video and animated text (textbox and shadow) with FFmpeg
I'm trying to figure out how this works, but I couldn't find the final solution.
ffmpeg -i input -i overlayvideo \
-filter_complex \
"[0:v] setpts=PTS-STARTPTS [v01]; \
[1:v] setpts=PTS-STARTPTS [gradient]; \
[2:v] drawtext=fontfile=...font.ttf: text='Test': fontcolor=white:fontsize=54: shadowcolor=black@0.6:shadowx=4:shadowy=2: \
box=1: boxcolor=a60000@0.4:boxborderw=10:x='310':y='350',format=yuva444p,fade=t=in:st=1:d=1:alpha=1,fade=t=out:st=7:d=1:alpha=1, setpts=PTS-STARTPTS[v1][txt]; \
[v01][gradient] overlay [v02]; \
[v02][txt] overlay=[outv]" \
-c:v libx264 -profile:v main -level:v 3.1 -pix_fmt yuv420p -c:a aac -map [outv] \
-f mp4 -y 'output.mp4'

The error message:
No output pad can be associated to link label 'txt'.
Error initializing complex filters.
Invalid argument*

I've studied these solutions, but for the time being, I don't understand where I made the mistake.
https://stackoverflow.com/questions/47322739/ffmpeg-overlay-multiple-fading-texts-with-different-colors

https://trac.ffmpeg.org/wiki/Create%20a%20mosaic%20out%20of%20several%20input%20videos

What have I forgotten why the output is not good?
Thank you for your advice and help.

You only have two inputs, so 2:v can't exist. Instead, you'll need a base canvas to draw the text upon. I've used the color source filter for that. And you probably want that canvas to be the same size as the video. I've used scale2ref for that.
ffmpeg -i input -i overlayvideo \
-filter_complex \
"[0:v] setpts=PTS-STARTPTS [v01]; \
[1:v] setpts=PTS-STARTPTS [gradient]; \
color=black@0:duration=8,format=yuva444p[txtbase];[txtbase][v01]scale2ref[txtbase][v01];[txtbase] drawtext=fontfile=...font.ttf: text='Test': fontcolor=white:fontsize=54: shadowcolor=black@0.6:shadowx=4:shadowy=2: \
box=1: boxcolor=a60000@0.4:boxborderw=10:x='310':y='350',fade=t=in:st=1:d=1:alpha=1,fade=t=out:st=7:d=1:alpha=1[txt]; \
[v01][gradient] overlay [v02]; \
[v02][txt] overlay[outv]" \
-c:v libx264 -profile:v main -level:v 3.1 -pix_fmt yuv420p -c:a aac -map [outv] \
-f mp4 -y 'output.mp4'

I've added -map 0:a because I want to use sound of main (input) video file. The timing of the text is still mysterious, but I'll keep under testing. Otherwise it works well, thanks @Gyan!

Hello Mr. @Gyan I am using this command to overlay into videos ffmpeg -y -i input.mp4 -i overlay.png -filter_complex overlay=0:0 -strict -2 -c:a copy -flags +global_header -qscale:v 3 output.mp4 When sending on iphone the audio is muted problem give the solution regarding this command Thank you


text:
Changing the fps of playback in ffplay
If I have a video, say an mkv with h.264 codec @ 25 fps. Can I play it in ffplay with a different fps, say 30fps?
I know if the video was in still images, ffplay lets you assign a -framerate 30. But the -framerate and -r commands don't seem to function given my input is a video to begin with. I tried finding more information in the documentation and online, but I only found references to changing the fps when I have still image formats.
Is the solution to use ffplay -vf "setpts=0.5*PTS" -i inputto simply modify the speed of playback? I was curious about the PTS value and how to confirm what that is and how it changed my command if I have a weird framerate like 24.4444534634. Cause the generic is listed as 0.5 equating to 2x faster, and 2.0 equating to 0.5x slower. I find this doesn't addup though, especially when you get to higher values like 60x speed, etc. i.e. ffplay -vf "setpts=1/60*PTS" -i input This is outputting a speed the exact the same as 1/100000000000 and etc for many values. Is this a case of my pc not being able to generate the output within the presets of the system fast enough? Or just the weird fps of my footage is doing something? Or I need to confirm the PTS value and do the calculation properly for the specific video in question?

At the very least, you are limited by the speed of the video decoder. But ffplay does seem to have some barrier to speed increase.
For now, a workaround is to pipe from ffmpeg
ffmpeg -i in -an -vf setpts=PTS/60 -f yuv4mpegpipe - | ffplay -

Example:
ffplay -f v4l2 -framerate 15 /dev/video4


text:
Adding a sine generated audio track to a video stream with ffmepg
I'm generating an MPEG transport stream from a PNG file with ffmpeg succesfully with the following command:
ffmpeg -re -loop 1 -i smpte-color-bars-1080p.png -r 25 -vcodec libx264 -tune zerolatency -f mpegts udp://0.0.0.0:1234

I'd like to add an audio track to this usingthe sine function but am falling at the first hurdle.
I've tried:
ffmpeg -re -loop 1 -i smpte-color-bars-1080p.png -r 25 -vcodec libx264 -tune zerolatency -i sine=frequency=1000 -f mpegts udp://0.0.0.0:1234

and get the error:
Unknown decoder 'libx264'

Which implies that my arguments order is wrong.
So I then tried:
ffmpeg -re -loop 1 -i sine=frequency=1000 -i smpte-color-bars-1080p.png -r 25 -vcodec libx264 -tune zerolatency -f mpegts udp://0.0.0.0:1234

and get the error:
sine=frequency=1000: No such file or directory

What is the correct syntax for adding a sine generated audio in this case?

sine is a source filter, so the input format needs to be set as a filter using -f lavfi.
Use
ffmpeg -re -loop 1 -i smpte-color-bars-1080p.png -re -f lavfi -i sine=frequency=1000 -r 25 -vcodec libx264 -tune zerolatency -acodec aac -f mpegts udp://0.0.0.0:1234


text:
Adobe Premiere: PNG transparency ist not interpreted correctly
I have a video project and i want to put a png image on top of the video for a few seconds at the beginning. The png file only contains some white writing without any background color. However, when i put it over my video there is a weird blending effect where the opacity declines circularly with very ugly contours. It is hard to describe but here is a screenshot:

The writing from the image is on the top and the blurred content is from the background video. The black area with the hard border however should not be there and i don't get where it is coming from. I created the png file with photoshop and tried different export setting such as "save for web" as PNG-24 with transparency checked and RGB Color.
I'm using Adobe CS6.
Does anyone know what i might do wrong here? Thanks.

I don't have the files to look at, so I can't say for sure, but if you're importing a flat PNG Premiere should interpret the transparency correctly and convert it with transparency on the alpha layer.
One thought, make sure you're using layer the PNG on layer 2 or above.
Second, make sure you are placing the PNG above a filled video layer (Black Video), File -> New -> Black Video
Third, if that still gives you problems, try saving your file as a layered PSD file in Photoshop. Import it in and when prompted/select the import the layers as individual layers.
Then place the layers as needed and in what order on your timeline.
Lastly, it could possibly be your timeline/sequence settings - importing in a 24 bit PNG to a lower bit depth sequence could and would cause color issues if the sequence doesnt support that bit depth.
Last, you should be working in sRGB unless there's a specific need for another workspace.
Hope this helps.

"importing in a 24 bit PNG to a lower bit depth sequence could and would cause color issues if the sequence doesnt support that bit depth." - That was it! I exported the PNG again with 8 Bit and know it looks as expected. Thank you.

Glad that worked for you!

Place the animation on the timeline. Clicking on the wrench at the lower right corner of the Program Monitor, set the monitor to display the transparency grid:If your animation looks correct (the transparency is correct) then export the animation from the timeline in a codec that supports a matte channel, like ProRes 4444, or QuickTime Animation.MtD


text:
Fujifilm X-T3 or BMPCC4k for musicvideos and feature film
I'm currently looking which camera that I should buy.
I narrowed it down to the BMPCC4k or the Fujifilm X-T3, but not sure which one I should pick...
I mainly make music and event videos, but next year I will film a feature length film.
The RAW and color of BMPCC4k is really nice, but it doesn't really have a low bitrate codec for smaller music videos... So the storage can get quite expansive.
Also I'm not a huge fan of MFT, but with a Speedbooster this is not so important. Allthough a Speedbooster is quite costly.
What would you say is better for this type of shooting?

As long as you can do the job right, there is no contest here.  BMPCC4k all the way.  The X-T3 is a nice mid-range photo camera, but it's a still camera first and a video camera second with all the limitations that entails.  The BMPCC4K is a very solid entry level digital cinema camera.  It lacks the more full featured functionality of it's bigger brothers like the BMPC or Ursa Mini, but it inherits from their roots.
Yes, the file sizes are large and you shouldn't underestimate the cost of data storage.  If you are planning on shooting a feature length film in 4K RAW, expect to be using around 10-17TB of footage (I am working through post on a six episode TV series shot in 4K on a mix of Ursa Mini and BMPC4k currently.)  What you get for that extra data is well worth the cost though, especially on a large project.  You get a degree of flexibility in your color that is unmatched in the DSLR/Mirrorless camera video shooting world, which will greatly assist in your color grade efforts in post.  Also make sure you get your hands on a color target to simplify fine tuning your color as you go and save yourself lots of time in post.
Do make sure you have sufficient lighting and know what you are doing when it comes to exposure though.  While the Black Magic line of digital cinema cameras is a great line, it does not hold your hand.  It expects you know what you are doing and doesn't do a great job of covering for your mistakes, even up in to the Ursa end of their product line.  They can produce amazing images if you use them right, but used incorrectly, you'll have far better results out of the DSLR/Mirrorless world.
I have experience shooting video professionally with both a Canon 5D Mark iii (with Magic Lantern installed) and most of the Black Magic line of digital cinema cameras.  There is no comparison between them when used properly.  There are a few special cases I'd choose my 5D over my Ursa Mini, but they are few and far between (mostly low light shooting where it actually has to look like low light.)
The one thing that might be a gotcha for you would be that if you do weddings, the Black Magic line is really not well suited for weddings compared to the X-T3, but for music videos and feature film production where you can control the light to fit your needs vs the other way around, Black Magic wins hands down by a significant margin.


text:
after effects - motion graphics/kinetic text
Attempting to replicate this graphic. How can I replicate and be sure to have the squeezing effect as well as the subtle motion blur
I plan for the graphic I'm working on have text that remains static to the left with additional text to the right compresses to the right and changes.

Text in after effects can have animators applied at the character, word or line level. The animators work kinda differently to normal animated properties in that the property that gets animated usually doesn't have keyframes, but is instead controlled by a selector which is comprised of a group of controls that determine what part of the text is to have the modification applied. Normally you animate the selector to add animation to the individual parts of the text.
Select your text layer and choose Animation>Animate Text>Position from the top menu or from the Add menu for the animator group in the Timeline panel. If you add some X offset to the position property that appears in the new animator group, and play with the selector beginning, end, and offset values you'll get a bit of an idea.
Now once you've fiddled with it for a bit, and probably got confused, head on over to the manual and give it a read.
As far as Motion Blur goes, if you turn on motion blur for the layer, and make sure it is on in your render settings you'll be golden. If you want to see it while you're working (at the price of much slower previews) turn on motion blur in the timeline window. How you do all that is also (surprise!) in the manual.

Thank you so much! this set me on the right track.

As they say on Youtube, "like and subscribe". Or more precisely, if it answers your question, hit the tick to mark it as correct—it helps others find the answer too.


text:
Video editing software that will follow a subject in a cropped area of the video
Is there any free video editing software that will follow a subject through a cropped area of the video? A friend of mine is trying to make a video for a nonprofit and is using iPhoto but when she crops it, at certain places in the video it ends up cutting off her head. Is there software that will allow you to specify a certain object or outline in a frame of the video to remain visible while it crops?

So you want to move the frame to keep the subject on screen?

You have two options:

Keyframes:
Most a bit more advanced video editing programs have key frames, with them you say at time X, crop to Position Y. The computer will automatically fill the motion.
Depending on the scene, this method needs a lot of work tho.
Tracking:
Another way is to track the subject. That's about what you said in the question. You specify an area and the computer follows it. A freeware with this feature would be DAVINCI RESOLVE or Hitfilm. But both software require some basic knowledge of video editing.


text:
Error when using the tee pseudo-muxer in FFMPEG
I am trying to output both an .264 and .mkv at the same time, while not having to encode it twice. The way to do this is of course with the "tee" muxer, however I am getting an error that I cannot figure out. If I encode each output separately as below it works fine:
-i input.mov -vcodec libx264 -map 0:v output.mkv
-i input.mov -vcodec libx264 -map 0:v output.264

However the following gives me an error:
-i input.mov -vcodec libx264 -map 0:v -f tee "output.mkv|output.264"

The error is Cound not write header for output file #0 (incorrect codec parameters ?): Invalid data found when processing input. Error initializing output stream 0:0. How could there be an error in the codec, when each worked just fine on their own?

Use
-i input.mov -c:v libx264 -map 0:v -flags +global_header -f tee "output.mkv|[bsfs/v=dump_extra=freq=keyframe]output.264"

The required format of H264 bitstreams can differ based on how it is stored. Containers like MKV and MP4 require that the bitstream parameters be stored globally. Usually the encoder embeds them within the bitstream itself, which is how raw H264 bitstream (.264, .h264) is stored. Now, the encoder normally separates out this metadata or not based on how ffmpeg signals what the output muxer wants. But the tee muxer doesn't represent any container. It is an intermediate layer added to allow reuse of payload packets into multiple outputs. So there is no effective signaling from muxer to encoder.
In your particular use, the added complication is that the two output formats require different bitstream formats. The added global header tells the encoder to generate a MP4/MKV-compatible bitstream and then the bsf filter reinserts the metadata for the .264 output.

Thanks Gyan, that did the trick. Seems like good info for whenever you use the Tee muxer - I just ran into the same thing trying to encode a DNxHD .mov to two separate .mkv files (one stereo, one 5.1).

I don't understand what bsfs/v... does. I assume this would be equivalent to the -bsf flag, in which case bsfs/v doesn't make any sense. Of course manuals on such things are either unclear or non-existent.

This is a tee-specific syntax so see https://ffmpeg.org/ffmpeg-formats.html#Options-12


text:
FFMPEG: Make video with non-constant framerate from image filenames
I have a large group (tens of thousands) of images which were captured to an SSD at the max speed possible, which was therefore not a constant frame rate. Because of this, when using FFMPEG to turn these into a constant frame-rate video it seems to speed up and slow down when it shouldn't.
Is there a way to tell FFMPEG to time the images based on the timestamp in the filename rather than a constant framerate?
For example, consider the following (contrived) list of files:
2019-01-28-08-00-28-000-000.tiff
2019-01-28-08-00-28-700-000.tiff
2019-01-28-08-00-28-900-000.tiff

These should be three sequential frames, but should have varying times between them. Then I can use the minterpolate filter to make it a smooth transition.

Which OS are you using?

I can use Windows or CentOS or Ubuntu if that somehow changes how FFMPEG works.

The image2 reader in ffmpeg can assign timestamps based on the modification time of the file, with nanosecond precision. Not possible on Win, AFAICT. So, on a linux box, you can parse the filename and generate a timestamp and touch the mtime of the file. The absolute timestamps don't matter, just need to make sure the deltas in the mtimes correspond to the desired deltas. Then rename or symlink the images to form a smooth numbered sequence. Once done, read as follows: ffmpeg -f image2 -ts_from_file 2 -i images%d.jpg -vf minterpolate=...

Awesome! Thanks! I'll give it a try! Can you post this as an answer so I can mark the question resolved if it works?

The below answer was provided as a comment on the question by Gyan. I've reposted it as an answer so this question can be marked as solved.

The image2 reader in ffmpeg can assign timestamps based on the modification time of the file, with nanosecond precision. Not possible on Win, AFAICT. So, on a linux box, you can parse the filename and generate a timestamp and touch the mtime of the file. The absolute timestamps don't matter, just need to make sure the deltas in the mtimes correspond to the desired deltas. Then rename or symlink the images to form a smooth numbered sequence. Once done, read as follows: ffmpeg -f image2 -ts_from_file 2 -i images%d.jpg -vf minterpolate=... – Gyan

This worked for me! I was able to use the touch -d command to set the timestamp on each file based on the filename, then use ffmpeg -f image2 -ts_from_file 2 -i %d.png out.mp4 to create the video. Interpolation ended up being time-prohibitive, but shouldn't really be necessary in my final video.