Opened 2 years ago

Last modified 5 months 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: 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 2 years ago.
input file with reports

Download all attachments as: .zip

Change History (8)

Changed 2 years ago by araeos

input file with reports

comment:1 Changed 2 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 2 years ago by cehoyos

Is this issue reproducible with current FFmpeg git head?

comment:3 Changed 2 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 2 years ago by Cigaes

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

comment:5 Changed 2 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 21 months 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
Version 1, edited 21 months ago by d2d22 (previous) (next) (diff)

comment:7 in reply to: ↑ 6 Changed 5 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
Note: See TracTickets for help on using tickets.