0

Please help me, with hopefully specific ffmpeg arguments to include in my video encoding.

My work is only related to video stream, so this is the only one I'm changing. I receive a .mov file(s) that have already been pre-compiled for a specific broadcaster, some of those selfcontained videos have 4 streams (1 video, 2 audio, and some other timecode stream). Others have up to 17 streams: 1-video, 15-audio streams and the final one is unsupported tmcd.

My process pipeline includes only re-encoding/re-processing video stream, and everything else I need to pass along to the output file - all other streams without any changes or alterations.

During this step of encoding, I insert icon.png into position 5:21 from sec 2-3, from 4-5, and from 6-8. To achieve this, I use map option, so my encoding string looks like this:

ffmpeg -i in.mov -i icon.png -i icon.png -i icon.png
    -filter_complex "  [0][1]overlay=5:21:enable='between(t,2,3)'[v1];
                      [v1][2]overlay=5:21:enable='between(t,4,5)'[v2];
                      [v2][3]overlay=5:21:enable='between(t,6,8)'[v3]" -map '[v3]' -map 0:a
    -c:v dvvideo -pix_fmt yuv422p -b:v 115084915 -maxrate 115084915 -minrate 115084915 -r 29.97 -top 1 -color_primaries bt709 -color_trc bt709 -colorspace bt709 -vtag dvh6
    -c:a copy -c:s copy -y out.mov

The problem is that the out.mov only shows with 2 streams instead of 17 (1-video, and 2-audio). All other 15 streams are truncated completely. Reading some other stackoverflow posts I found a way to transfer all other streams, is by using -map 0:

But as I tried adding -map 0 on my last line:

    ...
    -map 0 -c:a copy -c:s copy -y out.mov

but this doubles the number of streams from 17 to 34 - also double in output file size. If I remove map '[v3]' -map 0:a from my original encoding string and only include -map 0, I get correct number of streams, but, of course icon.png is not getting inserted at the right time. What should I do?

If there's a way to re-map my -filter_complex to overlay images without using this -map option? Or, be specific at what each -map referring to?

If not, what other arguments/parameters can I use, if such option even exists, to copy all streams, subs and all other audio, potentially some other signal for audio impairment, if such exists.

Please help, so I can finally wrap my output and submit my work.

EDIT 1: Here's my output:

