text:
ffmpeg and mapping against 2 target audio tracks!
Im trying to mux and encode a TS file with 2 audio tracks from a mov file.
ffmpeg -loglevel verbose -i test.mov -map 0:1 -map 0:2
-acodec:0 aac -ab 160k  -acodec:1 eac3 -ac 6 -ar 48000 -ab 640k -dialnorm -24 -dsur_mode 0 -original 1 -dmix_mode 2 -channel_layout 63   -y test.ts

Im ending up with 2 audiotracks, both EAC3..
Source output:
ffprobe version N-94156-g93a73df54d Copyright (c) 2007-2019 the FFmpeg developers
  built with gcc 9.1.1 (GCC) 20190621
  configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libdav1d --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmpt
  libavutil      56. 30.100 / 56. 30.100
  libavcodec     58. 53.101 / 58. 53.101
  libavformat    58. 28.101 / 58. 28.101
  libavdevice    58.  7.100 / 58.  7.100
  libavfilter     7. 56.100 /  7. 56.100
  libswscale      5.  4.101 /  5.  4.101
  libswresample   3.  4.100 /  3.  4.100
  libpostproc    55.  4.100 / 55.  4.100
[h264 @ 000001c37707e640] Reinit context to 1920x1088, pix_fmt: yuv420p10le
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 's:\test.mov':
  Metadata:
    major_brand     : qt
    minor_version   : 512
    compatible_brands: qt
    encoder         : Lavf58.21.100
  Duration: 00:02:28.61, start: 0.000000, bitrate: 61419 kb/s
    Stream #0:0(nor): Video: h264 (High 10), 1 reference frame (avc1 / 0x31637661), yuv420p10le(left), 1920x1080 (1920x1088) [SAR 1:1 DAR 16:9], 52197 kb/s, 23.98 fps, 23.98 tbr, 24k tbn, 47.95 tbc (default)
    Metadata:
      handler_name    : Apple Video Media Handler
      encoder         : Lavc58.36.100 libx264
      timecode        : 00:00:00:00
    Stream #0:1(eng): Audio: pcm_s24le (in24 / 0x34326E69), 48000 Hz, stereo, s32 (24 bit), 2304 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
    Stream #0:2(eng): Audio: pcm_s24le (in24 / 0x34326E69), 48000 Hz, 5.1, s32 (24 bit), 6912 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
    Stream #0:3(eng): Data: none (tmcd / 0x64636D74) (default)
    Metadata:
      handler_name    : Apple Video Media Handler
      timecode        : 00:00:00:00
Unsupported codec with id 0 for input stream 3

Anyone know whats wrong?

Use
ffmpeg -loglevel verbose -i test.mov -map 0:1 -map 0:2
-codec:a:0 aac -b:a:0 160k  -codec:a:1 eac3 -ac:a:1 6 -ar:a:1 48000 -b:a:1 640k -dialnorm -24 -dsur_mode 0 -original 1 -dmix_mode 2 -channel_layout 63 -y test.ts
acodec is an alias for codec:a and it does not accept stream specifiers. Same goes for other codec-related options like bitrate.

Seems that ure answer partly helped the situation, as now both AAC and eAC3 are present in the mux.. But the AAC track is 5.1, but the source track is stereo. The eAC3 track is 5.1 as the source..

It's the channel_layout. That will force all output tracks to that layout. Remove it.

That did the trick.. I got a rogue mpeg2 video track in addition.. but i muxed it out! Thx!


text:
Software that captures and compresses simultaneously
I'm trying to find open-source software that compresses video captured from a webcam automatically. I'm thinking of automatically compressing like in post-production. For example, compressing the file down from, say, what would have been 2.5 GB to 95 MB when it's initially saved.
Is there any software with this feature that's somewhat user-friendly?

Most consumer video recording software I know compresses on capture. Mpeg and others can be configured for lower quality if you want greater compression, but unless you are recording a plain black screen at night in the dark, nothing will give you the level of compression you mention - it just isn't possible.

source: Stack Exchange

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

sort: votes


text:
FFmpeg issue with aspect ratio
I'm using the following command (in my android application) to overlay an image on top of a video:
"-i", video.mp4, "-i", image.mp4, "-filter_complex", "[0:v]pad=iw:if(lte(ih\\,iw)\\,ih\\,2trunc(iw*16/9/2)):(ow-iw)/2:(oh-ih)/2[v0];[1:v][v0]scale2ref[v1][v0];[v0][v1]overlay=x=(W-w)/2:y=(H-h)/2[v]", "-map", "[v]", "-map", "0:a", "-c:v", "libx264", "-preset", "ultrafast", "-r", outFPS, output.mp4

I implemented the above after asking this question.

This works perfectly fine when the video aspect ratio is 16:9, but I have users that complain that the image is not at the correct position. I noticed that this is on devices that has a different aspect ratio, for example 13:6.

Is it correct if I change the command to the following, if for example, the aspect ratio is 13:6?
"-i", video.mp4, "-i", image.mp4, "-filter_complex", "[0:v]pad=iw:if(lte(ih\\,iw)\\,ih\\,2trunc(iw*13/6/2)):(ow-iw)/2:(oh-ih)/2[v0];[1:v][v0]scale2ref[v1][v0];[v0][v1]overlay=x=(W-w)/2:y=(H-h)/2[v]", "-map", "[v]", "-map", "0:a", "-c:v", "libx264", "-preset", "ultrafast", "-r", outFPS, output.mp4

I don't have a device to test with, thats why I decided to ask a question.

EDIT:
I tested with the command above using a video with the following dimensions - 1980x1020 - aspect ratio of 16:9, then the video dimensions change to 1040x480 - aspect ratio of 13:6.
That is exactly what I wanted, here is the issue:
If I use the video mentioned above (1040x480 - aspect ratio of 13:6) and I try to change the aspect ratio to 16:9, using the first command in this question, then I get the following error:
[Parsed_pad_0 @ 0xeeb3f540] Input area 0:-94:480:946 not within the padded area 0:0:480:852 or zero-sized
[Parsed_pad_0 @ 0xeeb3f540] Failed to configure input pad on Parsed_pad_0
Error reinitializing filters!
Failed to inject frame into filter network: Invalid argument
Error while processing the decoded data for stream #1:0

Edit2
Running the command mentioned in the comments of the answer, this is the result.
After FFmpeg:
Without adding -noautorotate

After adding -noautorotate

EDIT 3
Here is the log without using -noautorotate
I used this command:
String[] s = {"-ss", valueLeft, "-i", mStringFilePath, "-i", drawingPath, "-filter_complex", "[0:v]scale=iw*sar:ih,setsar=1,pad='max(iw\\,2*trunc(ih*16/9/2))':'max(ih\\,2*trunc(ow*9/16/2))':(ow-iw)/2:(oh-ih)/2[v0];[1:v][v0]scale2ref[v1][v0];[v0][v1]overlay=x=(W-w)/2:y=(H-h)/2,scale=-2:min(1080\\,ih)[v]", "-map", "[v]", "-map", "0:a", "-c:v", "libx264", "-preset", "ultrafast", "-r", outFPS, path};

Here is the log with using -noautorotate
I used this command:
String[] s = {"-ss", valueLeft,"-noautorotate", "-i", mStringFilePath, "-i", drawingPath, "-filter_complex", "[0:v]scale=iw*sar:ih,setsar=1,pad='max(iw\\,2*trunc(ih*16/9/2))':'max(ih\\,2*trunc(ow*9/16/2))':(ow-iw)/2:(oh-ih)/2[v0];[1:v][v0]scale2ref[v1][v0];[v0][v1]overlay=x=(W-w)/2:y=(H-h)/2,scale=-2:min(1080\\,ih)[v]", "-map", "[v]", "-map", "0:a", "-c:v", "libx264", "-preset", "ultrafast", "-r", outFPS, path};

Here is the links to the videos:

Link to original video
Link to video that doesn't use -noautorotate
Link to video after using -noautorotate

Like I said in the comment in the other Q,  change 16 and 9 to 13 and 6 in the pad filter exprs.

@Gyan Thank you for your reply, I appreciate it. Can you please have a look at my edit.

Use
"[0:v]scale=iw*sar:ih,setsar=1,pad='max(iw\,2*trunc(ih*16/9/2))':'max(ih\,2*trunc(ow*9/16/2))':(ow-iw)/2:(oh-ih)/2[v0];[1:v][v0]scale2ref[v1][v0];[v0][v1]overlay=x=(W-w)/2:y=(H-h)/2[v]"
First, the scale and setsar make sure the image becomes a square-pixel input. Then the pad checks each dimension and pads to a 16:9 frame size.

Comments are not for extended discussion; this conversation has been moved to chat.

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


text:
ffmpeg greenscreen transparent while using color palette
I have a video that has a color I'd like to remove, and make into a transparent gif with ffmpeg. I first created a color palette using
ffmpeg -i video.mp4 -filter_complex "[0:v] palettegen" palette.png=
that went fine. Then when I go to try and make a gif I do this:
ffmpeg -i Untitled.mp4 -i palette.png -filter_complex "[0:v][1:v] paletteuse;[0:v]chromakey=0xE700F4" out.gif
This however gives an error and does not create anything. Am I doing something wrong here?
here's the log:
  built with gcc 9.1.1 (GCC) 20190621
  configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libdav1d --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmpt
  libavutil      56. 30.100 / 56. 30.100
  libavcodec     58. 53.101 / 58. 53.101
  libavformat    58. 28.101 / 58. 28.101
  libavdevice    58.  7.100 / 58.  7.100
  libavfilter     7. 56.101 /  7. 56.101
  libswscale      5.  4.101 /  5.  4.101
  libswresample   3.  4.100 /  3.  4.100
  libpostproc    55.  4.100 / 55.  4.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'Untitled.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 19529854
    compatible_brands: mp42isom
    creation_time   : 2019-07-10T05:06:10.000000Z
  Duration: 00:00:07.04, start: 0.000000, bitrate: 12629 kb/s
    Stream #0:0(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 190 kb/s (default)
    Metadata:
      creation_time   : 2019-07-10T05:06:10.000000Z
      handler_name    : Sound Media Handler
    Stream #0:1(eng): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv), 1920x1080 [SAR 1:1 DAR 16:9], 12433 kb/s, 29.97 fps, 29.97 tbr, 30k tbn, 59.94 tbc (default)
    Metadata:
      creation_time   : 2019-07-10T05:06:10.000000Z
      handler_name    : Video Media Handler
      encoder         : AVC Coding
