[FFmpeg-trac] #2873(avformat:open): ffmpeg concat demuxer fails: mpeg files with different audio and video stream order
FFmpeg
trac at avcodec.org
Tue Aug 20 00:17:01 CEST 2013
#2873: ffmpeg concat demuxer fails: mpeg files with different audio and video
stream order
-------------------------------------+-------------------------------------
Reporter: kadmandux | Owner:
Type: enhancement | Status: open
Priority: normal | Component: avformat
Version: git-master | Resolution:
Keywords: concat | Blocked By:
demuxer | Reproduced by developer: 0
Blocking: |
Analyzed by developer: 0 |
-------------------------------------+-------------------------------------
Comment (by kadmandux):
What do you think about this approach?
1.- Add two simple functions to utils.c for to sort the streams based on
id:
{{{
void av_sort_streams_by_id(AVFormatContext *s)
qsort((void *)s->streams, s->nb_streams, sizeof(s->streams[0]),
av_compare_streams);
/*Adjust the indexes */
for (int i=0;i<s->nb_streams;i++) {
s->streams[i]->index = i;
}
}
}}}
2.- Add the prototype of first function to "avformat.h"
{{{
void av_sort_streams_by_id(AVFormatContext *s);
}}}
3.- Modify ffprobe.c, for to use the new function, from inside
"open_input_file" function:
{{{
/* Reorder streams if the format requires it (added by kadmandux)
* Is the flag AVFMTCTX_NOHEADER a good candidate to use for this
purpose?
* Or should I define a new specific flag in "avformat.h" */
if (fmt_ctx->ctx_flags & AVFMTCTX_NOHEADER)
av_sort_streams_by_id(fmt_ctx);
}}}
This code should be executed before the call to
"avformat_find_stream_info".
4.- Do the equivalent change in ffmpeg_opt.c, also inside
"open_input_file" function.
--
Ticket URL: <https://ffmpeg.org/trac/ffmpeg/ticket/2873#comment:3>
FFmpeg <http://ffmpeg.org>
FFmpeg issue tracker
More information about the FFmpeg-trac
mailing list