[FFmpeg-devel] [PATCH] Fix 2 pass mjpeg encoding

Michael Niedermayer michaelni
Sat Dec 4 05:16:01 CET 2010


On Fri, Dec 03, 2010 at 09:33:27PM -0600, Bobby Bingham wrote:
> Two fixes which together make 2pass mjpeg encoding actually try to
> match the requested bitrate.
> 
> The first patch makes the mjpeg encoder count macroblock data towards
> i_tex_bits instead of misc_bits.
> 
> The second patch makes it so ffmpeg doesn't output the last frame's
> stats twice when the last frame isn't delayed.
> -- 
> Bobby Bingham
> ??????????????????????

>  mjpegenc.c |    2 ++
>  1 file changed, 2 insertions(+)
> 5d6dd07206e4469cdc3e3470b8c9be917e52d5dd  01-itex_stats.patch
> Count non-header data towards intra block bit count in MJPEG encoder
> 
> From: Bobby Bingham <uhmmmm at gmail.com>

lgtm

[...]
>  ffmpeg.c |    3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 05a100018f136d03018bbf451c5e13b8bb7e133f  02-eof_stats.patch
> Don't output duplicate stats for the last frame
> 
> From: Bobby Bingham <uhmmmm at gmail.com>
> 
> 
> ---
>  ffmpeg.c |    3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
> 
> diff --git a/ffmpeg.c b/ffmpeg.c
> index e58e7b5..f5c8d30 100644
> --- a/ffmpeg.c
> +++ b/ffmpeg.c
> @@ -1803,13 +1803,14 @@ static int output_packet(AVInputStream *ist, int ist_index,
>                              if (ret < 0) {
>                                  fprintf(stderr, "Video encoding failed\n");
>                                  ffmpeg_exit(1);
> -                            }
> +                            } else if(ret > 0) {
>                              video_size += ret;
>                              if(enc->coded_frame && enc->coded_frame->key_frame)
>                                  pkt.flags |= AV_PKT_FLAG_KEY;
>                              if (ost->logfile && enc->stats_out) {
>                                  fprintf(ost->logfile, "%s", enc->stats_out);
>                              }
> +                            }

stats_out should be null if a encoder doesnt mean to output stats
otherwise it would become impossible to output something at the end

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

The worst form of inequality is to try to make unequal things equal.
-- Aristotle
-------------- 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/20101204/0a1c9c4e/attachment.pgp>



More information about the ffmpeg-devel mailing list