Opened 3 years ago

Last modified 4 weeks ago

#6258 new defect

tee muxer fails on stream copy

Reported by: araeos Owned by:
Priority: normal Component: undetermined
Version: unspecified Keywords: muxer tee copy
Cc: przemyslaw.sobala@grupawp.pl Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Summary of the bug: I am trying to transcode a live video only once and output it to multiple files/urls. My audio stream does not need to be transcoded, but the tee muxer fails with codec "copy", producing an error message along the lines of Tag ... incompatible with output codec id ....

How to reproduce (all 3 commands fail similarly):


$ ffmpeg -i test.ts -report -c:v copy -c:a copy -map 0 -f tee '[f=mp4]output.mp4' > /dev/null 2>&1
$ ffmpeg -i test.ts -c:v copy -c:a aac -map 0 -f tee '[f=mp4]output.mp4' > /dev/null 2>&1
$ ffmpeg -i test.ts -c:v libx264 -c:a copy -map 0 -f tee '[f=mp4]output.mp4'
ffmpeg version 3.2.4 Copyright (c) 2000-2017 the FFmpeg developers
  built with gcc 6.3.1 (GCC) 20170109
  configuration: --prefix=/usr --disable-debug --disable-static --disable-stripping --enable-avisynth --enable-avresample --enable-fontconfig --enable-gmp --enable-gnutls --enable-gpl --enable-ladspa --enable-libass --enable-libbluray --enable-libfreetype --enable-libfribidi --enable-libgsm --enable-libiec61883 --enable-libmodplug --enable-libmp3lame --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libv4l2 --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-netcdf --enable-shared --enable-version3 --enable-x11grab
  libavutil      55. 34.101 / 55. 34.101
  libavcodec     57. 64.101 / 57. 64.101
  libavformat    57. 56.101 / 57. 56.101
  libavdevice    57.  1.100 / 57.  1.100
  libavfilter     6. 65.100 /  6. 65.100
  libavresample   3.  1.  0 /  3.  1.  0
  libswscale      4.  2.100 /  4.  2.100
  libswresample   2.  3.100 /  2.  3.100
  libpostproc    54.  1.100 / 54.  1.100
Input #0, mpegts, from 'test.ts':
  Duration: 00:00:01.25, start: 1.400000, bitrate: 9981 kb/s
  Program 1
    Metadata:
      service_name    : Service01
      service_provider: FFmpeg
    Stream #0:0[0x100]: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p(progressive), 1280x800 [SAR 1:1 DAR 8:5], 60 fps, 60 tbr, 90k tbn, 120 tbc
    Stream #0:1[0x101]: Audio: aac (LC) ([15][0][0][0] / 0x000F), 44100 Hz, stereo, fltp, 168 kb/s
[libx264 @ 0x564ae3da9c80] using SAR=1/1
[libx264 @ 0x564ae3da9c80] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 AVX2 LZCNT BMI2
[libx264 @ 0x564ae3da9c80] profile High, level 4.0
[mp4 @ 0x564ae438ff60] Tag [15][0][0][0]/0x0000000f incompatible with output codec id '86018' ([64][0][0][0])
[tee @ 0x564ae3d7f700] Slave '[f=mp4]output.mp4': error writing header: Invalid data found when processing input
[tee @ 0x564ae3d7f700] All tee outputs failed.
Could not write header for output file #0 (incorrect codec parameters ?): Invalid data found when processing inputStream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
  Stream #0:1 -> #0:1 (copy)
    Last message repeated 1 times

See attached file for detailed report logs with input file.

Attachments (1)

ffmpeg-tee-pseudo-muxer-report.zip (1.4 MB) - added by araeos 3 years ago.
input file with reports

Download all attachments as: .zip

Change History (10)

Changed 3 years ago by araeos

input file with reports

comment:1 Changed 3 years ago by araeos

A similar bug was encountered in a question on superuser.com and also described in a post with "-acodec copy".

comment:2 Changed 3 years ago by cehoyos

Is this issue reproducible with current FFmpeg git head?

comment:3 Changed 3 years ago by araeos

Yes, it fails for commit version 4f727fbc7330e726d003e2961fa676ddaf86f994 with the behaviour describe above.