Input #1, png_pipe, from 'palette.png':
  Duration: N/A, bitrate: N/A
    Stream #1:0: Video: png, rgba(pc), 16x16 [SAR 1:1 DAR 1:1], 25 tbr, 25 tbn, 25 tbc
Stream mapping:
  Stream #0:1 (h264) -> paletteuse:default
  Stream #0:1 (h264) -> chromakey
  Stream #1:0 (png) -> paletteuse:palette
  paletteuse -> Stream #0:0 (gif)
  chromakey -> Stream #0:1 (gif)
Press [q] to stop, [?] for help
[swscaler @ 0000008b903fedc0] No accelerated colorspace conversion found from yuva420p to bgr8.
[gif @ 0000008b8ca40540] GIF muxer supports only a single video GIF stream.
Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument
Error initializing output stream 0:1 --
Conversion failed!

"gives an error" isn't descriptive and makes it hard to provide any help. You should always include the actual error. Even better is to provide the complete log from the command.

alright i updated it

Your command is attempting to place two streams into the GIF output (the output from paletteuse and the output from chromakey), but the GIF muxer supports only a single stream. To fix this your outputs from each filter should not be orphaned. See the filtering introduction for more info.
ffmpeg -i input.mp4 -filter_complex "[0:v]chromakey=0xE700F4,split[v0][v1];[v0]palettegen[p];[v1][p]paletteuse" output.gif

For better results use the chromakey filter before creating the palette.
With the split filter you can avoid making a temporary palette file.

That'll do it, thanks!


text:
FFMPEG - Nero and Quicktime Format Chapters
Ok, I'm usually really good at finding the answers to my FFMPEG questions myself but I'm a bit stumped.
I've got this file, an MP4, here is part of the MediaInfo:
Menu
00:00:00.000                             : CHAPTER01
00:00:23.133                             : CHAPTER02
00:01:31.633                             : CHAPTER03
00:02:05.100                             : CHAPTER04
00:08:04.567                             : CHAPTER05
00:16:03.133                             : CHAPTER06
00:21:45.266                             : CHAPTER07

So it has Nero formatted chapters embedded with mp4box. Then when I process this file further with ffmpeg it always comes out like this:
Menu #1
ID                                       : 3
Codec ID                                 : text
Duration                                 : 21 min 45 s
Language                                 : English
Bit rate mode                            : CBR
Menu For                                 : 2
00:59:57.994                             : CHAPTER01
01:00:21.127                             : CHAPTER02
01:01:29.627                             : CHAPTER03
01:02:03.094                             : CHAPTER04
01:08:02.561                             : CHAPTER05
01:16:01.127                             : CHAPTER06
01:21:43.260                             : CHAPTER07

Menu #2
00:00:00.000                             : CHAPTER01
00:00:23.133                             : CHAPTER02
00:01:31.633                             : CHAPTER03
00:02:05.100                             : CHAPTER04
00:08:04.567                             : CHAPTER05
00:16:03.133                             : CHAPTER06
00:21:45.266                             : CHAPTER07

Now there are 2 chapter streams, I found out that the top is Quicktime formatted and then my original Nero formatted chapters are on the bottom.
Basically I want to only have the original Nero formatted (Menu #2) chapters as anything else makes these chapters not work at all in an Oppo Blu-ray player.
I'm aware of the -movflags disable_chpl but that gets rid of the Nero chapter and keeps the Quicktime chapters, I want to do the opposite.
Anyone know of any sort of -map or -map_metadata or anything that I could do to only have Nero chapters on the output of ffmpeg? For time saving reasons I'd rather not have to embed the chapters with mp4box after ffmpeg, or worse, have to remove the chapters from my files, and then re-embed them after ffmpeg.
Chapter marks are embedded in a batch file with
mp4box.exe -add %input% -chap %chapters% "%output%\%inputfile%_chapters.mp4"
Then later on in the workflow encoded with ffmpeg:
"C:\Users\******\promo _chapters.mp4" -pix_fmt yuv420p -vf yadif -c:
    v libx264 -profile:v high -level 4.0 -preset fast -r 30000/1001 -vsync 1 -bf 1 -
    crf 18 -maxrate 12M -bufsize 12M -movflags +faststart -c:a aac -b:a 192k -ar 48K
     -f mp4 Z:\output\promo.mp4
Here is the ffmpeg log:
ffmpeg -y -i "C:\Users\******\promo _chapters.mp4" -pix_fmt yuv420p -vf yadif -c:
v libx264 -profile:v high -level 4.0 -preset fast -r 30000/1001 -vsync 1 -bf 1 -
crf 18 -maxrate 12M -bufsize 12M -movflags +faststart -c:a aac -b:a 192k -ar 48K
 -f mp4 Z:\output\promo.mp4
ffmpeg version 4.1.3 Copyright (c) 2000-2019 the FFmpeg developers
  built with gcc 8.3.1 (GCC) 20190414
  configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfi
g --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-lib
freetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amr
wb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --
enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-l
ibwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --
enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --en
able-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --en
able-libxvid --enable-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --e
nable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enab
le-avisynth
  libavutil      56. 22.100 / 56. 22.100
  libavcodec     58. 35.100 / 58. 35.100
  libavformat    58. 20.100 / 58. 20.100
  libavdevice    58.  5.100 / 58.  5.100
  libavfilter     7. 40.101 /  7. 40.101
  libswscale      5.  3.100 /  5.  3.100
  libswresample   3.  3.100 /  3.  3.100
  libpostproc    55.  3.100 / 55.  3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'C:\Users\******\promo _chapters.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 1
    compatible_brands: isom
    creation_time   : 2019-07-14T20:51:43.000000Z
  Duration: 00:00:32.03, start: 0.000000, bitrate: 145729 kb/s
    Chapter #0:0: start 0.000000, end 5.166000
    Metadata:
      title           : CHAPTER01
    Chapter #0:1: start 5.166000, end 10.233000
    Metadata:
      title           : CHAPTER02
    Chapter #0:2: start 10.233000, end 14.867000
    Metadata:
      title           : CHAPTER03
    Chapter #0:3: start 14.867000, end 21.367000
    Metadata:
      title           : CHAPTER04
    Chapter #0:4: start 21.367000, end 24.400000
    Metadata:
      title           : CHAPTER05
    Chapter #0:5: start 24.400000, end 29.333000
    Metadata:
      title           : CHAPTER06
    Chapter #0:6: start 29.333000, end 32.032032
    Metadata:
      title           : CHAPTER07
    Stream #0:0(und): Video: dnxhd (DNXHD) (AVdn / 0x6E645641), yuv422p(tv, bt70
9/unknown/unknown), 1920x1080, 145344 kb/s, SAR 1:1 DAR 16:9, 29.97 fps, 29.97 t
br, 29970 tbn, 29970 tbc (default)
    Metadata:
      creation_time   : 2019-04-26T19:59:22.000000Z
      handler_name    : ?Apple Video Media Handler
      encoder         : Avid DNxHD Codec
      timecode        : 00:59:58;00
    Stream #0:1(und): Audio: pcm_s24le (in24 / 0x34326E69), 48000 Hz, stereo, s3
2 (24 bit), 2304 kb/s (default)
    Metadata:
      creation_time   : 2019-04-26T19:59:22.000000Z
      handler_name    : ?Apple Sound Media Handler
    Stream #0:2(und): Data: none (tmcd / 0x64636D74) (default)
    Metadata:
      creation_time   : 2019-04-26T19:59:34.000000Z
      handler_name    : ?Time Code Media Handler
      timecode        : 00:59:58;00
Stream mapping:
  Stream #0:0 -> #0:0 (dnxhd (native) -> h264 (libx264))
  Stream #0:1 -> #0:1 (pcm_s24le (native) -> aac (native))
Press [q] to stop, [?] for help
[libx264 @ 00000000006c0140] using SAR=1/1
[libx264 @ 00000000006c0140] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2
AVX FMA3 BMI2 AVX2
[libx264 @ 00000000006c0140] profile Progressive High, level 4.0, 4:2:0, 8-bit
[libx264 @ 00000000006c0140] 264 - core 157 r2970 5493be8 - H.264/MPEG-4 AVC cod
ec - Copyleft 2003-2019 - http://www.videolan.org/x264.html - options: cabac=1 r
ef=2 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=6 psy=1 psy_rd=1.00:0.00 mixed
_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pski
p=1 chroma_qp_offset=-2 threads=34 lookahead_threads=5 sliced_threads=0 nr=0 dec
imate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=1 b_pyramid=0 b
_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=1 keyint=250 keyint_min=
25 scenecut=40 intra_refresh=0 rc_lookahead=30 rc=crf mbtree=1 crf=18.0 qcomp=0.
60 qpmin=0 qpmax=69 qpstep=4 vbv_maxrate=12000 vbv_bufsize=12000 crf_max=0.0 nal
_hrd=none filler=0 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to 'Z:\output\promo.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 1
    compatible_brands: isom
    encoder         : Lavf58.20.100
    Chapter #0:0: start 0.000000, end 5.166000
    Metadata:
      title           : CHAPTER01
    Chapter #0:1: start 5.166000, end 10.233000
    Metadata:
      title           : CHAPTER02
    Chapter #0:2: start 10.233000, end 14.867000
    Metadata:
      title           : CHAPTER03
    Chapter #0:3: start 14.867000, end 21.367000
    Metadata:
      title           : CHAPTER04
    Chapter #0:4: start 21.367000, end 24.400000
    Metadata:
      title           : CHAPTER05
    Chapter #0:5: start 24.400000, end 29.333000
    Metadata:
      title           : CHAPTER06
    Chapter #0:6: start 29.333000, end 32.032032
    Metadata:
      title           : CHAPTER07
    Stream #0:0(und): Video: h264 (libx264) (avc1 / 0x31637661), yuv420p, 1920x1
