Opened 4 years ago

Closed 4 years ago

#3587 closed defect (invalid)

FFMPEG issues when using Tee PseudoMuxer to convert mkv to MP4+TS

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

Description (last modified by Timothy_Gu)

Summary of the bug:
The ffmpeg command i used -

/usr/bin/ffmpeg -i /var/www/files/72760ed097ebe68dfaaf23377be167d2cff457c8 -threads 4 -acodec libfdk_aac -vbr 1 -bsf:a aac_adtstoasc -x264opts crf=24:keyint=240 -vcodec libx264 -preset veryfast -flags +global_header -tune film -f tee -map 0:v -map 0:a -profile:v high -level 4.1 "[f=segment:bsfs/v=dump_extra,h264_mp4toannexb]/var/www/media/video/hd_hls/72760ed097ebe68dfaaf23377be167d2cff457c8/72760ed097ebe68dfaaf23377be167d2cff457c8%03d.ts|[movflags=+faststart]/var/www/media/video/hd/72760ed097ebe68dfaaf23377be167d2cff457c8.mp4"

The command throws an error "[NULL @ 0x370b8c0] Packet header is not contained in global extradata, corrupted stream or invalid MP4/AVCC bitstream"

reminiscent of https://trac.ffmpeg.org/ticket/3117

How to reproduce:
use the command with your own files with an mkv source on the latest git build
Attached is a sample file that produces the issue

The original output :

ffmpeg version git-2014-04-07-836b60c Copyright (c) 2000-2014 the FFmpeg developers
  built on Apr 23 2014 20:24:12 with gcc 4.4.7 (GCC) 20120313 (Red Hat 4.4.7-4)
  configuration: --prefix=/root/ffmpeg_build --extra-cflags=-I/root/ffmpeg_build/include --extra-ldflags=-L/root/ffmpeg_build/lib --bindir=/root/bin --extra-libs=-ldl --enable-gpl --enable-nonfree --enable-libfdk_aac --enable-libmp3lame --enable-libopus --enable-libvorbis --enable-libx264
  libavutil      52. 74.100 / 52. 74.100
  libavcodec     55. 58.102 / 55. 58.102
  libavformat    55. 36.102 / 55. 36.102
  libavdevice    55. 11.100 / 55. 11.100
  libavfilter     4.  3.100 /  4.  3.100
  libswscale      2.  6.100 /  2.  6.100
  libswresample   0. 18.100 /  0. 18.100
  libpostproc    52.  3.100 / 52.  3.100
Input #0, matroska,webm, from '/var/www/files/72760ed097ebe68dfaaf23377be167d2cff457c8':
  Metadata:
    encoder         : libebml v1.3.0 + libmatroska v1.4.0
    creation_time   : 1970-01-01 00:00:02
  Duration: 00:01:26.02, start: 0.000000, bitrate: 651 kb/s
    Stream #0:0: Video: h264 (High 10), yuv420p10le, 1280x528 [SAR 1:1 DAR 80:33], 23.98 fps, 23.98 tbr, 1k tbn, 47.95 tbc (default)
    Stream #0:1: Audio: aac, 48000 Hz, stereo, fltp (default)
    Stream #0:2: Subtitle: subrip (default)