$ ffmpeg -i test.ts -c:v libx264 -c:a copy -map 0 -f tee '[f=mp4]output.mp4'
ffmpeg version N-84509-g4f727fbc73 Copyright (c) 2000-2017 the FFmpeg developers
  built with gcc 6.3.1 (GCC) 20170109
  configuration: --prefix=/usr --disable-debug --disable-static --enable-avisynth --enable-avresample --enable-fontconfig $
-enable-gnutls --enable-gpl --enable-ladspa --enable-libass --enable-libbluray --enable-libfreetype --enable-libfribidi --$
nable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libope$
jpeg --enable-libopus --enable-libfdk-aac --enable-libpulse --enable-libschroedinger --enable-libsoxr --enable-libspeex --$
nable-libssh --enable-libtheora --enable-libv4l2 --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp -$
enable-libx264 --enable-libx265 --enable-libxvid --enable-nonfree --enable-shared --enable-version3
  libavutil      55. 50.100 / 55. 50.100
  libavcodec     57. 85.101 / 57. 85.101
  libavformat    57. 67.100 / 57. 67.100
  libavdevice    57.  3.101 / 57.  3.101
  libavfilter     6. 78.100 /  6. 78.100
  libavresample   3.  2.  0 /  3.  2.  0
  libswscale      4.  3.101 /  4.  3.101
  libswresample   2.  4.100 /  2.  4.100
  libpostproc    54.  2.100 / 54.  2.100
Input #0, mpegts, from 'test.ts':
  Duration: 00:00:01.25, start: 1.400000, bitrate: 9981 kb/s
  Program 1
    Metadata:
      service_name    : Service01
      service_provider: FFmpeg
    Stream #0:0[0x100]: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p(progressive), 1280x800 [SAR 1:1 DAR 8:5], 60 $
ps, 60 tbr, 90k tbn, 120 tbc
    Stream #0:1[0x101]: Audio: aac (LC) ([15][0][0][0] / 0x000F), 44100 Hz, stereo, fltp, 168 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
  Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
[libx264 @ 0x265ed40] using SAR=1/1
[libx264 @ 0x265ed40] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 AVX2 LZCNT BMI2
[libx264 @ 0x265ed40] profile High, level 4.0
[mp4 @ 0x2e64a20] Tag [15][0][0][0]/0x0000000f incompatible with output codec id '86018' ([64][0][0][0])
[tee @ 0x2634700] Slave '[f=mp4]output.mp4': error writing header: Invalid data found when processing input
[tee @ 0x2634700] All tee outputs failed.
Could not write header for output file #0 (incorrect codec parameters ?): Invalid data found when processing input
Error initializing output stream 0:0 --
Conversion failed!

comment:4 Changed 3 years ago by Cigaes

Automatic conversions are not implemented for AAC in the tee muxer. Patch welcome.

comment:5 Changed 3 years ago by araeos

I am not sure about conversions as I know ffmpeg only by it's command line.
The tee muxer fails explicitly when I do not want to transcode the audio stream. This also happens when the original h264 video is copied, instead of the audio as in the report above.

comment:6 follow-up: Changed 3 years ago by d2d22

Edit : this is not a bug the option -flags +global_header was missing, sorry for the noise

ffmpeg version N-88193-g5834cba

Not sure this is related but it could be a clue, I use the tee muxer for dash and on the manifest the codec are not correct, no other difference on my command.
If you think this has nothing to do I will open an other ticket.
codecs="mp4a.40" with the tee muxer and codecs="mp4a.40.2" without
codecs="avc1" with the tee muxer and codecs="avc1.4d400b" without
This may be a problem on the dash part but it could also point a problem on the tee muxer related to the codecs.

-f tee [f=dash:min_seg_duration=1000:use_template=1:utc_timing_url=/time:use_timeline=0:remove_at_exit=1:window_size=120:extra_window_size=240]/live/www/0aeff49e51f1f0c2baaae8c00fd32ad0ae9835f22a2c880c099e4ce4fba9dff4/index.mpd
Last edited 3 years ago by d2d22 (previous) (diff)

comment:7 in reply to: ↑ 6 Changed 15 months ago by jidckii

