[vlc-devel] [vlc] transcoding with different input and output chromas
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 a écrit :
>> 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
>> cvlc -vvv --color v4l2:///dev/video0:chroma="UYVY":width=320:height=240 \
>> --ttl 12 \
>> --sout-ffmpeg-hurry-up --ffmpeg-hurry-up --rt-priority
>> I get the following error :
>>  stream_out_transcode generic debug: source 320x240, crop
>> 320x240, destination 320x240, padding 320x240
>>  stream_out_transcode generic debug: encoder aspect is
>>  main encoder debug: looking for encoder module: 7 candidates
>>  ffmpeg encoder debug: libavcodec already initialized
>>  ffmpeg encoder debug: found encoder MPEG-4 Video
>>  main encoder debug: using encoder module "ffmpeg"
>>  main generic debug: adding a new input
>>  mux_asf generic debug: adding input
>>  main filter debug: looking for video filter2 module: 1
>>  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
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 :
>>  main filter debug: looking for video filter2 module: 0
>>  main filter error: no video filter2 module matched "crop padd"
>>  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
>> 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.
>> vlc mailing list
>> To unsubscribe or modify your subscription options:
> 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)
>  stream_out_transcode generic debug: source 320x240, crop
> 320x240, destination 320x240, padding 320x240
>  stream_out_transcode generic debug: encoder aspect is
>  main encoder debug: looking for encoder module: 7 candidates
>  ffmpeg encoder debug: libavcodec already initialized
>  ffmpeg encoder debug: found encoder MPEG-4 Video
>  main encoder debug: using encoder module "ffmpeg"
>  main generic debug: adding a new input
>  mux_asf generic debug: adding input
>  main filter debug: looking for video filter2 module: 2
>  ffmpeg filter debug: 320x240 chroma: UYVY -> 320x240 chroma:
>  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.
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 3341 bytes
Desc: not available
More information about the vlc-devel