080 [SAR 1:1 DAR 16:9], q=-1--1, 0.03 fps, 30k tbn, 29.97 tbc (default)
    Metadata:
      creation_time   : 2019-04-26T19:59:22.000000Z
      handler_name    : ?Apple Video Media Handler
      timecode        : 00:59:58;00
      encoder         : Lavc58.35.100 libx264
    Side data:
      cpb: bitrate max/min/avg: 12000000/0/0 buffer size: 12000000 vbv_delay: -1

    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, flt
p (24 bit), 192 kb/s (default)
    Metadata:
      creation_time   : 2019-04-26T19:59:22.000000Z
      handler_name    : ?Apple Sound Media Handler
      encoder         : Lavc58.35.100 aac
frame=   14 fps=0.0 q=0.0 size=       0kB time=00:00:00.93 bitrate=   1.8kbits/s
frame=   43 fps= 43 q=0.0 size=       0kB time=00:00:02.00 bitrate=   0.8kbits/s
frame=   74 fps= 49 q=24.0 size=       0kB time=00:00:03.28 bitrate=   0.5kbits/
frame=  124 fps= 62 q=24.0 size=       0kB time=00:00:04.69 bitrate=   0.4kbits/
frame=  166 fps= 66 q=24.0 size=    1536kB time=00:00:06.08 bitrate=2069.8kbits/
frame=  204 fps= 67 q=24.0 size=    3840kB time=00:00:07.48 bitrate=4201.3kbits/
frame=  242 fps= 69 q=26.0 size=    5632kB time=00:00:08.89 bitrate=5186.5kbits/
frame=  284 fps= 70 q=25.0 size=    7424kB time=00:00:10.28 bitrate=5914.7kbits/
frame=  325 fps= 72 q=24.0 size=    9472kB time=00:00:11.69 bitrate=6637.5kbits/
frame=  367 fps= 73 q=26.0 size=   11264kB time=00:00:13.09 bitrate=7044.7kbits/
frame=  407 fps= 73 q=28.0 size=   13056kB time=00:00:14.14 bitrate=7562.0kbits/
frame=  448 fps= 74 q=29.0 size=   15360kB time=00:00:15.44 bitrate=8146.9kbits/
frame=  491 fps= 75 q=26.0 size=   17664kB time=00:00:16.91 bitrate=8553.7kbits/
frame=  532 fps= 75 q=24.0 size=   19712kB time=00:00:18.30 bitrate=8822.2kbits/
frame=  574 fps= 76 q=24.0 size=   21504kB time=00:00:19.62 bitrate=8975.7kbits/
frame=  615 fps= 76 q=24.0 size=   23040kB time=00:00:21.03 bitrate=8973.1kbits/
frame=  656 fps= 76 q=27.0 size=   25088kB time=00:00:22.44 bitrate=9157.7kbits/
frame=  695 fps= 76 q=24.0 size=   27136kB time=00:00:23.82 bitrate=9328.8kbits/
frame=  736 fps= 77 q=25.0 size=   29184kB time=00:00:25.23 bitrate=9473.1kbits/
frame=  776 fps= 77 q=24.0 size=   30976kB time=00:00:26.64 bitrate=9523.5kbits/
frame=  813 fps= 77 q=24.0 size=   33024kB time=00:00:27.86 bitrate=9710.0kbits/
frame=  854 fps= 77 q=24.0 size=   34816kB time=00:00:28.97 bitrate=9844.9kbits/
frame=  896 fps= 77 q=24.0 size=   36352kB time=00:00:30.40 bitrate=9796.0kbits/
frame=  936 fps= 77 q=24.0 size=   37632kB time=00:00:31.78 bitrate=9698.5kbits/
[mp4 @ 000000000282e7c0] Starting second pass: moving the moov atom to the begin
ning of the file
frame=  960 fps= 62 q=-1.0 Lsize=   39818kB time=00:00:32.04 bitrate=10179.8kbit
s/s speed=2.07x
video:39018kB audio:763kB subtitle:0kB other streams:0kB global headers:0kB muxi
ng overhead: 0.093123%
[libx264 @ 00000000006c0140] frame I:11    Avg QP:16.42  size:119041
[libx264 @ 00000000006c0140] frame P:486   Avg QP:20.49  size: 62131
[libx264 @ 00000000006c0140] frame B:463   Avg QP:22.45  size: 18246
[libx264 @ 00000000006c0140] consecutive B-frames:  3.5% 96.5%
[libx264 @ 00000000006c0140] mb I  I16..4: 26.0% 64.5%  9.5%
[libx264 @ 00000000006c0140] mb P  I16..4:  4.2% 16.2%  1.6%  P16..4: 37.2% 16.7
%  8.1%  0.0%  0.0%    skip:16.0%
[libx264 @ 00000000006c0140] mb B  I16..4:  2.7%  7.4%  0.3%  B16..8: 17.8%  5.6
%  0.4%  direct:20.5%  skip:45.4%  L0:40.2% L1:47.0% BI:12.8%
[libx264 @ 00000000006c0140] 8x8 transform intra:72.3% inter:69.6%
[libx264 @ 00000000006c0140] coded y,uvDC,uvAC intra: 54.4% 80.0% 47.2% inter: 2
4.8% 38.9% 7.1%
[libx264 @ 00000000006c0140] i16 v,h,dc,p: 34% 26% 12% 28%
[libx264 @ 00000000006c0140] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 24% 19% 25%  4%  5%
 6%  5%  6%  5%
[libx264 @ 00000000006c0140] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 24% 22% 10%  5%  9%
 8%  9%  6%  7%
[libx264 @ 00000000006c0140] i8c dc,h,v,p: 51% 21% 20%  8%
[libx264 @ 00000000006c0140] Weighted P-Frames: Y:6.8% UV:2.5%
[libx264 @ 00000000006c0140] ref P L0: 79.5% 20.5%
[libx264 @ 00000000006c0140] kb/s:9978.35
[aac @ 00000000006c69c0] Qavg: 3776.600

Share full command and log.

@Gyan Sorry I didn't include that before, the question is updated now.


text:
FFMPEG - 5.1 EAC3 encode output quality
I have PCM Wave source files that are 5.1 surround. My goal is to convert this to EAC3 at 192k per Apple recommendations.
Here is the MediaInfo of my source media:
General
Complete name                            : X:\******WAVE\5.1_PCM.wav
Format                                   : Wave
File size                                : 2.38 GiB
Duration                                 : 49 min 3 s
Overall bit rate mode                    : Constant
Overall bit rate                         : 6 949 kb/s
Producer                                 : Pro Tools
Encoded date                             : 2019-03-00 17:03:25
Producer_Reference                       : 15uZdJ9Ng2naaaGk

Audio
Format                                   : PCM
Format settings                          : Little / Signed
Codec ID                                 : 00000001-0000-0010-8000-00AA00389B71
Duration                                 : 49 min 3 s
Bit rate mode                            : Constant
Bit rate                                 : 6 912 kb/s
Channel(s)                               : 6 channels
Channel layout                           : L R C LFE Lb Rb
Sampling rate                            : 48.0 kHz
Bit depth                                : 24 bits
Stream size                              : 2.37 GiB (99%)

I'm encoding this with ffmpeg by using very simply:
ffmpeg -i IN.wav -c:a eac3 -b:a 192k -ar 48k OUT.mp4

Here is the MediaInfo of the output:
General
Complete name                            : X:\******\6ch_eac3.mp4
Format                                   : MPEG-4
Format profile                           : Base Media
Codec ID                                 : isom (isom/iso2/mp41)
File size                                : 67.4 MiB
Duration                                 : 49 min 3 s
Overall bit rate mode                    : Constant
Overall bit rate                         : 192 kb/s
Recorded date                            : 2019-03-0
Writing application                      : Lavf58.20.100

Audio
ID                                       : 1
Format                                   : E-AC-3
Format/Info                              : Enhanced AC-3
Commercial name                          : Dolby Digital Plus
Codec ID                                 : ec-3
Duration                                 : 49 min 3 s
Bit rate mode                            : Constant
Bit rate                                 : 192 kb/s
Channel(s)                               : 6 channels
Channel layout                           : L R C LFE Ls Rs
Sampling rate                            : 48.0 kHz
Frame rate                               : 31.250 FPS (1536 SPF)
Bit depth                                : 16 bits
Compression mode                         : Lossy
Stream size                              : 67.4 MiB (100%)
Service kind                             : Complete Main
Default                                  : Yes
Alternate group                          : 1

The thing is the output quality is really bad. It sounds extremely compressed, judging by my ear it sounds like about 32kbps.
My theory is that the output is for some reason 192k divided by 6 channels, each channel being 32kbps and the whole audio track is 192k overall. To my knowledge, that's not how its supposed to work and it should sound like the equivalent of 192k for each channel in one bitstream.
I also encoded the same source file using Telestream Vantage, here is the MediaInfo which is extremely similar to the ffmpeg output above:
General
Complete name                            : X:\******\WAVE\Internet_192k_6ch_telestream.mp4
Format                                   : MPEG-4
Format profile                           : Base Media / Version 2
Codec ID                                 : mp42 (mp42/isom)
File size                                : 69.0 MiB
Duration                                 : 49 min 3 s
Overall bit rate mode                    : Constant
Overall bit rate                         : 197 kb/s
Encoded date                             : UTC 2019-08-01 15:30:58
Tagged date                              : UTC 2019-08-01 15:30:58

Audio
ID                                       : 1
Format                                   : E-AC-3
Format/Info                              : Enhanced AC-3
Commercial name                          : Dolby Digital Plus
Codec ID                                 : ec-3
Duration                                 : 49 min 3 s
Source duration                          : 49 min 3 s
Bit rate mode                            : Constant
Bit rate                                 : 192 kb/s
Channel(s)                               : 6 channels
Channel layout                           : L R C LFE Ls Rs
Sampling rate                            : 48.0 kHz
Frame rate                               : 31.250 FPS (1536 SPF)
Bit depth                                : 16 bits
Compression mode                         : Lossy
Stream size                              : 67.4 MiB (98%)
Source stream size                       : 67.4 MiB (98%)
Service kind                             : Complete Main
Encoded date                             : UTC 2019-08-01 15:30:58
Tagged date                              : UTC 2019-08-01 15:30:58