[libx264 @ 0x24b9de0] using SAR=1/1
[libx264 @ 0x24b9de0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2
[libx264 @ 0x24b9de0] profile High, level 4.1
[libx264 @ 0x24b9de0] 264 - core 142 r2 d6b4e63 - H.264/MPEG-4 AVC codec - Copyleft 2003-2014 - http://www.videolan.org/x264.html - options: cabac=1 ref=1 deblock=1:-1:-1 analyse=0x3:0x113 me=hex subme=2 psy=1 psy_rd=1.00:0.15 mixed_ref=0 me_range=16 chroma_me=1 trellis=0 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=0 threads=4 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=1 keyint=240 keyint_min=23 scenecut=40 intra_refresh=0 rc_lookahead=10 rc=crf mbtree=1 crf=24.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
[libfdk_aac @ 0x24bc880] Note, the VBR setting is unsupported and only works with some parameter combinations
Output #0, tee, to '[f=segment:bsfs/v=dump_extra,h264_mp4toannexb]/var/www/media/video/hd_hls/72760ed097ebe68dfaaf23377be167d2cff457c8/72760ed097ebe68dfaaf23377be167d2cff457c8%03d.ts|[movflags=+faststart:bsfs/a=aac_adtstoasc]/var/www/media/video/hd/72760ed097ebe68dfaaf23377be167d2cff457c8.mp4':
  Metadata:
    encoder         : Lavf55.36.102
    Stream #0:0: Video: h264 (libx264), yuv420p, 1280x528 [SAR 1:1 DAR 80:33], q=-1--1, 90k tbn, 23.98 tbc (default)
    Stream #0:1: Audio: aac (libfdk_aac), 48000 Hz, stereo, s16 (default)
Stream mapping:
  Stream #0:0 -> #0:0 (h264 -> libx264)
  Stream #0:1 -> #0:1 (aac -> libfdk_aac)
Press [q] to stop, [?] for help
[NULL @ 0x370b8c0] Packet header is not contained in global extradata, corrupted stream or invalid MP4/AVCC bitstream

Change History (12)

comment:1 Changed 4 years ago by dannyzb

After running some tests , i found the source of the problem

-flags +global_headers makes the data useless for tee to create m2ts for some reason , even after adding the flag "dump_extra"

which makes the tee online example not work
"ffmpeg -i ... -map 0 -flags +global_header -c:v libx264 -c:a aac -strict experimental

-f tee "[bsfs/v=dump_extra]out.ts|[movflags=+faststart]out.mp4|[select=a]out.aac"

removing it fixes it for conversion , but makes it not work in creating MP4 files

comment:2 Changed 4 years ago by cehoyos

  • Keywords tee added

Do you think this is a regression?

comment:3 Changed 4 years ago by dannyzb

I only started using the feature now , but if it isn't a regression this thing has been broken for a while

Test running this on many videos , the error is very consistent
Even applies to conversions of h264 -> x264

comment:4 Changed 4 years ago by cehoyos

  • Priority changed from important to normal

comment:5 follow-up: Changed 4 years ago by dannyzb

http://www.unknownerror.org/Problem/index/1168212616/how-to-output-to-both-mp4-and-mpegts/

This guy had the exact same issue, there are bugs all over the place.
Tee , for the task of dual-converting to MP4 and MPEGTS is now broken and unusable.

comment:6 in reply to: ↑ 5 Changed 4 years ago by cehoyos

Replying to dannyzb:

Tee , for the task of dual-converting to MP4 and MPEGTS is now broken and unusable.

Do you mean this used to work before?

comment:7 Changed 4 years ago by dannyzb

The code i took from the docs
will test on older builds *

comment:8 Changed 4 years ago by cehoyos

What I meant is:
If you say now do you mean it used to work before?

The reason I ask is that I suspect the tee muxer by definition cannot work for h264 in mov and transport streams.

comment:9 Changed 4 years ago by dannyzb

i don't

"The reason I ask is that I suspect the tee muxer by definition cannot work for h264 in mov and transport streams."
if thats true , thats the answer right there..
The only problem is this needs to go into the documentation

if tee can't do that then there's currently no proper solution , as you can only pipe one output at a time - it doesn't fit the scenario of dual HLS+MP4 outputs ( HQ + LQ )

comment:10 Changed 4 years ago by Timothy_Gu

  • Description modified (diff)

comment:11 Changed 4 years ago by dannyzb

Whats the status on this?
Can you clarify on the current status of tee? is this going to be possible or are changes needed to the documentation?

comment:12 Changed 4 years ago by cehoyos

  • Resolution set to invalid
  • Status changed from new to closed

From a quick look in the documentation, it appears that what you need (different bitstream filter settings for different output streams) is supported since summer 2013. Please consult the fine documentation and reopen this ticket if the feature does not work correctly:
https://ffmpeg.org/ffmpeg-formats.html#tee

Note: See TracTickets for help on using tickets.