[FFmpeg-devel] [PATCH] ffmpeg: redesign video resampling in case of mid-stream video size/format change

Michael Niedermayer michaelni at gmx.at
Sat Apr 23 01:48:56 CEST 2011


On Fri, Apr 22, 2011 at 10:51:35AM +0200, Stefano Sabatini wrote:
> On date Thursday 2011-04-21 12:48:15 +0200, Stefano Sabatini encoded:
> > On date Wednesday 2011-04-20 01:24:28 +0200, Michael Niedermayer encoded:
> [...]
> > > breaks stream copy
> > > ffmpeg -i ~/videos/matrixbench_mpeg2.mpg -vcodec copy tmp.avi
> > > [IMGUTILS @ 0x7fff8c6a1b70] Picture size 0x0 is invalid
> > > Cannot allocate temp picture, check pix fmt
> > 
> > Fixed by the pre_process_video_frmae() patch already applied.
> > 
> > Patch updated.
> > -- 
> > FFmpeg = Frenzy and Faithful Mastodontic Philosofic Ecumenical Gem
> 
> > From 648239f2e80278e04b3c78b4013abe30b332d2ef Mon Sep 17 00:00:00 2001
> > From: Stefano Sabatini <stefano.sabatini-lala at poste.it>
> > Date: Sat, 16 Apr 2011 23:14:44 +0200
> > Subject: [PATCH] ffmpeg: redesign video resampling in case of mid-stream video size/format change
> > 
> > The new design supports video resolution/format change with and
> > without AVFILTER_CONFIG, thus avoiding the need for the
> > av_vsrc_buffer_add_frame2() hack.
> > 
> > When a change in video resolution/format is detected, a scaling
> > context is lazily initialized, and used for rescaling the input video
> > to the initial destination size/format.
> > 
> > The rescaling/conversion is moved from do_video_out() to
> > pre_process_video_frame(), and all the resampling/conversion structs
> > are moved from AVOutputStream to AVInputStream. Conversion is now
> > performed *just after decoding*, and before feeding either the encoder
> > (in case libavfilter is not enabled) or the filterchain source.
> > 
> > Tested with files:
> > all_filese_together.avi
> > crash_pirateszz_2_s25_r003.fuzz.sample
> > kgv1.avi
> > res_change_ffmpeg_aspect.ts
> > resolutionchange.mpg
> > size_change.nsv
> > 
> > Fix issues:
> > roundup #2217
> > trac #59
> > trac #64
> > trac #74
> > 
> > Signed-off-by: Stefano Sabatini <stefano.sabatini-lala at poste.it>
> > ---
> >  ffmpeg.c |  185 ++++++++++++++++++++++++++++++--------------------------------
> >  1 files changed, 90 insertions(+), 95 deletions(-)
> 
> Ping.

compile without avfilter

then try
./ffmpeg -i 23.mpg -an -s 100x100 100.avi -s 200x200 200.avi

where 23.mpg is some file with a resolution change (here it was 200x200 -> 300x300)

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

The bravest are surely those who have the clearest vision
of what is before them, glory and danger alike, and yet
notwithstanding go out to meet it. -- Thucydides
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20110423/2af687ce/attachment.asc>


More information about the ffmpeg-devel mailing list