This file sounds fantastic, like true 192k with about the same filesize as the ffmpeg encode.
So clearly I am doing something wrong with mapping or bitstream or something.
Here is the full ffmpeg log:
N:\_TOOLS\ffmpeg\ffmpeg-4.1.3-win64-static\bin>ffmpeg -i X:\02_BROADCAST\5.1_PCM
.wav -c:a eac3 -b:a 192k -ar 48k X:\02_BROADCAST\6ch_eac3.mp4
ffmpeg version 4.1.3 Copyright (c) 2000-2019 the FFmpeg developers
  built with gcc 8.3.1 (GCC) 20190414
  configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfi
g --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-lib
freetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amr
wb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --
enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-l
ibwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --
enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --en
able-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --en
able-libxvid --enable-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --e
nable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enab
le-avisynth
  libavutil      56. 22.100 / 56. 22.100
  libavcodec     58. 35.100 / 58. 35.100
  libavformat    58. 20.100 / 58. 20.100
  libavdevice    58.  5.100 / 58.  5.100
  libavfilter     7. 40.101 /  7. 40.101
  libswscale      5.  3.100 /  5.  3.100
  libswresample   3.  3.100 /  3.  3.100
  libpostproc    55.  3.100 / 55.  3.100
Input #0, wav, from 'X:\02_BROADCAST\5.1_PCM.wav':
  Metadata:
    encoded_by      : Pro Tools
    originator_reference: 15uZdJ9Ng2naaaGk
    date            : 2019-03-0
    creation_time   : 17:03:25
    time_reference  : 172828656
  Duration: 00:49:03.23, bitrate: 6948 kb/s
    Stream #0:0: Audio: pcm_s24le ([1][0][0][0] / 0x0001), 48000 Hz, 5.1, s32 (2
4 bit), 6912 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (pcm_s24le (native) -> eac3 (native))
Press [q] to stop, [?] for help
Output #0, mp4, to 'X:\02_BROADCAST\6ch_eac3.mp4':
  Metadata:
    encoded_by      : Pro Tools
    originator_reference: 15uZdJ9Ng2naaaGk
    date            : 2019-03-0
    time_reference  : 172828656
    encoder         : Lavf58.20.100
    Stream #0:0: Audio: eac3 (ec-3 / 0x332D6365), 48000 Hz, 5.1, fltp (24 bit),
192 kb/s
    Metadata:
      encoder         : Lavc58.35.100 eac3
size=   68983kB time=00:49:03.22 bitrate= 192.0kbits/s speed=73.3x
video:0kB audio:68982kB subtitle:0kB other streams:0kB global headers:0kB muxing
 overhead: 0.001441%

N:\_TOOLS\ffmpeg\ffmpeg-4.1.3-win64-static\bin>

Anyone know what I am running into?
As a note this is concerned with video production because this EAC3 is going into a DASH wrapper with video immediately after this encode.
Edit: Something I just realized on this and tested is that the audio quality that I hear when using ffmpeg to encode to ac3 and then to encode to eac3 is the same. But as eac3 is almost twice as efficient as ac3, I would expect the eac3 encode to be much higher quality and sound less compressed. Case in point is that the Telestream Vantage encode is much higher quality than an ac3 at the same bitrate. Is this a fault of of the ffmpeg encoder that is used for eac3?

Rather old question, but responding FBO whomever stumbles upon this in the future (besides me; lol)....
Your issue was the fact you set total average bit rate to 192kbps, not per channel. Presuming ffmpeg's default AC-3 encoder, if you simply set the sample rate to 48kbps (which you did in your example above), you'd be encoding at 1,536kbps for all channels. That is because the only bit depth that codec supports is 32 bits per sample.
32 bit depth x 48,000 sampling frequency = 1,536,000 bits per second
If you had simply omitted this portion of your command line you should have gotten that bit rate:
-b:a 192k

That is because what you did there was limit the average bit rate to 192kbps, which is why you ended up with poor quality sound in your target file. At 6 channels (5+1), you're looking at 32 kbps per channel (192 / 6 = 32).
To attain your goal of 192 kbps per channel, you should have limited the output to 6 x 192 or 1,152 kbps, like this:
-b:a 1152k

Cheers. :-)


text:
Need a script to import Rotoscoping mask
I am looking to perform rotoscoping on one of my videos.
I have found Clearvid.io online service that performs rotoscoping. They provide the points of the resultant masks of rotoscoping in a text file that can be imported into after effects.
Ask:
I need some help in writing a script that imports these points into Adobe after effects.
Any help is greatly appreciated.
Please find the input video file and the file containing the masks here.
Thank you.

from the text file:
The format of the file is as follows:

Frame number
format - 'frame: ..'
Number of points for the mask in this frame
format - 'points: ..'
Set of points specified as a series of concatenated x, y co-ordinates
format - 'x1, y1, x2, y2, ...'

This question is a little broad. Can you specify what problem you're having?

Can I just say that the results look pretty bad. You would get better results using AE's built in roto-brush. Also the mask points are just points, they don't have Bézier handles, so they're just straight lines. I would question whether it was worth the time and effort involved writing a script for this. But I don't know your use case.

@stib Yeah, I agree with you. Result for this one is not that good.
I'm not an expert at this and am looking for a service that could perform basic rotoscoping which can later be fine-tuned in AE with minimal effort and time.
I got the result for another couple of videos and they are pretty good - can be found here. It would be great if you could help me with the script to import it as rotobrush result. I believe such a code will be useful for anyone like me.

Sure, can you be specific about what problems you're having?

Could you help me get/make a script so that I can import the binary mask co-ordinates into AfterEffects as a roto brush result so that I can modify it further? Thanks for the help.


text:
moov atom not found
I downloaded this video using youtube-dl's HLS downloader. The video was being HLS streamed using AES-128. Even though I could view it perfectly fine when it was being streamed in the browser, VLC doesn't play the downloaded video file. It doesn't seem to contain any metadata or codec information either. It's actually a 2hr 49min 10sec long video.
I thought re-encoding it with ffmpeg might solve the issue. But ffmpeg throws these exceptions irrespective of the operation I try to perform:
[mov,mp4,m4a,3gp,3g2,mj2 @ 000002a477298a80] Format mov,mp4,m4a,3gp,3g2,mj2 detected only with low score of 1, misdetection possible!
[mov,mp4,m4a,3gp,3g2,mj2 @ 000002a477298a80] moov atom not found
4.mp4: Invalid data found when processing input

Google search led me to tools such qtfaststart and mp4box. But none of them seemed to solve the issue.

Running qtfaststart 4.mp4 41.mp4 throws the moov atom not found, is this a valid MOV/MP4 file? exception
Running MP4Box -add 4.mp4 41.mp4, MP4Box -inter 0 4.mp4 or MP4Box -add 4.h265 41.mp4 show exceptions such as:

Incomplete MDAT while file is not read-only
Invalid IsoMedia File
[MPEG-2 TS] TS Packet 1 is scrambled - not supported
[MPEG-2 TS] TS Packet 2 has error (PID could be 1792)
[MPEG-2 TS] TS Packet 3 does not start with sync marker
Error importing 4.mp4: Corrupted Data in file/stream
Cannot find HEVC start code
Error importing 4.h265: BitStream Not Compliant

A detailed log of my tryst with MP4box can be found here.
The logs of my tryst with ffmpeg can be found here.
Handbrake also refuses to process the file on account of moov atom not found.
How can I make this video download work?

The file is encrypted, so you'll need the decryption key. DId yt-dl download using ffmpeg or its native hls downloader?

The M3U8 manifest which I used to download this file is here: https://pastebin.com/Tqu9wbFJ

@Gyan it was the native HLS downloader with 2 extra lines of code to facilitate download of this video. Without these two extra lines of code, the video wasn't being downloaded. These two extra lines of code are as per this image: https://ibb.co/dbQmTN0

Use the ffmpeg downloader in yt-dl.

@Gyan I've tried using FFMPEG downloader for this website from where I'm downloading the video. However, it has never been able to download the videos completely. In most instances, it stops writing/appending the downloaded TS fregments to the output file. At other times, it simply refuses to download the TS fragments, throwing encryption-related errors. At most, it writes about 12 to 25 MB data of the over 600 or 700 MB data.

@Gyan I must apologize. The M3U8 manifest mentioned earlier wasn't the correct one. I don't have the correct one now.

@Gyan I think you'd be able to get more clarity by going through this issue: https://github.com/ytdl-org/youtube-dl/issues/21806

@Gyan another issue with using the FFMPEG downloader in yt-dl or otherwise was this with this video stream, it was never able to resume the download from the last fragment. It mostly never was able to resume the download, in fact.


text:
How to generate decryption key from m3u8 manifest? (OR) How to decrypt an excrypted MP4 using URI and IV?
I am downloading an HLS video which is AES-128 encrypted. The issue is that the downloaded video is also encrypted and hence, not viewable.
The website is serving 2 M3U8 manifests:

The first manifest (playlist.m3u8) refers to a chunklist_alphanumeric.m3u8. A sample is here.
The second manifest (chunklist_alphanumeric.m3u8) seems like this.

In this context, I have the following two questions

How can I generate the decryption key?
How can I decrypt the video using the decryption key?

I'm using Windows-10 (64-bit).

You cant generate the key. You have to download the key. The URL is in the manifest. In this case it looks like you need to substitute some values first.
To decrypt, since this files uses AES-128 and not SAMPLE-AES, you can just decrypt each file using OpenSSL


