[FFmpeg-devel] [PATCH][RFC] variable frame sizes

Eric Buehl eric.buehl
Sun May 24 10:39:04 CEST 2009


Part of my patch updates the resample_height and resample_width values
whenever a new frame size is detected.  Also, these values are not global;
they are contained in the AVOutputStream struct which I also see has a
per-stream resample context.  This means that the situation I described
earlier was incorrect: when there are multiple output streams, the context
is NOT constantly switching and being re-initialized.

I have added some debug prints to demonstrate this in the attached patch.
It shows that two separate scaler contexts are created (one for each output
stream).  Then, as each stream's frame size changes, the appropriate context
is reinitialized exactly once per stream at the appropriate time.

FFmpeg version SVN-r18886, Copyright (c) 2000-2009 Fabrice Bellard, et al.
  configuration: --enable-pthreads --enable-libfaac --enable-libx264
--enable-decoders --enable-gpl --enable-libfaad --enable-nonfree
  libavutil     50. 3. 0 / 50. 3. 0
  libavcodec    52.29. 0 / 52.29. 0
  libavformat   52.33. 0 / 52.33. 0
  libavdevice   52. 2. 0 / 52. 2. 0
  libswscale     0. 7. 1 /  0. 7. 1
  built on May 24 2009 01:17:40, gcc: 4.3.2 20081105 (Red Hat 4.3.2-7)
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'a.mov':
  Duration: 00:00:22.10, start: 0.000000, bitrate: 6337 kb/s
    Stream #0.0(eng): Video: mjpeg, yuvj422p, 640x360 [PAR 72:72 DAR 16:9],
23.98 tbr, 23.98 tbn, 23.98 tbc
Input #1, mov,mp4,m4a,3gp,3g2,mj2, from 'b.mov':
  Duration: 00:00:12.13, start: 0.000000, bitrate: 5771 kb/s
    Stream #1.0(eng): Video: mjpeg, yuvj422p, 640x360 [PAR 72:72 DAR 16:9],
23.98 tbr, 23.98 tbn, 23.98 tbc
SWSCTX ost:0x24e4d30 swctx:0x24f7ac0 initialized to resample from 640x360
SWSCTX ost:0x24e4f00 swctx:0x25f3820 initialized to resample from 640x360
Output #0, mp4, to 'c.mp4':
    Stream #0.0(eng): Video: mpeg4, yuv420p, 100x100 [PAR 16:9 DAR 16:9],
q=2-31, 200 kb/s, 2997 tbn, 23.98 tbc
    Stream #0.1(eng): Video: mpeg4, yuv420p, 200x200 [PAR 16:9 DAR 16:9],
q=2-31, 200 kb/s, 2997 tbn, 23.98 tbc
Stream mapping:
  Stream #0.0 -> #0.0
  Stream #1.0 -> #0.1
Press [q] to stop encoding
SWSCTX ost:0x24e4f00 swctx:0x25f3820 REinitialized to resample from
640x180ts/s
SWSCTX ost:0x24e4d30 swctx:0x2822ad0 REinitialized to resample from
640x180its/s
frame=  530 fps=286 q=2.0 Lq=2.0 size=     715kB time=12.14 bitrate=
482.9kbits/s
video:707kB audio:0kB global headers:0kB muxing overhead 1.123081%


It is entirely possible that I am missing something here, so please be kind
if I am. :)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: dynamic_frame_height_adjust_v3a.patch
Type: application/octet-stream
Size: 2640 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090524/7bb4724d/attachment.obj>



More information about the ffmpeg-devel mailing list