ffprobe version N-99345-g904ab5365c Copyright (c) 2007-2020 the FFmpeg developers
  built with Apple LLVM version 10.0.0 (clang-1000.11.45.5)
  configuration: --enable-filter=qrrabbit --enable-opengl --enable-gpl --enable-libx264 --extra-libs='-lqrencode -lpthread'
  libavutil      56. 59.100 / 56. 59.100
  libavcodec     58.106.100 / 58.106.100
  libavformat    58. 58.100 / 58. 58.100
  libavdevice    58. 11.102 / 58. 11.102
  libavfilter     7. 87.100 /  7. 87.100
  libswscale      5.  8.100 /  5.  8.100
  libswresample   3.  8.100 /  3.  8.100
  libpostproc    55.  8.100 / 55.  8.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'output.mov':
  Metadata:
    major_brand     : qt  
    minor_version   : 512
    compatible_brands: qt  
    creation_time   : 2020-02-29T22:07:42.000000Z
    encoder         : Lavf58.58.100
  Duration: 00:00:20.05, start: 0.000000, bitrate: 133544 kb/s
    Stream #0:0: Video: dvvideo (dvh6 / 0x36687664), yuv422p(bt709, top first), 1280x1080 [SAR 3:2 DAR 16:9], 115084 kb/s, 29.97 fps, 29.97 tbr, 11988 tbn, 29.97 tbc (default)
    Metadata:
      creation_time   : 2020-02-29T22:07:42.000000Z
      handler_name    : VideoHandler
      encoder         : Lavc58.106.100 dvvideo
      timecode        : 00:00:00;00
    Stream #0:1(eng): Audio: pcm_s24le (in24 / 0x34326E69), 48000 Hz, 1 channels, s32 (24 bit), 1152 kb/s (default)
    Metadata:
      creation_time   : 2020-02-29T22:07:42.000000Z
      handler_name    : Apple Sound Media Handler
    Stream #0:2(eng): Audio: pcm_s24le (in24 / 0x34326E69), 48000 Hz, 1 channels, s32 (24 bit), 1152 kb/s (default)
    Metadata:
      creation_time   : 2020-02-29T22:07:42.000000Z
      handler_name    : Apple Sound Media Handler
    Stream #0:3(eng): Audio: pcm_s24le (in24 / 0x34326E69), 48000 Hz, 1 channels, s32 (24 bit), 1152 kb/s (default)
    Metadata:
      creation_time   : 2020-02-29T22:07:42.000000Z
      handler_name    : Apple Sound Media Handler
    Stream #0:4(eng): Audio: pcm_s24le (in24 / 0x34326E69), 48000 Hz, 1 channels, s32 (24 bit), 1152 kb/s (default)
    Metadata:
      creation_time   : 2020-02-29T22:07:42.000000Z
      handler_name    : Apple Sound Media Handler
    Stream #0:5(eng): Audio: pcm_s24le (in24 / 0x34326E69), 48000 Hz, 1 channels, s32 (24 bit), 1152 kb/s (default)
    Metadata:
      creation_time   : 2020-02-29T22:07:42.000000Z
      handler_name    : Apple Sound Media Handler
    Stream #0:6(eng): Audio: pcm_s24le (in24 / 0x34326E69), 48000 Hz, 1 channels, s32 (24 bit), 1152 kb/s (default)
    Metadata:
      creation_time   : 2020-02-29T22:07:42.000000Z
      handler_name    : Apple Sound Media Handler
    Stream #0:7(eng): Audio: pcm_s24le (in24 / 0x34326E69), 48000 Hz, 1 channels, s32 (24 bit), 1152 kb/s (default)
    Metadata:
      creation_time   : 2020-02-29T22:07:42.000000Z
      handler_name    : Apple Sound Media Handler
    Stream #0:8(eng): Audio: pcm_s24le (in24 / 0x34326E69), 48000 Hz, 1 channels, s32 (24 bit), 1152 kb/s (default)
    Metadata:
      creation_time   : 2020-02-29T22:07:42.000000Z
      handler_name    : Apple Sound Media Handler
    Stream #0:9(eng): Audio: pcm_s24le (in24 / 0x34326E69), 48000 Hz, 1 channels, s32 (24 bit), 1152 kb/s (default)
    Metadata:
      creation_time   : 2020-02-29T22:07:42.000000Z
      handler_name    : Apple Sound Media Handler
    Stream #0:10(eng): Audio: pcm_s24le (in24 / 0x34326E69), 48000 Hz, 1 channels, s32 (24 bit), 1152 kb/s (default)
    Metadata:
      creation_time   : 2020-02-29T22:07:42.000000Z
      handler_name    : Apple Sound Media Handler
    Stream #0:11(eng): Audio: pcm_s24le (in24 / 0x34326E69), 48000 Hz, 1 channels, s32 (24 bit), 1152 kb/s (default)
    Metadata:
      creation_time   : 2020-02-29T22:07:42.000000Z
      handler_name    : Apple Sound Media Handler
    Stream #0:12(eng): Audio: pcm_s24le (in24 / 0x34326E69), 48000 Hz, 1 channels, s32 (24 bit), 1152 kb/s (default)
    Metadata:
      creation_time   : 2020-02-29T22:07:42.000000Z
      handler_name    : Apple Sound Media Handler
    Stream #0:13(eng): Audio: pcm_s24le (in24 / 0x34326E69), 48000 Hz, 1 channels, s32 (24 bit), 1152 kb/s (default)
    Metadata:
      creation_time   : 2020-02-29T22:07:42.000000Z
      handler_name    : Apple Sound Media Handler
    Stream #0:14(eng): Audio: pcm_s24le (in24 / 0x34326E69), 48000 Hz, 1 channels, s32 (24 bit), 1152 kb/s (default)
    Metadata:
      creation_time   : 2020-02-29T22:07:42.000000Z
      handler_name    : Apple Sound Media Handler
    Stream #0:15(eng): Audio: pcm_s24le (in24 / 0x34326E69), 48000 Hz, 1 channels, s32 (24 bit), 1152 kb/s (default)
    Metadata:
      creation_time   : 2020-02-29T22:07:42.000000Z
      handler_name    : Apple Sound Media Handler
    Stream #0:16(eng): Audio: pcm_s24le (in24 / 0x34326E69), 48000 Hz, 1 channels, s32 (24 bit), 1152 kb/s (default)
    Metadata:
      creation_time   : 2020-02-29T22:07:42.000000Z
      handler_name    : Apple Sound Media Handler
    Stream #0:17(eng): Data: none (tmcd / 0x64636D74), 0 kb/s
    Metadata:
      creation_time   : 2020-02-29T22:07:42.000000Z
      handler_name    : VideoHandler
      timecode        : 00:00:00;00