text:
How to use hardware acceleration with FFMPEG for trimming and concatenation purposes
I am running FFMPEG on a Windows 10 (64-bit) laptop with Intel i3 (6th generation) processor and AMD R5 M430 GPU.
I shot many videos on a recent trip. Cumulatively, they are over 100 hours long. Each video occupies 2-3 GB minimum and is at least 1 hour long.
I need to trim 2-4 videos and then concatenate them into one single file. This operation needs to be performed for all these videos.
Right now, I am trimming individual videos using the following command:
ffmpeg.exe -i "INPUT_VIDEO" -ss START_TIME -to END_TIME -c copy "OUTPUT_VIDEO"
And then I concatenate the videos using this command:
ffmpeg.exe -f concat -safe 0 -i VideosToBeConcatenated.txt -c copy "CONCATENATED_OUTPUT_VIDEO"
where VideosToBeConcatenated.txt contains the file names of the videos to be concatenated.
Running these commands in a single Command Window gives me a speed of 20-25x. Running them in two Command Windows simultaneously drops the speed to 10-12x, while also making my system lag/freeze.
Is there a way I could use my GPU to speed up these operation? Say, using the i3's Quicksync or R5's AMF/VCE?
I tried using -hwaccel dxva2 in the above mentioned commands as follows:
ffmpeg.exe -hwaccel dxva2 -i "INPUT_VIDEO" -ss START_TIME -to END_TIME -c copy "OUTPUT_VIDEO"
and
ffmpeg.exe -hwaccel dxva2 -f concat -safe 0 -i VideosToBeConcatenated.txt -c copy "CONCATENATED_OUTPUT_VIDEO"
However, I don't notice any increase in speed.
I also set ffmpeg.exe and cmd.exe to "High Performance" in the AMD Switchable   Graphics settings. But the in-built Switchable Graphics Monitor suggests that neither of the processes are using the dGPU.
Is there a way I could use my GPUs (i3's Quicksync or R5's AMF/VCE) to speed up these operation without compromising the quality of the output videos?
[Edit:] I am trying to make sense of FFMPEG's Quicksync documentation but it's too mature for an amateur like me.

Since you are using -c copy in your commands, there is no decoding, filtering or encoding taking place and so hardware acceleration isn't relevant at all. The main bottleneck is disk I/O. On a regular internal HDD (with a 3rd gen CPU) I get speeds of 400x so I suspect you're reading or writing to an external drive. Or your internal drive could be slow, have a smaller cache. The biggest boost will come from writing to a different drive than the drive on which the inputs reside, with ideally both drives being internal.


text:
Can ffmpeg input mp4 and convert it to m4b or m4a?
Can mp4 audio/video be converted to m4b using ffmpeg command line tool.(in vb.net)
I've spent the last few days trying various query combinations to find an answer but to no avail.
What I have found is that m4a/m4b is the same container as mp4, the difference being m4a/m4b contains no video signal.
When I tried to convert mp4 directly to m4b, I ended up with an output m4b much larger than the original mp4 and the m4b still contained video.
I am using a code example from CodeProject. I am able to convert from mp4 to mp3 and from mp3 to m4b but mp4 to m4b still contains the video portion of the file.
So, can ffmpeg input mp4 and convert it to m4b or m4a directly or is it a 2 step process, mp4 to mp3 then mp3 to m4b? If it is a 1 step process, could you point me in the direction of the documentation so I can learn how to do it.
Thanks

This might be a bit late but if it helps I've got a working PowerShell script that I use to create chapterized m4b files which I am assuming you are trying to do since you list m4b.
I use the following command for mp3 format files
ffmpeg -f concat -safe 0 -i list.txt -vn -y -b:a 64k -acodec aac -ac 2 temp.m4a

If its already in AAC format (MP4) it's even simpler
ffmpeg -f concat -safe 0 -i list.txt -c copy temp.m4a

list.txt is a simple list of all the files to combine into a single m4a, 1 file per line. I found this to work much better than trying to do it using INPUT and listing all the files on the command line. That method always seemed to break for me.
Once this is done you can inject the chapters and rename to m4b all in a single command line.
ffmpeg -i "ffmetadata.txt" -i "temp.m4a" -map_metadata 1 -codec copy "$artist - $albumSanitized.m4b"

What does the ffmetadata.txt file look like? I'm trying to find out what to put in that file but my searches are coming up short.

Of course, I found it within minutes of asking this (o_º) Searching for "map_metadata" was the key. There's an example here, found via this SO answer. Wouldn't have found it without your answer, thanks!

To do this with just ffmpeg, try using -vn to not include video on output:
ffmpeg -i INPUT -c:a aac -c:b 128k -vn -f mp4 OUTPUT.m4b

This outputs just the audio of the mp4 in an m4b file.
Here's stream selection in the ffmpeg documentation.
Stream Selection

Since I'm using this in code I had to make some modifications just to be able to use it.

Since I'm using this in code I had to make some modifications just to be able to use it. It did not work until I removed the -f and -c:a aac commands. The working line for me so far is:  ffmpeg -i input -ar 22050 -b:a 56k -vn Output . This outputs a very small file of the type I specified in Output. I have yet to figure out why this iteration works and yours won't. Does it have to do with expecting multiple files/streams? I will continue to study the ffmpeg help document. Thank you very much for your help. You gave me the jumping off point I needed to start figuring this out.

@Don6558 Interesting, I'm certainliy not familiar with using ffmpeg in vb.net but -c:a aac is specifying the audio codec as aac which you may not need and -f mp4 is forcing the output format to the mp4/m4a/m4v family of formats.
Glad I could help and at least point you in the right direction.


text:
Why does Nvenc Encoder improve decoding speed?
I am trying to improve the speed of decoding H.264 frame to RGBA frame using FFmpeg in C++. I have found a CLI command that can do that but I still do not fully understand the command to reproduce it in C++, so I hope you guys can give me an explanation of how the CLI command works.
The command that I found uses h264_nvenc encoder to improve the speed using GPU. If I understand correctly, FFmpeg will first decode the H.264 frame, and then encode it to mp4 frame. However, I cannot understand why a H.264 encoder would improve the speed of decoding H.264 video (or maybe encoding to mp4 frame). Can anyone please give me a detailed explanation?
Here is the CLI command that I found:
ffmpeg -hwaccel cuvid -r 120 -i <input_file> -c:v h264_nvenc -preset fast \
   -b:v 8M -vf scale=960:1080 -pix_fmt yuv420p <output_file> -y

Edited:
Log of command with option "-c:v h264_nvenc"
C:\Users\Shared\test\test>ffmpeg.exe -hwaccel cuvid -r 120 -i C:\\Users\\Shared\\test\\test\\raw0.h264 -c:v h264_nvenc -preset medium -b:v 8M -vf scale=960:1080 -pix_fmt yuv420p C:\\Users\\Shared\\test\\test\\video0.mp4 -y
ffmpeg version 3.4.1 Copyright (c) 2000-2017 the FFmpeg developers
  built with gcc 7.2.0 (GCC)
  configuration: --disable-static --enable-shared --enable-gpl --enable-version3 --enable-sdl2 --enable-bzlib --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libbluray
--enable-libfreetype --enable-libmp3lame --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-cuda --enable-cuvid --enable-d3d11va --enable-nvenc
--enable-dxva2 --enable-avisynth --enable-libmfx
  libavutil      55. 78.100 / 55. 78.100
  libavcodec     57.107.100 / 57.107.100
  libavformat    57. 83.100 / 57. 83.100
  libavdevice    57. 10.100 / 57. 10.100
  libavfilter     6.107.100 /  6.107.100
  libswscale      4.  8.100 /  4.  8.100
  libswresample   2.  9.100 /  2.  9.100
  libpostproc    54.  7.100 / 54.  7.100
[h264 @ 0000027ecb2a6700] Stream #0: not enough frames to estimate rate; consider increasing probesize
Input #0, h264, from 'C:\\Users\\Shared\\test\\test\\raw0.h264':
  Duration: N/A, bitrate: N/A
    Stream #0:0: Video: h264 (CAVLC 4:4:4), yuv444p(progressive), 960x1080, 25 fps, 25 tbr, 1200k tbn, 50 tbc
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> h264 (h264_nvenc))
Press [q] to stop, [?] for help
Output #0, mp4, to 'C:\\Users\\Shared\\test\\test\\video0.mp4':
  Metadata:
    encoder         : Lavf57.83.100
    Stream #0:0: Video: h264 (h264_nvenc) (Main) (avc1 / 0x31637661), yuv420p, 960x1080, q=-1--1, 8000 kb/s, 120 fps, 15360 tbn, 120 tbc
    Metadata:
      encoder         : Lavc57.107.100 h264_nvenc
    Side data:
      cpb: bitrate max/min/avg: 0/0/8000000 buffer size: 16000000 vbv_delay: -1
frame=  269 fps=261 q=25.0 Lsize=    2551kB time=00:00:02.23 bitrate=9356.5kbits/s speed=2.17x
video:2549kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.074325%

Log of command without option "-c:v h264_nvenc"
C:\Users\Shared\test\test>ffmpeg.exe -hwaccel cuvid -r 120 -i C:\\Users\\Shared\\test\\test\\raw0.h264 -preset medium -b:v 8M -vf scale=960:1080 -pix_fmt yuv420p C:\\Users\\Shared\\test\\test\\video0.mp4 -y
ffmpeg version 3.4.1 Copyright (c) 2000-2017 the FFmpeg developers
  built with gcc 7.2.0 (GCC)
  configuration: --disable-static --enable-shared --enable-gpl --enable-version3 --enable-sdl2 --enable-bzlib --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libfreetype --enable-libmp3lame --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-cuda --enable-cuvid --enable-d3d11va --enable-nvenc --enable-dxva2 --enable-avisynth --enable-libmfx
  libavutil      55. 78.100 / 55. 78.100
  libavcodec     57.107.100 / 57.107.100
  libavformat    57. 83.100 / 57. 83.100
  libavdevice    57. 10.100 / 57. 10.100
  libavfilter     6.107.100 /  6.107.100
  libswscale      4.  8.100 /  4.  8.100
  libswresample   2.  9.100 /  2.  9.100
  libpostproc    54.  7.100 / 54.  7.100
