Opened 5 years ago

Closed 5 years ago

#7620 closed defect (fixed)

avformat/tee: tee muxer with fifo incorrectly parse bsfs options

Reported by: caspy Owned by:
Priority: normal Component: avformat
Version: git-master Keywords: tee
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Summary of the bug:
if tee muxer used with fifo muxer (use_fifo=1) it incorrectly parse/handle bsfs options.

Simplified example to reproduce:

%ffmpeg -i in.mp4 -c copy -map 0 -f tee "[bsfs/v=h264_mp4toannexb]out.ts
runs ok

%ffmpeg -i in.mp4 -c copy -map 0 -f tee "[bsfs/v=h264_mp4toannexb:use_fifo=1]out.ts
fails with:
[mpegts @ 0x354ce40] Unknown option 'bsfs/v'
[tee @ 0x34f5e80] All tee outputs failed.
av_interleaved_write_frame(): Invalid argument

additional info:

in libavformat/tee.c:
in open_slave():

    if (tee_slave->use_fifo) {
...
            ret = av_dict_get_string(options, &format_options_str, '=', ':');
            ret = av_dict_set(&tee_slave->fifo_options, "format_opts", format_options_str,
...
        av_dict_free(&options);
        options = tee_slave->fifo_options;
    }

we refill 'options', and move bsfs parts into 'format_opts'
and later in this function this code:

while (entry = av_dict_get(options, "bsfs", NULL, AV_DICT_IGNORE_SUFFIX)) {

do not see bsfs options.

Change History (6)

comment:1 by caspy, 5 years ago

bump, pls

comment:2 by Carl Eugen Hoyos, 5 years ago

Please provide the command line you tested together with the complete, uncut console output to make this a valid ticket.

comment:3 by caspy, 5 years ago

# ./ffmpeg -i /tmp/in.ts -c copy -map 0 -f tee "[bsfs/v=h264_mp4toannexb:use_fifo=1]out.ts"
ffmpeg version n4.1-13-gb420f23 Copyright (c) 2000-2018 the FFmpeg developers
  built with gcc 4.8.5 (GCC) 20150623 (Red Hat 4.8.5-28)
  configuration: --prefix=./ --pkg-config-flags=--static --extra-cflags=-I./include --extra-ldflags=-L./lib --extra-libs=-lpthread --extra-libs=-lm --bindir=./bin --enable-gpl --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
Input #0, mpegts, from '/tmp/in.ts':
  Duration: 00:00:06.00, start: 588.040000, bitrate: 3613 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), 1280x720, 25 fps, 25 tbr, 90k tbn, 50 tbc
Output #0, tee, to '[bsfs/v=h264_mp4toannexb:use_fifo=1]out.ts':
  Metadata:
    encoder         : Lavf58.20.100
    Stream #0:0: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p(progressive), 1280x720, q=2-31, 25 fps, 25 tbr, 25 tbn, 25 tbc
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
Press [q] to stop, [?] for help
[mpegts @ 0x4622840] Unknown option 'bsfs/v'
[tee @ 0x45aea80] All tee outputs failed.
av_interleaved_write_frame(): Invalid argument
frame=    1 fps=0.0 q=-1.0 Lsize=N/A time=00:00:00.04 bitrate=N/A speed= 123x
video:83kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
Conversion failed!

comment:4 by Carl Eugen Hoyos, 5 years ago

Version: unspecifiedgit-master

In which situation do you need to specify a bitstream filter for the fifo tee pseudo muxer?

comment:5 by Dennis E. Mungai, 5 years ago

Case in point: When dealing with HLS and DASH streams where the bitstream filters 'bsfs/a=aac_adtstoasc:bsfs/v=dump_extra' will need to be passed to provide valid output when '-flags +global_header+cgop' is set.

comment:6 by Carl Eugen Hoyos, 5 years ago

Keywords: fifo removed
Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.