[vlc-devel] [PATCH] sout crop and padd
udo_richter at gmx.de
Thu Sep 15 00:21:23 CEST 2005
Back in february I suggested a patch to VLC that repaired cropping and
added padding to the transcode features.
(See: http://www.via.ecp.fr/via/ml/vlc-devel/2005-02/msg00117.html )
Time has passed, and again I'll offer an improved version of the patch,
currently ported to 0.8.2.
- Repairs cropping which is broken since 0.8.0
- Introduces padding
- Introduces 'canvas' (automatic crop/padd to target size/aspect)
- Add several mod-2 checks for widths and heights.
- Properly handle aspect in all cases
- Work is done by ffmpeg img_resample()
- ffmpeg "video filter2" internally extended for crop/padd
- New filter "crop padd" to access this extension while keeping
- Uses i_visible_width / i_visible_height and i_x_offset / i_y_offset
fields of the input/output format to pass cropping and padding information
- Workaround for old libavcodec versions that cannot handle padd
The current diff:
To explain the canvas feature, take a look at this example:
What happens: The video source (whatever it is) is scaled up (or down)
to 720x576. Next, aspect correction shrinks the video so it matches the
canvas target. For example, if the source is 16:9, then the result will
now be 720x432. Finally, the video is letterboxed to 720x576 again. With
fps=25 finally, the video is ready for DVD or streaming to TV boxes. All
this uses only one pass of scaling of course.
If width and height is not specified, the canvas feature will try to
display the video 1:1, either by padding up or by cropping down. Using
canvas just horizontally or just vertically works too. Specifying
canvas-aspect=1:1 without canvas-width and canvas-height will produce
square pixel video, as needed for AVI output. There are probably some
more hidden tricks that need to be discovered. ;)
- Port to trunk
- Extend "video filter2" directly?
Integrating crop and padd directly into "video filter2" would be nice,
but I guess that requires changes to all other filter2 implementations
and maybe even to filter2 calls. I'm open for suggestions though.
This is the vlc-devel mailing-list, see http://www.videolan.org/vlc/
To unsubscribe, please read http://developers.videolan.org/lists.html
More information about the vlc-devel