[h264 @ 0000021e33556640] Stream #0: not enough frames to estimate rate; consider increasing probesize
Input #0, h264, from 'C:\\Users\\Shared\\test\\test\\raw0.h264':
  Duration: N/A, bitrate: N/A
    Stream #0:0: Video: h264 (CAVLC 4:4:4), yuv444p(progressive), 960x1080, 25 fps, 25 tbr, 1200k tbn, 50 tbc
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
Press [q] to stop, [?] for help
[libx264 @ 0000021e335589a0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
[libx264 @ 0000021e335589a0] profile High, level 4.2
[libx264 @ 0000021e335589a0] 264 - core 152 r2851 ba24899 - H.264/MPEG-4 AVC codec - Copyleft 2003-2017 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=6 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=abr mbtree=1 bitrate=8000 ratetol=1.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to 'C:\\Users\\Shared\\test\\test\\video0.mp4':
  Metadata:
    encoder         : Lavf57.83.100
    Stream #0:0: Video: h264 (libx264) (avc1 / 0x31637661), yuv420p, 960x1080, q=-1--1, 8000 kb/s, 120 fps, 15360 tbn, 120 tbc
    Metadata:
      encoder         : Lavc57.107.100 libx264
    Side data:
      cpb: bitrate max/min/avg: 0/0/8000000 buffer size: 0 vbv_delay: -1
frame=  269 fps= 39 q=-1.0 Lsize=    2279kB time=00:00:02.21 bitrate=8423.8kbits/s speed=0.32x
video:2277kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.119200%
[libx264 @ 0000021e335589a0] frame I:2     Avg QP:25.09  size: 16508
[libx264 @ 0000021e335589a0] frame P:193   Avg QP:23.94  size:  9094
[libx264 @ 0000021e335589a0] frame B:74    Avg QP:23.92  size:  7332
[libx264 @ 0000021e335589a0] consecutive B-frames: 62.8%  1.5%  0.0% 35.7%
[libx264 @ 0000021e335589a0] mb I  I16..4: 38.2% 54.3%  7.6%
[libx264 @ 0000021e335589a0] mb P  I16..4:  9.2% 11.8%  0.8%  P16..4: 46.5%  3.4%  3.8%  0.0%  0.0%    skip:24.5%
[libx264 @ 0000021e335589a0] mb B  I16..4:  4.3%  3.7%  0.2%  B16..8: 35.0%  1.5%  0.2%  direct: 9.5%  skip:45.5%  L0:56.6% L1:40.9% BI: 2.5%
[libx264 @ 0000021e335589a0] final ratefactor: 19.31
[libx264 @ 0000021e335589a0] 8x8 transform intra:53.1% inter:88.1%
[libx264 @ 0000021e335589a0] coded y,uvDC,uvAC intra: 22.0% 41.2% 4.5% inter: 12.8% 39.4% 0.0%
[libx264 @ 0000021e335589a0] i16 v,h,dc,p: 18% 32% 19% 31%
[libx264 @ 0000021e335589a0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 14% 17% 54%  2%  3%  3%  4%  1%  2%
[libx264 @ 0000021e335589a0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 11%  9% 63%  3%  4%  3%  3%  2%  2%
[libx264 @ 0000021e335589a0] i8c dc,h,v,p: 63% 23% 13%  1%
[libx264 @ 0000021e335589a0] Weighted P-Frames: Y:86.0% UV:64.8%
[libx264 @ 0000021e335589a0] ref P L0: 53.6%  8.3% 17.1% 11.4%  9.6%
[libx264 @ 0000021e335589a0] ref B L0: 58.9% 14.4% 26.6%
[libx264 @ 0000021e335589a0] ref B L1: 84.8% 15.2%
[libx264 @ 0000021e335589a0] kb/s:8317.64

You are not using an encoder for decoding. What you are doing is telling FFMPEG to decode the input file using hardware acceleration.

NVDEC offers decoders for H.264, HEVC, MJPEG, MPEG-1/2/4, VP8/VP9,
  VC-1.
Codec support varies by hardware.
Note that FFmpeg offers both NVDEC and CUVID hwaccels. They differ in
  how frames are decoded and forwarded in memory.
Sample decode using NVDEC:
ffmpeg -hwaccel nvdec input output
Sample decode using CUVID:
./ffmpeg-git -hwaccel cuvid -c:v h264_cuvid -i input output
https://trac.ffmpeg.org/wiki/HWAccelIntro#NVENCNVDEC

Then you are encoding the file also using hardware acceleration (-c:v h264_nvenc).

NVENC can be used for H.264 and HEVC encoding. FFmpeg supports NVENC
  through the h264_nvenc and hevc_nvenc encoders
https://trac.ffmpeg.org/wiki/HWAccelIntro#NVENCNVDEC

In closing, the decoder does not improve speed. Using your GPU instead of your CPU does.
EDIT:
Now that you have supplied your console output and I have done a little more digging I can tell you:

In current versions of FFMPEG hardware acceleration is supported
  automatically if available.
  https://stackoverflow.com/questions/52765883/ffmpeg-using-hardware-acceleration-for-video-decoding
If it detects a stream which is decodable in hardware then it will attempt to delegate all significant processing to that hardware.
  https://trac.ffmpeg.org/wiki/HWAccelIntro

You can see in your output from

command without option "-c:v h264_nvenc"

That you are using the CPU to decode.

using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2

Then when you specify

command with option "-c:v h264_nvenc"

It tells FFMPEG that hardware acceleration is available, so it uses "h264_nvenc" for the decode and encode (MP4 is a file container and H.264 is the video compression codec).
SideNote: I do not think -hwaccel cuvid is doing anything since you are not using a GPU based scaler and you do not specify -c:v h264_cuvid.

(-hwaccel cuvid) is hardware acceleration, that I know. But in order to use that, you need to specify the codec for decoder (-c:v h264_cuvid ) or for encoder (-c:v h264_nvenc). My command does specify the encoder and it speeds up the encoding. However, I did not specify (-c:v h264_cuvid) (because this causes errors for me) so it should not use hardware acceleration for decoding.

I have also verified with Task Manager that only the GPU encoder is used to accelerate the encoding. The GPU decoder is never used when I run my command.

FFMPEG will always decode the input file before it encodes it again. You specify before the input file to use hardware acceleration so I am assuming that FFMPEG is choosing the decoder automatically. Can you show the console output from the command you ran?

Sorry for the late reply. I have updated the question with console output.


text:
Export MOV timecode track as a text file with FFMPEG
I need to check a set of MOV files for broken timecode so I've been attempting to export the entire timecode track of an MOV file using FFMPEG.
I've attempted this:
ffmpeg -i [source] -map 0:d -c copy -f data data.txt

But it only outputs a small text file with just a couple of characters unrelated to timecode.
Then I tried:
ffmpeg -i [source] -map 0:d -c copy data.mov

and got back a timecode only mov file. Which is closer to what I am looking for.
I also tried:
ffprobe -print_format json -show_format -show_streams "input.mov">"output.json"

This showed me the starting timecode in TAG:timecode
I am looking for a means of outputting the timecode for every frame of video to a text file so that I can then scan it with a python script to look for timecode jumps.

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

My experience does not confirm what they are saying about MOV wrappers having only a starting timecode. There are definitely breaks that can be inserted in the timecode track of an MOV file. I've been able to make files that reset timecode in the middle of a video and jump to completely different numbers when you want them to. I haven't been able to find much information on this as I'm not sure if Apple is even developing for this wrapper anymore.

Those may not be tmcd tracks.

It is an MOV file with a timecode track, exported, with video, from FCP and then sliced up with Quicktime Pro. I'll make a new one later and try to link it to this post.

That would be helpful.


text:
Getting wrong DVD chapter times from lsdvd, Mplayer and Handbrake: the reported chapter boundaries delay progressively compared to the real ones
I'm trying to split video from DVDs into chapters. lsdvd, mplayer -identify and Handbrake all report the same chapter times, but these times cut into following actual chapters (episodes), progressively more so towards the end of a disc. I've checked these times by hand in VLC, and they're indeed wrong, just as cutting with ffmpeg shows. Three discs from one collection exhibit this issue so far (haven't yet tried on unrelated DVDs).
Meanwhile, VLC jumps to the proper boundary times from the DVD menus, so presumably it has the right info.
Why could this be happening? Is there a way to obtain proper chapter times? I'd prefer to keep the process sorta-automated and avoid noting the times manually, for reasons of both purity and practicality. And to know the root cause and a solution for the future.


text:
DeckLink recording using ffmpeg on Ubuntu 18.04 doesn't start
I've been spending the 24 hours troubleshooting this problem, but am getting a bit stuck.
Pre-info: I'm running an Ubuntu 18.04 server with a DeckLink Duo 2 card inside.
Goal: Capture video from the DeckLink Duo 2 and write it to output.avi
What I've tried so far:
I've installed BMD DeckLink drivers 10.11.4 on my Ubuntu Server and verified they server can see the card:
redacted@redacted:~$ BlackmagicFirmwareUpdater status
0:  /dev/blackmagic/io0 [DeckLink Duo 2]    0xd5    OK
1:  /dev/blackmagic/io2 [DeckLink Duo 2]    0xd5    OK
2:  /dev/blackmagic/io1 [DeckLink Duo 2]    0xd5    OK
3:  /dev/blackmagic/io3 [DeckLink Duo 2]    0xd5    OK

I've compiled ffmpeg with decklink and the following configuration:
ffmpeg version 4.1.3 Copyright (c) 2000-2019 the FFmpeg developers
built with gcc 7 (Ubuntu 7.4.0-1ubuntu1~18.04.1)
configuration:
--prefix=/home/redacted/ffmpeg_build
--pkg-config-flags=--static
--extra-cflags='-I/home/redacted/ffmpeg_build/include -I/home/redacted/ffmpeg_sources/BMD_SDK/include'
--extra-ldflags=-L/home/redacted/ffmpeg_build/lib
--extra-libs='-lpthread -lm'
--bindir=/home/redacted/bin
--enable-gpl
--enable-libass
--enable-libfdk-aac
--enable-libfreetype
--enable-libmp3lame
--enable-libopus
--enable-libvorbis
--enable-libvpx
--enable-libx264
--enable-libx265
--enable-nonfree
--enable-decklink

Next I do a basic check to see if my DeckLink Duo 2 shows up in ffmpeg:
[decklink @ 0x5574cc33ef00] Blackmagic DeckLink input devices:
[decklink @ 0x5574cc33ef00]     'DeckLink Duo (1)'
[decklink @ 0x5574cc33ef00]     'DeckLink Duo (2)'
[decklink @ 0x5574cc33ef00]     'DeckLink Duo (3)'
[decklink @ 0x5574cc33ef00]     'DeckLink Duo (4)'
dummy: Immediate exit requested

This confirms the card is seen by ffmpeg.
So now I want to run a capture command, however, it does not matter what command I run, FFmpeg does not start capturing. For example, running a very basic:
"ffmpeg -format_code Hi50 -f decklink -i 'DeckLink Duo (1)' out.avi"

returns
redacted@redacted:~$ ffmpeg -format_code Hi50 -f decklink -i 'DeckLink
Duo (1)' out.avi
ffmpeg version 4.1.3 Copyright (c) 2000-2019 the FFmpeg developers
built with gcc 7 (Ubuntu 7.4.0-1ubuntu1~18.04.1)
configuration: --prefix=/home/redacted/ffmpeg_build --pkg-config-flags=--static -
-extra-cflags='-I/home/redacted/ffmpeg_build/include -
I/home/redacted/ffmpeg_sources/BMD_SDK/include' --extra-ldflags=-
L/home/redacted/ffmpeg_build/lib --extra-libs='-lpthread -lm' --
bindir=/home/redacted/bin --enable-gpl --enable-libass --enable-libfdk-aac --
enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libvorbis --
enable-libvpx --enable-libx264 --enable-libx265 --enable-nonfree --enable-
decklink
libavutil      56. 22.100 / 56. 22.100
libavcodec     58. 35.100 / 58. 35.100
libavformat    58. 20.100 / 58. 20.100
libavdevice    58.  5.100 / 58.  5.100
libavfilter     7. 40.101 /  7. 40.101
libswscale      5.  3.100 /  5.  3.100
libswresample   3.  3.100 /  3.  3.100
libpostproc    55.  3.100 / 55.  3.100
[decklink @ 0x5638a755d000] Found Decklink mode 1920 x 1080 with rate 25.00(i)

It doesn't matter how complicated I make the initial command, with video formats, audio formats, custom sizes, codecs, etc. It all returns the same.
It essentially stays stuck in this position, with the command still running forever. To the best of my knowledge, FFmpeg is supposed to start the encoding process straight after. It does not.
I can confirm that a normal re-encoding command such as:
redacted@redacted:~$ ffmpeg -i video.mov out.avi

works just fine. So FFmpeg at a basic level works.
I can also confirm FFmpeg can 'talk to the DeckLink and set the right mode, I can confirm a picture 'flows' through the card as I can see it showing up on the output loop on my monitor(see image) as soon as I put any of the FFmpeg commands in, however, FFmpeg does not start encoding/capturing.

I think I've done something wrong with the configuration/compiling of FFmpeg, perhaps during compiling, but I cannot figure out what I've done wrong.
Any suggestions are much appreciated.
Thanks,
Rik
EDIT: Running the command with -loglevel trace as requested
redacted@redacted:~$ ffmpeg -loglevel trace -raw_format yuv422p10 1 -an
-
format_code Hp25 -f decklink -i 'DeckLink Duo (2)' output.avi
ffmpeg version 4.1.3 Copyright (c) 2000-2019 the FFmpeg developers
built with gcc 7 (Ubuntu 7.4.0-1ubuntu1~18.04.1)
configuration: --prefix=/home/redacted/ffmpeg_build --pkg-config-flags=--static
-
-extra-cflags='-I/home/redacted/ffmpeg_build/include -
I/home/redacted/ffmpeg_sources/BMD_SDK/include' --extra-ldflags=-
L/home/redacted/ffmpeg_build/lib --extra-libs='-lpthread -lm' --
bindir=/home/redacted/bin --enable-gpl --enable-libass --enable-libfdk-aac --
enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libvorbis --
enable-libvpx --enable-libx264 --enable-libx265 --enable-nonfree --enable-
decklink
libavutil      56. 22.100 / 56. 22.100
libavcodec     58. 35.100 / 58. 35.100
libavformat    58. 20.100 / 58. 20.100
libavdevice    58.  5.100 / 58.  5.100
libavfilter     7. 40.101 /  7. 40.101
libswscale      5.  3.100 /  5.  3.100
libswresample   3.  3.100 /  3.  3.100
libpostproc    55.  3.100 / 55.  3.100
Splitting the commandline.
Reading option '-loglevel' ... matched as option 'loglevel' (set logging
level) with argument 'trace'.
Reading option '-raw_format' ... matched as AVOption 'raw_format' with
argument 'yuv422p10'.
Reading option '1' ... matched as output url.
Reading option '-ac' ... matched as option 'ac' (set number of audio
channels) with argument '2'.
Reading option '-format_code' ... matched as AVOption 'format_code' with
argument 'Hp25'.
Reading option '-f' ... matched as option 'f' (force format) with argument
'decklink'.
Reading option '-i' ... matched as input url with argument 'DeckLink Duo
(2)'.
Reading option 'output.avi' ... matched as output url.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option loglevel (set logging level) with argument trace.
Successfully parsed a group of options.
Parsing a group of options: input url DeckLink Duo (2).
Applying option ac (set number of audio channels) with argument 2.
Applying option f (force format) with argument decklink.
Successfully parsed a group of options.
Opening an input file: DeckLink Duo (2).
[decklink @ 0x55cef7de7300] Trying to find mode for frame size 0x0, frame
timing 0/0, field order 0, direction 0, mode number 0, format code Hp25
[decklink @ 0x55cef7de7300] Found Decklink mode 1920 x 1080 with rate 25.00
[decklink @ 0x55cef7de7300] Using 2 input audio channels

Run the command with -loglevel trace and share full log.

@Gyan Thanks for looking into this, see original edit

Full log, please.

@Gyan full log this time. apologies.

I managed to fix this. It turns out the card was active, but had frozen for some reason. rebooting the machine, something I should have done in the beginning sorted out the problem. Thinks are still not perfect. But my issue is solved. Thanks


text:
ffmpeg prores alpha channel not present when colormatrix and colorspace operations are performed
So I've figured out how to convert images to prores with no colorspace shifts using either:
-vf colormatrix=bt601:bt709 filter for 8bit material
and
-vf colorspace=all=bt709:range=pc:format=yuv444p10:iall='bt601-6-625':irange=pc filter for 8bit or 10bit material.
However, whenever I use colormatrix or colorspace filters the output file contains no alpha channel.  As soon as I remove these filters the alpha channel is present but now I've got a color shift.
#this generates no alpha
ffmpeg -f image2 -r 24.0 -i tif_w_alpha.%3d.tif -c:v prores_ks -profile:v 5 -pix_fmt yuva444p10le -vf colorspace=all=bt709:range=pc:format=yuv444p10:iall='bt601-6-625':irange=pc -alpha_bits 16 this_has_no_alpha_channel.mov

#this has alpha but also a color shift
ffmpeg -f image2 -r 24.0 -i tif_w_alpha.%3d.tif -c:v prores_ks -profile:v 5 -pix_fmt yuva444p10le -alpha_bits 16 this_has_alpha.mov

This behavior is the same in both -profile:v 4 and 5 which are the only 2 that support alpha.  How can I get the color filter to work without losing the alpha channel?

The colorspace and colormatrix filters don't handle alpha pixel formats, so those get stripped off. The workaround is to extract the alpha and then reattach it.
ffmpeg -f image2 -framerate 24.0 -i tif_w_alpha.%3d.tif -filter_complex "[0]colorspace=all=bt709:range=pc:format=yuv444p10:iall='bt601-6-625':irange=pc[main];[0]alphaextract,format=gray10le[alpha];[main][alpha]alphamerge" -c:v prores_ks -profile:v 5 -pix_fmt yuva444p10le -alpha_bits 16 this_has_no_alpha_channel.mov
BTW, The Quicktime specification doesn't accommodate output range pc. Consumers should expect to treat range as always tv. If your software allows to override that, nice, but other software may not.

Thanks.  Not using quicktime for this data.  The software I will be using handles it fine.  Not sure you can even do anything with alpha inside the quicktime app.

Got it working, thanks!

Why did you change the filter ordering?

The ordering you originally posted caused my encode to hang on the last frame.  Killing the process just produced a corrupt file.  Switching the ordering fixed it and produced a correct color and alpha prores file.

That should not make a difference. Share full log.

If you can, share the images.

Here are full logs of a successful encode and a hung encode as well as a single source frame (they're heavy) on google drive

Can't reproduce hang here. Version is N-94391. Upgrade and check.

Thanks for checking.  Not a blocking issue on my end so I'll check and update once I upgrade.


text:
Injecting/embedding/adding/writing metadata to a .mp4 file so it's recognised as 360
I'm working on a library that injects/embeds/writes metadata into a .mp4 file to allow the video to be displayed correctly as a 360 video. The input file is a standard .mp4 file in the equirectangular format which I need to inject the proper metadata to get it to display as a 360 video. I know tools like Google's Spatial Media Tool exist but if possible I would like to do it with FFmpeg.
The metadata injected by the Spatial Media tool looks like this and is what I am trying to achieve:
<?xml version="1.0"?><rdf:SphericalVideo
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:GSpherical="http://ns.google.com/videos/1.0/spherical/"><GSpherical:Spherical>true</GSpherical:Spherical><GSpherical:Stitched>true</GSpherical:Stitched><GSpherical:StitchingSoftware>Spherical Metadata Tool</GSpherical:StitchingSoftware><GSpherical:ProjectionType>equirectangular</GSpherical:ProjectionType></rdf:SphericalVideo>

These are all the things I have tried which did not work:
Method 1
ffmpeg -i input.mp4 -movflags use_metadata_tags -metadata Spherical=true -metadata Stitched=true -metadata ProjectionType=equirectangular -metadata StitchingSoftware=StreetviewJourney -codec copy output.mp4

I have tried many variations of it like adding GSpherical: and xmp: to the metadata tag.
Method 2
When I extract the metadata using ffmpeg it contains the spherical tag in the logs but not when I output it to a ffmetadata file. This was the command I used: ffmpeg -i injected.mp4 -map_metadata -1 -f ffmetadata data.txt
This is the output of the log:
 fps, 60 tbr, 15360 tbn, 120 tbc (default)
    Metadata:
      handler_name    : VideoHandler
    Side data:
      spherical: equirectangular (0.000000/0.000000/0.000000)

Method 3
I also tried to get the metadata using this command: ffprobe -v error -select_streams v:0 -show_streams -of default=noprint_wrappers=1 injected.mp4
This was the logs it outputted:
TAG:handler_name=VideoHandler
side_data_type=Spherical Mapping
projection=equirectangular
yaw=0
pitch=0
roll=0

I then tried to use this command but it didn't work:
ffmpeg -i chapmanspeak.mp4 -movflags use_metadata_tags -metadata side_metadata_type="Spherical Mapping" -metadata projection=equirectangular -metadata yaw=0 -metadata pitch=0 -metadata roll=0 -codec copy output.mp4

you can try something like this if you just want to transcode instead of writing metadata freshly into the file
sudo ffmpeg -i 360video.MP4 -vcodec libx264 -strict unofficial -vprofile high  -acodec aac -f mp4  another.mp4

there is no reason to use sudo here.


text:
Premiere pro: Reverse Match Frame not finding the frame in any other/duplicate clip
Short Wording:
If I’ve 2 identical clips in my Project Panel/same bin created from the same master clip, named Clip-1 and Clip-1b. Is there any way if I want to find any one particular frame of Clip-1 in Clip-1b?
Long wording:
I inserted clip-1 on Sequence-1, commanded Sequence> Match Frame, and the frame under Cti was loaded in the Src Pnl.
Now I deleted clip-1 from Seq1 and inserted clip-1b onto the same seq-1. And now I highlighted Src Pnl (it still has the frame showing from my earlier command). And commanded Sequence> Reverse Match Frame. Now should it/will it locate the frame my current clip-1b showing in the TL? (i've tried to show the same in the attached sshot).
If not, is there any other way to find and match a frame in 2 diff clips in the same project?

Its just not possible.
In Adobe Premier Pro, even exact duplicate clip of any existing clip (even if both are under same project, same or different sequences) is treated as a separate and different clip by Premiere Pro. You can't match any one frame of one clip into another, even if you do know that the said frame exists in both clips.
One work around is to setup multicam and synchornize timecodes on both/each clip. Then you can find frame of one clip into the other.


text:
Exported Lossless Video - Output File Was Lossy
I recorded some video-game footage in 320x200 and then upscaled it to 1920x1440 using ffmpeg (nearest-neighbor, lossless libx264).
Screenshots of the upscaled footage have pixel-perfect color matching the original source.
However, when I import this footage into a video editor, and then immediately export it using a lossless format... color-banding occurs.

Input Footage: https://i.sstatic.net/crGHF.png
Output Footage: https://i.sstatic.net/yHbUy.png

I tried 3 different video editors (kdenlive, vsdc, shotcut). I tried five different lossless codecs (ffv1, h.264, huffyuv, utvideo, lossless jpeg). Nothing seems to work.
Any advice or suggestions would be very much appreciated.

FFMPEG comparison between Input Source and VSDC Lossless JPEG Output (which gave best results, but not perfect...)
ffmpeg -i input.mp4 -i output.avi
ffmpeg version 4.2 Copyright (c) 2000-2019 the FFmpeg developers
  built with gcc 9.1.1 (GCC) 20190807
  configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libdav1d --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmpt
  libavutil      56. 31.100 / 56. 31.100
  libavcodec     58. 54.100 / 58. 54.100
  libavformat    58. 29.100 / 58. 29.100
  libavdevice    58.  8.100 / 58.  8.100
  libavfilter     7. 57.100 /  7. 57.100
  libswscale      5.  5.100 /  5.  5.100
  libswresample   3.  5.100 /  3.  5.100
  libpostproc    55.  5.100 / 55.  5.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'input.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf58.29.100
  Duration: 00:00:11.98, start: 0.000000, bitrate: 425 kb/s
    Stream #0:0(und): Video: h264 (High 4:4:4 Predictive) (avc1 / 0x31637661), gbrp(tv, gbr/unknown/unknown), 1920x1440, 373 kb/s, 60 fps, 60 tbr, 15360 tbn, 120 tbc (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 41 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
Input #1, avi, from 'output.avi':
  Metadata:
    date            : 2019-08-17
    title           : input
    encoder         : msl
  Duration: 00:00:12.00, start: 0.000000, bitrate: 126738 kb/s
    Stream #1:0: Video: jpegls (MJLS / 0x534C4A4D), rgb24(bt470bg/unknown/unknown), 1920x1440, lossless, 126664 kb/s, 60 fps, 60 tbr, 60 tbn, 60 tbc
    Stream #1:1: Audio: mp3 (U[0][0][0] / 0x0055), 44100 Hz, stereo, fltp, 224 kb/s
At least one output file must be specified

At least using Shotcut, you can get lossless output at minimum file size using the FFV1 codec.

In the export window, choose the lossless/FFV1 preset.

Click the Advanced button at the bottom.

Go to the Codec tab, and set the GOP to 250 frames.

Go to the Other tab, delete everything there and type the following:
 coder=1
 context=1
 pix_fmt=bgr0
 mlt_image_format=rgb24

Source: https://forum.shotcut.org/t/lossless-annoyances/18344/2

Edit (June 2021)
The newer versions of Shotcut have better options for lossless encoding with smaller output file size. Here are the steps:

Click the Settings menu > Video Mode > Custom > Add..., then set Colorspace to BT.709 and click OK.

In the Export window, choose any preset and click the Advanced button at the bottom.

In the Codec tab, set Codec to libx264rgb, set Rate control to Quality-based VBR, set Quality to 100%, and set GOP to 250.

In the Other tab, delete everything and paste the following:
 pix_fmt=bgr24
 mlt_image_format=rgb24
 qp=0

When you're done you can save these settings for later use; click the + button at the bottom of the Presets list and choose a name for your custom preset.


text:
Using youtube-dl: Does adaptive bitrate (ABR) affect image quality?
I'm using youtube-dl and ffmpeg to get videos/frames of videos from the web. I was told that youtube (and others) use adaptive bitrate streaming, so depending on the network conditions of the user the bitrate should drop/rise, then even though resolution stays the same, image quality should change.
That got me wondering if youtube-dl has some mechanism for downloading videos with the same (presumably best) bitrate.

So my questions are:
1) When downloading videos through youtube-dl, because of ABR, the quality of the downloaded video depends on network conditions?
2) The following shell script will get a frame of a video at 1:30, will the image quality of this frame be affected by ABR?
MP4URL=`youtube-dl -g MYVIDEOLINK`
ffmpeg -ss 1:30 -i $MP4URL -frames:v 1 myframe.png

3) If one of the previous questions is true: Is there a way to ensure a network independent quality? How?

Adaptive streaming is accomplished by switching between pre-encoded streams of different bitrates and/or resolutions. But the bitrate within any given pre-encoded stream does not vary too much.
YT-DL, with your command, will select the 'best' video stream, usually the one with the highest bitrate and resolution, and return its URL. This URL is a direct resource address, and there will be no switching when downloading it, even if your network gets congested.

That does makes sense. I thought youtube-dl only evaluated resolution and extension since video formats are always categorized by resolution and extension. But having a deeper look in the 'format selection' docs section, it seems like it does take bitrate into account, but keeps it hidden? Is that it?

Running youtube-dl URL -F will show all the variants it detects. One of them will be marked as the best.


text:
Searching for video converter that maintains folder structure
I'm searching for video converter software that maintains folder structure. I have a lot of videos that store to their respective folder, but what I want is to convert the entire folder and subfolders and the output path will remain the same.

Most decent encoders with watch folder support have an option to automatically encode to the same folder structure that the source came from.  I'd check the listing of any software you are looking at to see if it supports it or try a demonstration copy.  I know that Adobe Media Encoder does.
Beyond that level of detail, this is a product recommendation question which is off topic since software may or may not be available tomorrow and the options for video conversion software change frequently.

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


text:
ffmpeg: make a video with multiple input files and formats
I am trying to make a video with multiple input files.
I have a bunch of PNG files and mp4 files and I want to create a video for the duration of my audio file body.mp3
The video should be made using multiple inputs.

file 000000.PNG for duration 17.56
file 01.mp4 (duration ~4.0)
file 100074.PNG for duration 6.12
file 02.mp4 (duration ~4.0)
file 200074.PNG for duration 7.84
file 03.mp4 (duration ~4.0)
file 300074.PNG for duration 11.88

The total video will have only one audio from body.mp3. Assuming body.mp3 duration is equal to all the inputs duration combined (+/- 2.0)
Could you please show me how to achieve this?
Edit: Same resolution for all the input files and same frame rate in all the *.mp4 files. Some times, I may have 04.mp4 and 400074.PNG also.

Same resolution in all inputs? Same framerate in all MP4s?

@Gyan Yeah... same resolution for all the inputs and framerate in all the MP4s. I've edited my question to reflect this.

Let's say the framerate of the MP4s is 30, then you would use
ffmpeg -i body.mp3
       -framerate 30 -loop 1 -t 17.56 -i 000000.PNG
       -i 01.mp4
       -framerate 30 -loop 1 -t 6.12  -i 100074.PNG
       -i 02.mp4
       -framerate 30 -loop 1 -t 7.84  -i 200074.PNG
       -i 03.mp4
       -framerate 30 -loop 1 -t 11.88 -i 300074.PNG
-filter_complex "[1][2][3][4][5][6][7]concat=n=7:v=1:a=0[v]"
-map "[v]" -map 0:a -pix_fmt yuv420p out.mp4

(All in one line; use single-quotes if you're on linux/OSX)

you are a life saver.. thank you very much!

Could you please explain what the -filter_complex and -map does?
I'm trying to add more inputs(1-8 .mp4 and PNGs) to the above script and it won't encode the newly added inputs.