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

lokidor lokidor at lokiserv.ath.cx
Wed May 14 23:03:54 CEST 2008


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.
>
> 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
> "
>
> 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...
>
> 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 ?
>
> 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.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: enable_use_of_ffmpeg_croppadd_filter.patch
Type: text/x-patch
Size: 1619 bytes
Desc: not available
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20080514/cc2aea5a/attachment.bin>


More information about the vlc-devel mailing list