Opened 4 years ago

Closed 4 years ago

#6787 closed defect (invalid)

mpeg-dash: Codec type of stream 1 doesn't match AdaptationSet's media type

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


Summary of the bug:

I'm trying to convert a file to dash format. I'm executing ffmpeg through a program feeding it through stdin. Below are the params.
"ffmpeg", "-nostdin", "-i", "-", "-y", "-map", "0:0", "-c:0", "h264", "-map", "0:1", "-c:1", "aac", "-min_seg_duration", "1000000", "-use_timeline", "1", "-use_template", "1", "-init_seg_name", "$RepresentationID$-init.mp4s", "-media_seg_name", "$RepresentationID$-$Number$.mp4s", "-adaptation_sets", "id=/Users/x/export/xyz/97M4TS6IqnQ.mpd,streams=0,1", "-remove_at_exit", "0", "-f", "dash", "-dash", "1", "/Users/x/export/xyz/97M4TS6IqnQ.mpd", "-loglevel", "error"

It errors out:

err out [dash @ 0x7fe58b095400] Codec type of stream 1 doesn't match AdaptationSet's media type
Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument
Error initializing output stream 0:0 --


ffmpeg version 3.4 Copyright (c) 2000-2017 the FFmpeg developers

built with Apple LLVM version 9.0.0 (clang-900.0.37)
configuration: --prefix=/usr/local/Cellar/ffmpeg/3.4 --enable-shared --enable-pthreads --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-gpl --enable-libmp3lame --enable-libx264 --enable-libxvid --enable-opencl --enable-videotoolbox --disable-lzma
libavutil 55. 78.100 / 55. 78.100
libavcodec 57.107.100 / 57.107.100
libavformat 57. 83.100 / 57. 83.100
libavdevice 57. 10.100 / 57. 10.100
libavfilter 6.107.100 / 6.107.100
libavresample 3. 7. 0 / 3. 7. 0
libswscale 4. 8.100 / 4. 8.100
libswresample 2. 9.100 / 2. 9.100
libpostproc 54. 7.100 / 54. 7.100

Hyper fast Audio and Video encoder

Change History (5)

comment:1 by Carl Eugen Hoyos, 4 years ago

Component: ffmpegundetermined

Please test current FFmpeg git head, remove -loglevel error from your command line and provide a simplified command line together with the complete, uncut console output to make this a valid ticket.

comment:2 by Carl Eugen Hoyos, 4 years ago

Several dash-related fixes were just committed, please update again if necessary.

comment:3 by Mihai, 4 years ago

I will try to simplify the command to bare minimum and send a reduced test case. I've checked the latest commits but I think they don't fix the issue. The issue is related to line 457;a=blob_plain;f=libavformat/dashenc.c;hb=refs/heads/master

The mediaType of the adaptation set doesn't need to match all the codec types of the streams because an adaptationSet may include streams of different media types (i.e. both audio, video representations not only video or only audio representation). Line 457 seems to restrict the media type of the streams to the media type of the adaptation set.

if (as->media_type != s->streams[i]->codecpar->codec_type) {

av_log(s, AV_LOG_ERROR, "Codec type of stream %d doesn't match AdaptationSet's media type\n", i);


comment:4 by Carl Eugen Hoyos, 4 years ago

Much better than reporting a bug here is of course sending a patch - made with git format-patch to the FFmpeg development mailing list.

comment:5 by Mihai, 4 years ago

Resolution: invalid
Status: newclosed

While I was working on the patch I've found out that my report was invalid and ffmpeg was working according to the dash specs.

Note: See TracTickets for help on using tickets.