Hi.
I have the same problem with tee muxer.
-flags global_header does not solve the problem.
what exactly is the problem?
test file: [https://yadi.sk/d/kKiucpgKjsIg5w
]
Here is my case:

$ ffmpeg -re -i test.ts -vsync 0 -flags global_header -c:v copy -c:a aac -f tee  -map 0:0 "[f=flv]rtmp://localhost:1935/live"
[h264 @ 0x559eaec5fbc0] corrupted macroblock 50 16 (total_coeff=-1)
[h264 @ 0x559eaec5fbc0] error while decoding MB 50 16
[h264 @ 0x559eaec5fbc0] concealing 6239 DC, 6239 AC, 6239 MV errors in I frame
Input #0, mpegts, from 'test.ts':
  Duration: 00:01:00.07, start: 1.467000, bitrate: 1672 kb/s
  Program 1 
    Metadata:
      service_name    : Service01
      service_provider: FFmpeg
    Stream #0:0[0x100]: Video: h264 (Baseline) ([27][0][0][0] / 0x001B), yuvj420p(pc, bt709, progressive), 1920x1080, 15 fps, 15 tbr, 90k tbn, 30 tbc
[flv @ 0x559eaec96b80] Tag [27][0][0][0] incompatible with output codec id '27' ([7][0][0][0])
[tee @ 0x559eaecca5c0] Slave '[f=flv]rtmp://localhost:1935/live': error writing header: Invalid data found when processing input
[tee @ 0x559eaecca5c0] All tee outputs failed.
Could not write header for output file #0 (incorrect codec parameters ?): Invalid data found when processing input
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
    Last message repeated 1 times



$ ffmpeg -re -i test.ts -vsync 0 -flags global_header -c:v copy -c:a aac -f flv rtmp://localhost:1935/live
[h264 @ 0x55dc880babc0] corrupted macroblock 50 16 (total_coeff=-1)
[h264 @ 0x55dc880babc0] error while decoding MB 50 16
[h264 @ 0x55dc880babc0] concealing 6239 DC, 6239 AC, 6239 MV errors in I frame
Input #0, mpegts, from 'test.ts':
  Duration: 00:01:00.07, start: 1.467000, bitrate: 1672 kb/s
  Program 1 
    Metadata:
      service_name    : Service01
      service_provider: FFmpeg
    Stream #0:0[0x100]: Video: h264 (Baseline) ([27][0][0][0] / 0x001B), yuvj420p(pc, bt709, progressive), 1920x1080, 15 fps, 15 tbr, 90k tbn, 30 tbc
Output #0, flv, to 'rtmp://localhost:1935/live':
  Metadata:
    encoder         : Lavf58.20.100
    Stream #0:0: Video: h264 (Baseline) ([7][0][0][0] / 0x0007), yuvj420p(pc, bt709, progressive), 1920x1080, q=2-31, 15 fps, 15 tbr, 1k tbn, 90k tbc
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
Press [q] to stop, [?] for help
[flv @ 0x55dc880f1080] Failed to update header with correct duration.636.8kbits/s speed=   1x    
[flv @ 0x55dc880f1080] Failed to update header with correct filesize.
frame=  105 fps= 15 q=-1.0 Lsize=    1365kB time=00:00:06.86 bitrate=1628.0kbits/s speed=1.01x    
video:1362kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.171971%

Replying to d2d22:

Edit : this is not a bug the option -flags +global_header was missing, sorry for the noise

ffmpeg version N-88193-g5834cba

Not sure this is related but it could be a clue, I use the tee muxer for dash and on the manifest the codec are not correct, no other difference on my command.
If you think this has nothing to do I will open an other ticket.
codecs="mp4a.40" with the tee muxer and codecs="mp4a.40.2" without
codecs="avc1" with the tee muxer and codecs="avc1.4d400b" without
This may be a problem on the dash part but it could also point a problem on the tee muxer related to the codecs.

-f tee [f=dash:min_seg_duration=1000:use_template=1:utc_timing_url=/time:use_timeline=0:remove_at_exit=1:window_size=120:extra_window_size=240]/live/www/0aeff49e51f1f0c2baaae8c00fd32ad0ae9835f22a2c880c099e4ce4fba9dff4/index.mpd

