[vlc-devel] [vlc] transcoding with different input and output chromas

Jean-Paul Saman jpsaman at videolan.org
Sun May 18 13:39:26 CEST 2008


This patch is flawed. I'll try to explain why .. read on ..

lokidor wrote:
> lokidor a écrit :
>> Hello,
>>
>> With vlc 0.9.0 from git is there a simple solution to transcode video 
>> with different input and output chromas ?
>>
>> My platform is a Nokia Internet Tablet N810 running maemo 4.0 (based 
>> on linux debian) and I compiled vlc inside scratchbox.
>>
>> This device has a builtin webcam TCM825x which is v4l2 compatible and 
>> works perfectly with the following command :
>>
>> qvlc v4l2:///dev/video0:chroma="UYVY":width=320:height=240
>>
>> This webcam can only output UYVY or RV16 signal, so vlc need to 
>> convert it to I420.
>>
>> As I built ffmpeg with "--enable-swcale" vlc is supposed to use the 
>> libswscale library which should be able to deal with the chroma 
>> convertion, but when I try to trancode the video with the following 
>> command:
>>
>> cvlc -vvv --color v4l2:///dev/video0:chroma="UYVY":width=320:height=240 \
>> --sout 
>> '#transcode{vcodec=mp4v,vb=384}:std{access=http,mux=ts,url=192.168.1.6:8080}' 
>> --ttl 12 \
>> --sout-ffmpeg-hurry-up --ffmpeg-hurry-up --rt-priority
>>
>>  I get the following error :
>>
>> "
>> [00000329] stream_out_transcode generic debug: source 320x240, crop 
>> 320x240, destination 320x240, padding 320x240
>> [00000329] stream_out_transcode generic debug: encoder aspect is 
>> 576000:432000
>> [00000355] main encoder debug: looking for encoder module: 7 candidates
>> [00000355] ffmpeg encoder debug: libavcodec already initialized
>> [00000355] ffmpeg encoder debug: found encoder MPEG-4 Video
>> [00000355] main encoder debug: using encoder module "ffmpeg"
>> [00000338] main generic debug: adding a new input
>> [00000338] mux_asf generic debug: adding input
>> [00000385] main filter debug: looking for video filter2 module: 1 
>> candidate
>> [00000385] main filter warning: no video filter2 module matching 
>> "scale" could be loaded
>> "
>>
>> And vlc continue failling to transcode rawvideo...
>>
>> After looking at the code It seem's that vlc doesn't find the 
>> libswscale filter defined in "codec/ffmpeg/ffmpeg.c" (which is 
>> correctly built) and try to load the filter from "video_filter/scale.c".
>> This filter can only deal with identical input and output chroma 
>> formats, so it is rejected.

The above conclusion is wrong. VLC finds the swcaler module scale.c, 
however the supplied chroma cannot be converted by libswscale. Therefor 
codec/ffmpeg/scale.c exits.

libswscale unfortunately doesn't support all the chroma conversions that 
were available in the former API. This means that we (vlc team) must 
find another way to support those old conversions automatically. As it 
is clear to you we don't do that at the moment in transcoding. Thanks 
for pointing this problem out to us.

>> I tried to build vlc without swscale in order to use the ffmpeg "crop 
>> padd" filter but it is worst :
>>
>> "
>> [00000632] main filter debug: looking for video filter2 module: 0 
>> candidates
>> [00000632] main filter error: no video filter2 module matched "crop padd"
>> [00000621] stream_out_transcode generic debug: no video filter found
>> "
>>

This is indeed a regression. The attached patch restores the way the old 
crop padd module was loaded. It is a bit out of date and might need a 
little work, but you will get the idea. Please test if you need crop 
padd functionality

>> And vlc continue failling to transcode rawvideo...
>>
>> Vlc doesn't find a "crop padd" filter but  "vlc --list | grep crop" 
>> give me croppadd...
>> Aflter looking at the code it seems that the missing space is the key 
>> point but anyway this filter (defined in "video_filter/croppadd.c") is 
>> not the ffmpeg filter and it can only deal with identical input and 
>> output chroma formats...