Unsupported codec with id 0 for input stream 17

and here's ffprobe from the input file:

ffprobe version N-99345-g904ab5365c Copyright (c) 2007-2020 the FFmpeg developers
  built with Apple LLVM version 10.0.0 (clang-1000.11.45.5)
  configuration: --enable-filter=qrrabbit --enable-opengl --enable-gpl --enable-libx264 --extra-libs='-lqrencode -lpthread'
  libavutil      56. 59.100 / 56. 59.100
  libavcodec     58.106.100 / 58.106.100
  libavformat    58. 58.100 / 58. 58.100
  libavdevice    58. 11.102 / 58. 11.102
  libavfilter     7. 87.100 /  7. 87.100
  libswscale      5.  8.100 /  5.  8.100
  libswresample   3.  8.100 /  3.  8.100
  libpostproc    55.  8.100 / 55.  8.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'input.mov':
  Metadata:
    major_brand     : qt  
    minor_version   : 537199360
    compatible_brands: qt  
    creation_time   : 2020-02-29T22:07:42.000000Z
  Duration: 00:00:20.05, start: 0.000000, bitrate: 133935 kb/s
    Stream #0:0(eng): Video: dvvideo (dvh6 / 0x36687664), yuv422p(bt709, top coded first (swapped)), 1280x1080 [SAR 3:2 DAR 16:9], 115084 kb/s, 29.97 fps, 29.97 tbr, 30k tbn, 29.97 tbc (default)
    Metadata:
      creation_time   : 2020-02-29T22:07:42.000000Z
      handler_name    : Apple Video Media Handler
      encoder         : DVCPRO HD 1080i60
      timecode        : 00:00:00;00
    Stream #0:1(eng): Audio: pcm_s24le (in24 / 0x34326E69), 48000 Hz, 1 channels, s32 (24 bit), 1152 kb/s (default)
    Metadata:
      creation_time   : 2020-02-29T22:07:42.000000Z
      handler_name    : Apple Sound Media Handler
      timecode        : 00:00:00;00
    Stream #0:2(eng): Audio: pcm_s24le (in24 / 0x34326E69), 48000 Hz, 1 channels, s32 (24 bit), 1152 kb/s (default)
    Metadata:
      creation_time   : 2020-02-29T22:07:42.000000Z
      handler_name    : Apple Sound Media Handler
      timecode        : 00:00:00;00
    Stream #0:3(eng): Audio: pcm_s24le (in24 / 0x34326E69), 48000 Hz, 1 channels, s32 (24 bit), 1152 kb/s (default)
    Metadata:
      creation_time   : 2020-02-29T22:07:42.000000Z
      handler_name    : Apple Sound Media Handler
      timecode        : 00:00:00;00
    Stream #0:4(eng): Audio: pcm_s24le (in24 / 0x34326E69), 48000 Hz, 1 channels, s32 (24 bit), 1152 kb/s (default)
    Metadata:
      creation_time   : 2020-02-29T22:07:42.000000Z
      handler_name    : Apple Sound Media Handler
      timecode        : 00:00:00;00
    Stream #0:5(eng): Audio: pcm_s24le (in24 / 0x34326E69), 48000 Hz, 1 channels, s32 (24 bit), 1152 kb/s (default)
    Metadata:
      creation_time   : 2020-02-29T22:07:42.000000Z
      handler_name    : Apple Sound Media Handler
      timecode        : 00:00:00;00
    Stream #0:6(eng): Audio: pcm_s24le (in24 / 0x34326E69), 48000 Hz, 1 channels, s32 (24 bit), 1152 kb/s (default)
    Metadata:
      creation_time   : 2020-02-29T22:07:42.000000Z
      handler_name    : Apple Sound Media Handler
      timecode        : 00:00:00;00
    Stream #0:7(eng): Audio: pcm_s24le (in24 / 0x34326E69), 48000 Hz, 1 channels, s32 (24 bit), 1152 kb/s (default)
    Metadata:
      creation_time   : 2020-02-29T22:07:42.000000Z
      handler_name    : Apple Sound Media Handler
      timecode        : 00:00:00;00
    Stream #0:8(eng): Audio: pcm_s24le (in24 / 0x34326E69), 48000 Hz, 1 channels, s32 (24 bit), 1152 kb/s (default)
    Metadata:
      creation_time   : 2020-02-29T22:07:42.000000Z
      handler_name    : Apple Sound Media Handler
      timecode        : 00:00:00;00
    Stream #0:9(eng): Audio: pcm_s24le (in24 / 0x34326E69), 48000 Hz, 1 channels, s32 (24 bit), 1152 kb/s (default)
    Metadata:
      creation_time   : 2020-02-29T22:07:42.000000Z
      handler_name    : Apple Sound Media Handler
      timecode        : 00:00:00;00
    Stream #0:10(eng): Audio: pcm_s24le (in24 / 0x34326E69), 48000 Hz, 1 channels, s32 (24 bit), 1152 kb/s (default)
    Metadata:
      creation_time   : 2020-02-29T22:07:42.000000Z
      handler_name    : Apple Sound Media Handler
      timecode        : 00:00:00;00
    Stream #0:11(eng): Audio: pcm_s24le (in24 / 0x34326E69), 48000 Hz, 1 channels, s32 (24 bit), 1152 kb/s (default)
    Metadata:
      creation_time   : 2020-02-29T22:07:42.000000Z
      handler_name    : Apple Sound Media Handler
      timecode        : 00:00:00;00
    Stream #0:12(eng): Audio: pcm_s24le (in24 / 0x34326E69), 48000 Hz, 1 channels, s32 (24 bit), 1152 kb/s (default)
    Metadata:
      creation_time   : 2020-02-29T22:07:42.000000Z
      handler_name    : Apple Sound Media Handler
      timecode        : 00:00:00;00
    Stream #0:13(eng): Audio: pcm_s24le (in24 / 0x34326E69), 48000 Hz, 1 channels, s32 (24 bit), 1152 kb/s (default)
    Metadata:
      creation_time   : 2020-02-29T22:07:42.000000Z
      handler_name    : Apple Sound Media Handler
      timecode        : 00:00:00;00
    Stream #0:14(eng): Audio: pcm_s24le (in24 / 0x34326E69), 48000 Hz, 1 channels, s32 (24 bit), 1152 kb/s (default)
    Metadata:
      creation_time   : 2020-02-29T22:07:42.000000Z
      handler_name    : Apple Sound Media Handler
      timecode        : 00:00:00;00
    Stream #0:15(eng): Audio: pcm_s24le (in24 / 0x34326E69), 48000 Hz, 1 channels, s32 (24 bit), 1152 kb/s (default)
    Metadata:
      creation_time   : 2020-02-29T22:07:42.000000Z
      handler_name    : Apple Sound Media Handler
      timecode        : 00:00:00;00
    Stream #0:16(eng): Audio: pcm_s24le (in24 / 0x34326E69), 48000 Hz, 1 channels, s32 (24 bit), 1152 kb/s (default)
    Metadata:
      creation_time   : 2020-02-29T22:07:42.000000Z
      handler_name    : Apple Sound Media Handler
      timecode        : 00:00:00;00
    Stream #0:17(eng): Data: none (tmcd / 0x64636D74), 0 kb/s (default)
    Metadata:
      creation_time   : 2020-02-29T22:07:42.000000Z
      handler_name    : Time Code Media Handler
      timecode        : 00:00:00;00