comment:8 Changed 4 weeks ago by pszemus

I wanted ffmpeg to reconnect on output RTMP connection drop (e.g. due to RTMP server restart) and came across a similar error:

$ ffmpeg -re -i /usr/local/WowzaStreamingEngine/content/sample.mp4 -c copy -f fifo -fifo_format flv -map 0 -drop_pkts_on_overflow 1 -attempt_recovery 1 -max_recovery_attempts 12 -recovery_wait_time 5 rtmp://localhost/wptv/test
ffmpeg version 4.2.2 Copyright (c) 2000-2019 the FFmpeg developers
  built with gcc 9 (GCC)
  configuration: --prefix=/usr --bindir=/usr/bin --datadir=/usr/share/ffmpeg --docdir=/usr/share/doc/ffmpeg --incdir=/usr/include/ffmpeg --libdir=/usr/lib64 --mandir=/usr/share/man --arch=x86_64 --optflags='-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection' --extra-ldflags='-Wl,-z,relro -Wl,--as-needed -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld ' --extra-cflags=' ' --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libvo-amrwbenc --enable-version3 --enable-bzlib --disable-crystalhd --enable-fontconfig --enable-frei0r --enable-gcrypt --enable-gnutls --enable-ladspa --enable-libaom --enable-libdav1d --enable-libass --enable-libbluray --enable-libcdio --enable-libdrm --enable-libjack --enable-libfreetype --enable-libfribidi --enable-libgsm --enable-libmp3lame --enable-nvenc --enable-openal --enable-opencl --enable-opengl --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librsvg --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libvorbis --enable-libv4l2 --enable-libvidstab --enable-libvmaf --enable-libvpx --enable-libx264 --enable-libx265 --enable-libxvid --enable-libzimg --enable-libzvbi --enable-avfilter --enable-avresample --enable-postproc --enable-pthreads --disable-static --enable-shared --enable-gpl --disable-debug --disable-stripping --shlibdir=/usr/lib64 --enable-libmfx --enable-runtime-cpudetect
  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
  libavresample   4.  0.  0 /  4.  0.  0
  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 '/usr/local/WowzaStreamingEngine/content/sample.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    title           : Big Buck Bunny, Sunflower version
    artist          : Blender Foundation 2008, Janus Bager Kristensen 2013
    composer        : Sacha Goedegebure
    encoder         : Lavf56.26.101
    comment         : Creative Commons Attribution 3.0 - http://bbb3d.renderfarming.net
    genre           : Animation
  Duration: 00:10:34.63, start: 0.000000, bitrate: 743 kb/s
    Stream #0:0(und): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p, 512x288 [SAR 1:1 DAR 16:9], 640 kb/s, 30 fps, 30 tbr, 15360 tbn, 60 tbc (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 96 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
Output #0, fifo, to 'rtmp://localhost/wptv/test':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    title           : Big Buck Bunny, Sunflower version
    artist          : Blender Foundation 2008, Janus Bager Kristensen 2013
    composer        : Sacha Goedegebure
    genre           : Animation
    comment         : Creative Commons Attribution 3.0 - http://bbb3d.renderfarming.net
    encoder         : Lavf58.29.100
    Stream #0:0(und): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p, 512x288 [SAR 1:1 DAR 16:9], q=2-31, 640 kb/s, 30 fps, 30 tbr, 30 tbn, 30 tbc (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 96 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
[flv @ 0x7fffc50da480] Tag avc1 incompatible with output codec id '27' ([7][0][0][0])
[rtmp @ 0x7f9f000044c0] Server error: Stream name is already in use: test
[fifo @ 0x7fffc4f86cc0] Error opening rtmp://localhost/wptv/test: Operation not permitted
[fifo @ 0x7fffc4f86cc0] Recovery failed: Operation not permitted

After enabling encoding (-c copy -> -c:a aac -c:v libx264) it starts to work as expected, but I don't want to transcode the input stream (just transmux).

comment:9 Changed 4 weeks ago by pszemus

  • Cc przemyslaw.sobala@grupawp.pl added
Note: See TracTickets for help on using tickets.