Wrong because "croppadd.c" is a new module croppadd module that will is 
to be used in the libswscale context. Unfortunately that module has 
still some issues waiting to be resolved.

>> As I know that is possible directly with vlc 0.8.6 with the ffmpeg 
>> "crop padd" filter I would know why I can't with vlc 0.9  ?
>>
>> Maybe vlc 0.9 uses a different method ?
>>

We are forced to use libswscale for chroma conversions, scaling etc. 
Since the old ffmpeg API is going to dissappear pretty soon.

Why "crop padd" doesn't work anymore? Well that is an easy answer "we 
are working on it" and the work has not finished yet. Remember 0.9.0 is 
still in _development_ !!

>> I saw there is a yuy2_i420 conversion filter but I didn't find a way 
>> to use it on the command line.
>>
>> Lokidor
>>
>> ______________________________________________________
>> vlc mailing list
>> To unsubscribe or modify your subscription options:
>> http://mailman.videolan.org/listinfo/vlc
>>   
> Following my unanswered mail for the moment on the vlc mailing list, I 
> looked more precisely the code in relation to the criteria for selecting 
> filter and I have deduced that VLC load the module which  have:
> 
> - A matching capability ("video filter2")
> - A matching object_name or shortcut ("scale" if libswcale is detected 
> or "crop padd" if not)
> - The biggest score
> 
> 1\ With libswcale :
> 
> VLC can't find the filter from "codec/ffmpeg/scale.c"  because the 
> object_name is "ffmpeg" and there is no "scale" shortcut defined.
> 
> But maybe this is intentional in order to disable the libswscale filter 
> for instance.
> 
> Anyway, I tried to load this filter after patching the code (adding a 
> "scale" shortcut).
> The module is found but It got a seg fault inside the sws_scale function 
> : (I checked with some flags)
> 
> "
> [00000620] stream_out_transcode generic debug: source 320x240, crop 
> 320x240, destination 320x240, padding 320x240
> [00000620] stream_out_transcode generic debug: encoder aspect is 
> 576000:432000
> [00000630] main encoder debug: looking for encoder module: 7 candidates
> [00000630] ffmpeg encoder debug: libavcodec already initialized
> [00000630] ffmpeg encoder debug: found encoder MPEG-4 Video
> [00000630] main encoder debug: using encoder module "ffmpeg"
> [00000626] main generic debug: adding a new input
> [00000626] mux_asf generic debug: adding input
> [00000631] main filter debug: looking for video filter2 module: 2 
> candidates
> [00000631] ffmpeg filter debug: 320x240 chroma: UYVY -> 320x240 chroma: 
> I420
> [00000631] main filter debug: using video filter2 module "ffmpeg"
> Segmentation fault
> "
> 
> I have not gone further with the libswscale filter and I tried with 
> ffmpeg built with "--disable-swscale"
> 
> 2\ Without libswscale
> 
> VLC can't find the filter from "video_filter/croppadd.c" beause the 
> object_name is "croppadd" (without space) and there is no "crop padd" 
> shortcut defined.
> VLC can't find the old ffmpeg filter from "codec/ffmpeg/ffmpeg.c"  
> because the capability is "crop padd" (not "video filter2") and 
> object_name is wrong too...
> 
> The filter from "video_filter/croppadd.c"" looks like useless for me 
> because  it requires identical input and output chroma formats, so 
> finally I patched the code to enable the loading of the old ffmpeg filter.
> 
> Here is my working patch.
> 
> Perhaps there is a better way with libswscale or a chroma filter but I 
> do not have insisted.
> 
> Lokidor.
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> http://mailman.videolan.org/listinfo/vlc-devel

-------------- next part --------------
A non-text attachment was scrubbed...
Name: transcode-fix.patch
Type: text/x-patch
Size: 3341 bytes
Desc: not available
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20080518/12240833/attachment.bin>


More information about the vlc-devel mailing list