Unsupported codec with id 0 for input stream 17
QRrabbit
  • 330
  • 3
  • 14

1 Answers1

1

Map all non-video streams conditionally (i.e. include if present). Outputs from complex filtergraphs are automatically mapped to the first output so manual mapping is not required. Copy all streams except the video. You can use a single overlay instance for multiple time ranges.

ffmpeg -i in.mov -i icon.png -filter_complex "[0][1]overlay=5:21:enable='between(t,2,3)+between(t,4,5)+between(t,6,8)'" -map 0:a? -map 0:s? -pix_fmt yuv422p -r 30000/1001 -c copy -c:v dvvideo -b:v 115084915 -maxrate 115084915 -minrate 115084915 -top 1 -color_primaries bt709 -color_trc bt709 -colorspace bt709 -vtag dvh6 -y out.mov

Gyan
  • 85,394
  • 9
  • 169
  • 201
  • @Gyan, Thank you, the + between icons worked well. However, on copying all information for all streams (stream 2->17), the timecode is not carried over. In my case it will always be 00:00:00:00. If I use **-timecode 00:00:00:00**, the output from ffprobe does not change. Is there a way to force it, I don't even mind hardcoding 0 as a static value. Please help – QRrabbit Sep 25 '20 at 00:35
  • Remove `-map 0:d?` – Gyan Sep 25 '20 at 04:40
  • actually learning more about timecodes, I need to set all my streams to the same 00:00:00.00 value. However, still doesn't work. – QRrabbit Sep 25 '20 at 05:21
  • Thank you @Gyan for the suggestion. I took out the -map 0:d?, and on the video stream, I now have 00:00:00;00 which I believe is what I need. But what about all the audio streams - stream2->16? In the source file's ffprobe, each audio stream displays timecode as well. How important is that to a broadcaster? I can't verify with them, they either accept or reject my video. – QRrabbit Sep 26 '20 at 22:43
  • I have not seen a timecode track associated with an audio stream. Share your ffprobe output. – Gyan Sep 27 '20 at 07:04
  • Share the full ffprobe output as text. – Gyan Sep 27 '20 at 19:28
  • thank you. Yes, I updated my question added section EDIT 1, and the output from ffprobe is there. – QRrabbit Sep 28 '20 at 17:11
  • good evening. So, providing the full ffprobe output helped? Interesting enough, someone didn't like my question and they "-1" me, if so, what's the real message behind that down arrow? If question is too silly/stupid, don't ask? In any case, I'm wondering what that 'timecode' could mean if having this information on an audio streams is not very common? I'm curious because I don't have a lot of experience seeing different type of files, and if this is uncommon, or redundant, maybe I don't really need this information? Please advise. – QRrabbit Oct 01 '20 at 03:45
  • Yes, timecode for audio streams is uncommon, and in fact, ffmpeg won't write it for audio. – Gyan Oct 01 '20 at 04:49