[FFmpeg-devel] [PATCH] bring -qpfile option of x264 to ffmpeg

Ying Bian bianying
Sat Feb 28 11:56:15 CET 2009


On Fri, Feb 27, 2009 at 11:25 PM, Michael Niedermayer <michaelni at gmx.at>wrote:

> On Fri, Feb 27, 2009 at 10:44:43PM +0800, Ying Bian wrote:
> > Hi,
> >
> > This is a patch which brings the -qpfile option of x264 to ffmpeg.
> > See the help message from "x264 --longhelp":
> >       --qpfile <string>       Force frametypes and QPs for some or all
> > frames
> >                               Format of each line: framenumber frametype
> QP
> >                               QP of -1 lets x264 choose. Frametypes:
> > I,i,P,B,b.
> >
> > I believe sometimes this is useful.
> >
> > - by
>
> > From 2a1f8d36b4895fc00c28bf014756700cf53edf04 Mon Sep 17 00:00:00 2001
> > From: ybian <bianying at gmail.com>
> > Date: Thu, 26 Feb 2009 02:14:28 +0800
> > Subject: [PATCH] bring -qpfile option of x264 to ffmpeg
> >
> > ---
> >  libavcodec/avcodec.h |    7 +++++++
> >  libavcodec/libx264.c |   43 +++++++++++++++++++++++++++++++++++++++++++
> >  libavcodec/options.c |    1 +
> >  3 files changed, 51 insertions(+), 0 deletions(-)
> >
> > diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
> > index f38ad2b..38d2dd0 100644
> > --- a/libavcodec/avcodec.h
> > +++ b/libavcodec/avcodec.h
> > @@ -2315,6 +2315,13 @@ typedef struct AVCodecContext {
> >       * - decoding: unused.
> >       */
> >      float rc_min_vbv_overflow_use;
> > +
> > +    /**
> > +     * qpfile to force frametypes or QPs for some or all frames, only
> used for libx264
> > +     * - encoding: Set by user.
> > +     * - decoding: unused.
> > +     */
> > +    char* qpfile;
> >  } AVCodecContext;
>
> lavc does not access files out of design principles ... (its something
> about
> the media file not being a file, there being no disk or such ...)
>
> also setting QPs should be supported over the input AVFrames
> its the user apps job (=ffmpeg.c) to read and parse qpfile and
> set the fields of the structs.
>
> now i see and agree this would be code duplication between user apps,
> and libav could provide helper functions to do such common tasks but that
> has to be kept as optional part not as only and mandatory way to
> perform something
>
> [...]
> --
> Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
> He who knows, does not speak. He who speaks, does not know. -- Lao Tsu
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.9 (GNU/Linux)
>
> iD8DBQFJqAXvYR7HhwQLD6sRAmq8AJoDZoEZ9sVO2EYt9duJLe/zRUtf6gCgi8cH
> kauojvUed2yrpvqu1A093so=
> =nx3Y
> -----END PGP SIGNATURE-----
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at mplayerhq.hu
> https://lists.mplayerhq.hu/mailman/listinfo/ffmpeg-devel
>

Michael,

Thanks for comments.  As I am new to ffmpeg, can you confirm my following
questions?

1. I agree to put the option in the application level.  If I do, I would
parse the qpfile (with a helper function)
   against ost->frame_number at the beginning of ffmpeg.c/do_video_output,
and then set the fields of
   in_picture structure.  I assume the in_picture.pict_type should be set to
frame_type from qpfile, but
   how to set qp value to in_picture?

2. Where do you think is the best place to put the parse_qpfile helper
function?

-- 
B.Y.




More information about the ffmpeg-devel mailing list