[FFmpeg-devel] [PATCH]Fix bug encoding in interlaced mode when using libschroedingerenc
Michael Niedermayer
michaelni
Wed Nov 17 00:03:52 CET 2010
On Mon, Nov 15, 2010 at 03:38:44PM +1100, Anuradha Suraparaju wrote:
> Fix the bug when encoding in interlaced mode that caused the video duration
> to be twice the audio duration.
>
> The attached patch fixes this bug.
>
> Regards,
> Anuradha
> ffmpeg.c | 3 +++
> libavcodec/libschroedingerenc.c | 8 +++++++-
> 2 files changed, 10 insertions(+), 1 deletion(-)
> d77e4570960adcf88446f8bc76cc6c79f1fdc473 ffmpegsvn_25753_schro_interlaced_encoding_patch.diff
> Index: ffmpeg.c
> ===================================================================
> --- ffmpeg.c (revision 25753)
> +++ ffmpeg.c (working copy)
> @@ -1109,6 +1109,9 @@
>
> sync_ipts = get_sync_ipts(ost) / av_q2d(enc->time_base);
>
> + if (enc->codec_id == CODEC_ID_DIRAC && enc->ticks_per_frame == 2)
> + sync_ipts /=2;
> +
> /* by default, we output a single frame */
> nb_frames = 1;
>
any code specific to a single codec like this in ffmpeg.c looks wrong to me ...
> Index: libavcodec/libschroedingerenc.c
> ===================================================================
> --- libavcodec/libschroedingerenc.c (revision 25753)
> +++ libavcodec/libschroedingerenc.c (working copy)
> @@ -207,11 +207,17 @@
>
> }
>
> - if (avccontext->flags & CODEC_FLAG_INTERLACED_ME)
> + if (avccontext->flags & CODEC_FLAG_INTERLACED_ME) {
> /* All material can be coded as interlaced or progressive
> irrespective of the type of source material. */
> schro_encoder_setting_set_double(p_schro_params->encoder,
> "interlaced_coding", 1);
> + p_schro_params->format->interlaced_coding =
> + schro_encoder_setting_get_double(p_schro_params->encoder,
> + "interlaced_coding");
> + avccontext->time_base.den *= 2;
> + avccontext->ticks_per_frame = 2;
> + }
For encoding timebase is set by the user (ffmpeg.c) (that is documented in
avcodec.h)
So unless that dox is wrong and there are other encoders changing timebase,
i would say this change is breaking our API
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
When the tyrant has disposed of foreign enemies by conquest or treaty, and
there is nothing more to fear from them, then he is always stirring up
some war or other, in order that the people may require a leader. -- Plato
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20101117/b5afa43e/attachment.pgp>
More information about the ffmpeg-devel
mailing list