[FFmpeg-devel] [PATCH] Guess the duration before converting video

Michael Niedermayer michaelni
Sat Feb 6 12:11:23 CET 2010


On Mon, Feb 01, 2010 at 05:12:58PM -0600, Justin Johnson wrote:
> On Mon, Feb 1, 2010 at 6:41 AM, Michael Niedermayer <michaelni at gmx.at> wrote:
> >
> > -t -ss flags are not considered
> >
> >
> 
> You're right. Here's an updated patch.
> --Justin Johnson

>  ffmpeg.c             |   16 ++++++++++++++++
>  libavformat/flvenc.c |    2 +-
>  2 files changed, 17 insertions(+), 1 deletion(-)
> 7891c36204280acc830838d55ad0000feb739d39  ffmpeg.diff
> Index: ffmpeg.c
> ===================================================================
> --- ffmpeg.c	(revision 21600)
> +++ ffmpeg.c	(working copy)
> @@ -2104,6 +2104,22 @@
>          ist->is_start = 1;
>      }
>  
> +    /* set the duration of the output to the duration of the input
> +     * if the output ends up being different, it'll be corrected later */
> +    for (i=0;i<nb_output_files;i++) {
> +        AVFormatContext *out_file;
> +        AVFormatContext *in_file;
> +
> +        out_file = output_files[i];
> +        in_file = input_files[i];
> +        if (recording_time != INT64_MAX) {
> +             out_file->duration = recording_time / 1000000 * AV_TIME_BASE;
> +        }
> +        else {
> +             out_file->duration = in_file->duration;
> +        }
> +    }

Input & Output files aren neccessarily matched 1:1 so this isnt correct
at all, it seems ive missed that

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Old school: Use the lowest level language in which you can solve the problem
            conveniently.
New school: Use the highest level language in which the latest supercomputer
            can solve the problem without the user falling asleep waiting.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100206/eb43e730/attachment.pgp>



More information about the ffmpeg-devel mailing list