[Libav-user] Converting ts to DASH using libavformat

James Crisafulli james2048 at gmail.com
Tue Feb 25 21:36:40 EET 2020

On Tue, 25 Feb 2020 at 17:13, Simon Brown <simon.k.brown at gmail.com> wrote:

> I'm trying to convert an incoming transport stream to DASH without
> re-encoding.
> I've done this using two separate ffmpeg commands and it works, but as
> each instance of FFMpeg spends time locking onto the stream, finding the
> first I-frame, etc the resulting latency is unacceptable.  I thought I
> could streamline this somewhat by writing it using the libav libraries that
> come with FFmpeg.
> I've taken the demux_decode.c example and receive the stream.  I don't
> decode it, I just get a packet from the stream using:
> av_read_frame(fmt_ctx, &pkt)
> Once read, I try and write it to the stream using:
>    ret = av_interleaved_write_frame(oc, &pkt);
> having setup oc as an output context for muxer "dash".
>     avformat_alloc_output_context2(&oc, NULL, "dash", filename);
> However, I seem to have missed some vital steps, because the dash muxer
> responds with:
> Output #0, dash, to 'vid.mpd':
>     Stream #0:0: Unknown: none
> The muxing.c example is all about taking some generated frames and
> encoding them before sending them out and that sets up a codec context
> which is added to the dash muxer, but I don't want a codec context, because
> I don't want to encode an already encoded stream.
> Any help would be greatly appreciated.
> Regards,
> Simon
> _______________________________________________
> Libav-user mailing list
> Libav-user at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/libav-user
> To unsubscribe, visit link above, or email
> libav-user-request at ffmpeg.org with subject "unsubscribe".

See the "remuxing.c" example.
Use avcodec_parameters_copy to copy the codecpar from the demuxer's
AVStream to the muxer's one.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://ffmpeg.org/pipermail/libav-user/attachments/20200225/532da986/attachment.html>

More information about the Libav-user mailing list