[FFmpeg-devel] [PATCH] examples: add remuxing example

Stefano Sabatini stefasab at gmail.com
Sun Jan 19 16:06:22 CET 2014


On date Sunday 2014-01-19 13:57:08 +0100, Nicolas George encoded:
> Le decadi 30 nivôse, an CCXXII, Stefano Sabatini a écrit :
> > Show how to perform streamcopy from one container to another.
> > ---
> >  doc/examples/Makefile   |   1 +
> >  doc/examples/remuxing.c | 164 ++++++++++++++++++++++++++++++++++++++++++++++++
> >  2 files changed, 165 insertions(+)
> >  create mode 100644 doc/examples/remuxing.c
> > 
> > diff --git a/doc/examples/Makefile b/doc/examples/Makefile
> > index f085532..a25455e 100644
> > --- a/doc/examples/Makefile
> > +++ b/doc/examples/Makefile
> > @@ -17,6 +17,7 @@ EXAMPLES=       decoding_encoding                  \
> >                  filtering_audio                    \
> >                  metadata                           \
> >                  muxing                             \
> > +                remuxing                           \
> >                  resampling_audio                   \
> >                  scaling_video                      \
> >                  transcode_aac                      \
> > diff --git a/doc/examples/remuxing.c b/doc/examples/remuxing.c
> > new file mode 100644
> > index 0000000..5bf1640
> > --- /dev/null
> > +++ b/doc/examples/remuxing.c
> > @@ -0,0 +1,164 @@
> > +/*
> > + * Copyright (c) 2013 Stefano Sabatini
> > + *
> > + * Permission is hereby granted, free of charge, to any person obtaining a copy
> > + * of this software and associated documentation files (the "Software"), to deal
> > + * in the Software without restriction, including without limitation the rights
> > + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
> > + * copies of the Software, and to permit persons to whom the Software is
> > + * furnished to do so, subject to the following conditions:
> > + *
> > + * The above copyright notice and this permission notice shall be included in
> > + * all copies or substantial portions of the Software.
> > + *
> > + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> > + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> > + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
> > + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> > + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
> > + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
> > + * THE SOFTWARE.
> > + */
> > +
> > +/**
> > + * @file
> > + * libavformat/libavcodec remuxing API example.
> > + *
> > + * Remux streams from one container format to another.
> > + * @example doc/examples/remuxing.c
> > + */
> > +
> > +#include <libavutil/timestamp.h>
> > +#include <libavformat/avformat.h>
> > +
> > +static void log_packet(const AVFormatContext *fmt_ctx, const AVPacket *pkt, const char *tag)
> > +{
> 
> > +    AVRational time_base = fmt_ctx->streams[pkt->stream_index]->time_base;
> 
> const AVRational *time_base = &...
> 
> to avoid an extra copy.

Done without the const.

[...]
> 
> > +        pkt.pts = av_rescale_q(pkt.pts, in_stream->time_base, out_stream->time_base);
> > +        pkt.dts = av_rescale_q(pkt.dts, in_stream->time_base, out_stream->time_base);
> 
> Maybe use AV_ROUND_PASS_MINMAX to handle the cases where pkt.pts or pkt.dts
> is unset.

Changed and updated.

Will push in case I see no more comments.
-- 
FFmpeg = Fanciful & Fabulous Mythic Perfectionist Exciting Guide
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-examples-add-remuxing-example.patch
Type: text/x-diff
Size: 8028 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20140119/1b9d51d7/attachment.bin>


More information about the ffmpeg-devel mailing list