[FFmpeg-devel] how to download specific track data of a m3u8 content?

aihua zhao aihua.halley.zhao at gmail.com
Wed Jun 29 13:25:17 CEST 2016


thanks, seems the right clue to follow.

I don't know much about ffmpeg, after went through avplay.c. I think I
should do the following steps
1. discard all stream by default.
  refer to decode_thread()
    for (i = 0; i < ic->nb_streams; i++)
        ic->streams[i]->discard = AVDISCARD_ALL;
2. enable the desired stream only
refer to stream_component_open()
            ic->streams[stream_index]->discard = AVDISCARD_DEFAULT;

thanks for your help.

2016-06-29 10:01 GMT+08:00 Steven Liu <lingjiujianke at gmail.com>:

> 2016-06-29 8:36 GMT+08:00 aihua zhao <aihua.halley.zhao at gmail.com>:
>
> > thanks.
> >
> > Yes, readahead the list is must.
> > but during playback, I found ffmpeg downloads each content of the list
> > -- av_read_frame() returns me each content with different stream_index.
> > I'm expecting av_read_frame() returns me the interested stream only.
> > I haven't found a way to do so; or said, is there ffmpeg interface to
> > specify a dedicate stream (stream_index) to download.
> >
> > i'm looking into hls.c; there is recheck_discard_flags(), seems it is
> > designed to do some policy like this.
> > but I haven't found one top level interface of ffmpeg for it.
> > recheck_discard_flags() is called once only during hls_read_packet() when
> > c->first_packet is set  -- this flag is set in hls_read_header() only.
> >
> >
> > 2016-06-28 22:22 GMT+08:00 Steven Liu <lingjiujianke at gmail.com>:
> >
> > > 2016-06-28 14:26 GMT+08:00 aihua zhao <aihua.halley.zhao at gmail.com>:
> > >
> > > > Hi Experts:
> > > >
> > > > I use ffmpeg to parse/demux media content, and created a player
> basing
> > on
> > > > it.
> > > >
> > > > here is a m3u8 content:
> > > >
> > > >
> > >
> >
> http://asp.cntv.lxdns.com/asp/hls/main/0303000a/3/default/438eb7a818b246c187e72f1cd4e1bc4c/main.m3u8
> > > > <
> > > >
> > >
> >
> http://asp.cntv.lxdns.com/asp/hls/main/0303000a/3/default/438eb7a818b246c187e72f1cd4e1bc4c/main.m3u8?maxbr=1200
> > > > >
> > > > there are three video track in it.
> > > >
> > > > I found all video/audio tracks are downloaded during playback, and I
> > can
> > > > switch different track on the fly.
> > > > however, it consumes much bandwidth since all tracks are downloaded.
> > > >
> > > > even when I append bandwidth to the url; still the same result:
> > > >
> > > >
> > >
> >
> http://asp.cntv.lxdns.com/asp/hls/main/0303000a/3/default/438eb7a818b246c187e72f1cd4e1bc4c/main.m3u8?maxbr=1200
> > > >
> > > > Is there any way to download the specified track only to save
> > bandwidth?
> > > >
> > > > thanks
> > > >
> > >
> > > Hi Aihua Zhao,
> > >
> > >       If you haven't read the m3u8 file and parse the playlist, and
> read
> > > the sub m3u8 playlist, how do you get the info of the mpegts?
> > >
> > >       So it's must readahead the list and list all of the track for
> > choose.
> > you mean the function looks like "stream_cycle_channel" in ffplay?
> >
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>


More information about the ffmpeg-devel mailing list