mosaic alignment
Posted: 14 Feb 2008 13:36
The mosaic generated by vlc 0.8.6d looks like this:
but I would want it to look like this, with the video's centered in their container:
This is the command I'm using:
with this conf:
From the wiki:
(http://wiki.videolan.org/Documentation:Modules/mosaic)
That's not the problem, it's aligned ok in the global video, it's the internal aligning I want to change.
Is set to 1, since I want to decide in what order the images get on the grid.
I browsed through the source to find out where the positioning is taking place. I figured that somehow, the images were not aligned right inside their bounding box in the vertical direction. I found following code-snippet in mosaic.c:
Sounds logic, if the image is wider than the containerm don't center. However, for the vertical alignment I found:
First of all, the <, shouldn't that be >? The first block gets executed if the image is smaller than the container, while the comments show that it should be executed when it's larger. I tried to change it and compiled, but the behaviour did not change. p_sys->b_ar || p_sys->b_keep make sure that the images never get centered vertically if mosaic-keep-picture or mosaic-keep-aspect-ratio is enabled. Could someone explain why the image shouldn't be centered in that case? I'm missing the logic. I'm going to change the code and recompile so that the images are always centered, but I would like to understand why this is coded the way it is, there must be a reason. (God knows what will happen after my recompile :p)
Any hints an thoughts are appreciated.
but I would want it to look like this, with the video's centered in their container:
This is the command I'm using:
Code: Select all
vlc -I telnet --ttl 12 --fake-aspect-ratio "16:9" --vlm-conf mosaic.conf --fake-file mosaic.jpg
Code: Select all
# reset VLM configuration
del all
# Background options
new bg broadcast enabled
setup bg input fake:
setup bg output #transcode{acodec=mpga,ab=128,vcodec=mpgv,vb=4096,scale=1,sfilter=mosaic}:bridge-in:std{access=udp{ttl=5},mux=ts,dst=225.1.1.1:2000}
# Mosaic options
setup bg option mosaic-height=932
setup bg option mosaic-width=1526
setup bg option mosaic-xoffset=235
setup bg option mosaic-yoffset=103
setup bg option mosaic-position=1
setup bg option mosaic-rows=3
setup bg option mosaic-cols=4
setup bg option mosaic-order=een,two,[...]
setup bg option mosaic-keep-picture
new one broadcast enabled
setup one input "udp://192.168.1.1@224.1.1.1:2000"
setup one output #duplicate{dst=mosaic-bridge{id=one,width=360},select=video,dst=bridge-out{id=one}}
new two broadcast enabled
setup two input "udp://192.168.1.1@224.1.1.2:2000"
setup two output #duplicate{dst=mosaic-bridge{id=two,width=360},select=video,dst=bridge-out{id=two}}
[...]
control bg play
control one play
control two play
[...]
Code: Select all
* mosaic-align <integer> : Alignment of the mosaic in the parent video. default value: 5
That's not the problem, it's aligned ok in the global video, it's the internal aligning I want to change.
Code: Select all
* mosaic-position <integer> : Positioning method of the mosaic elements. Use 0 to position the elements automatically on the grid, 1 to position the elements in fixed positions on the grid (see mosaic-order) and 2 to use grid independant offsets (see mosaic-offsets).. default value: 0
I browsed through the source to find out where the positioning is taking place. I figured that somehow, the images were not aligned right inside their bounding box in the vertical direction. I found following code-snippet in mosaic.c:
Code: Select all
if( fmt_out.i_width > col_inner_width ||
p_sys->b_ar || p_sys->b_keep )
{
/* we don't have to center the video since it takes the
whole rectangle area or it's larger than the rectangle */
p_region->i_x = p_sys->i_xoffset
+ i_col * ( p_sys->i_width / p_sys->i_cols )
+ ( i_col * p_sys->i_borderw ) / p_sys->i_cols;
}
else
{
/* center the video in the dedicated rectangle */
p_region->i_x = p_sys->i_xoffset
+ i_col * ( p_sys->i_width / p_sys->i_cols )
+ ( i_col * p_sys->i_borderw ) / p_sys->i_cols
+ ( col_inner_width - fmt_out.i_width ) / 2;
}
Code: Select all
if( fmt_out.i_height < row_inner_height
|| p_sys->b_ar || p_sys->b_keep )
{
/* we don't have to center the video since it takes the
whole rectangle area or it's taller than the rectangle */
p_region->i_y = p_sys->i_yoffset
+ i_row * ( p_sys->i_height / p_sys->i_rows )
+ ( i_row * p_sys->i_borderh ) / p_sys->i_rows;
}
else
{
/* center the video in the dedicated rectangle */
p_region->i_y = p_sys->i_yoffset
+ i_row * ( p_sys->i_height / p_sys->i_rows )
+ ( i_row * p_sys->i_borderh ) / p_sys->i_rows
+ ( row_inner_height - fmt_out.i_height ) / 2;
}
Any hints an thoughts are appreciated.