using transcode module

This forum is about all development around libVLC.
zizou
New Cone
New Cone
Posts: 7
Joined: 31 Dec 2009 12:26

using transcode module

Postby zizou » 04 Jan 2010 23:07

Hi,
I'm programming an application using libVLC to transcode an file .
I find that I can use transcode module :

I use it like that in my programm but it doesn't work :

Code: Select all

input_file = "C:\Users\Alex\Videos\cat.wmv"; my_option1= "--sout-ffmpeg-qscale 1 "; my_option2 = "#transcode{vcodec=WMV2,scale=1,acodec=wma,ab=96,channels=2,samplerate=44100}:duplicate{dst=std{access=input_file,mux=asf,dst=C:\Users\Alex\Videos\new.avi}}"; my_option3 = "--ignore-config"; vlc_argv[0]=(char *)my_option1; vlc_argv[1]=(char *)my_option2; vlc_argv[2]=(char *)my_option3; // initialize an exception structure libvlc_exception_init(&m_libvlc_exception); // init vlc modules m_plibvlc= libvlc_new(vlc_argc,vlc_argv,&m_libvlc_exception);
I don't know how I can use the transcode module?
It's the only way to transcode a file using LibVLC ?
thankx

zizou
New Cone
New Cone
Posts: 7
Joined: 31 Dec 2009 12:26

Re: using transcode module

Postby zizou » 08 Jan 2010 14:51

Any suggestion please !!!

matkas
New Cone
New Cone
Posts: 3
Joined: 26 Jan 2010 23:07
Contact:

Re: using transcode module

Postby matkas » 27 Jan 2010 17:36

Hi All,

i have the same problem. Does anyone already found a solution for this?

Best

sleep
New Cone
New Cone
Posts: 2
Joined: 04 Nov 2009 10:22

Re: using transcode module

Postby sleep » 29 Jan 2010 10:27

Have you already verified your parameters with vlc.exe by passing them as command line arguments?
For example I use these parameters to encode an input file to a MPEG-2 Transport Stream File:

vlc.exe -I dummy „input.avi“ --sout=#transcode{vcodec=mp2v,vb=10240,vt=0,acodec=mpga} :standard{access=file,mux=ts,dst=“output.ts“}

If you want to the library, only use --sout=#transcode{vcodec=mp2v,vb=10240,vt=0,acodec=mpga} :standard{access=file,mux=ts,dst=“output.ts“}

matkas
New Cone
New Cone
Posts: 3
Joined: 26 Jan 2010 23:07
Contact:

Re: using transcode module

Postby matkas » 01 Feb 2010 21:38

Hi,
e.g. I tried following on the command line and it worked fine:

Code: Select all

vlc -vvv screen:// --sout='#transcode{vcodec=mjpg,vb=1200,fps=1,vfilter=canvas{width=640,height=480}}:standard{access=http{mime=multipart/x-mixed-replace;boundary=--7b3cc56e5f51db803f790dad720ed50a},mux=mpjpeg,dst=127.0.0.1:11111/stream.mjpg}'
so I tried following in a java application

Code: Select all

String[] argv = { "--plugin-path=/opt/vlc-git-2009-01-20/modules", // "-I dummy", "-vvv", "screen://", "--sout='#transcode{vcodec=mjpg,vb=1200,fps=1,vfilter=canvas{width=640,height=480}}:standard{access=http{mime=multipart/x-mixed-replace;boundary=--7b3cc56e5f51db803f790dad720ed50a},mux=mpjpeg,dst=127.0.0.1:11111/stream.mjpg}'" }; JVLC jvlc = new JVLC(argv); jvlc.getVLM().setMux("test", "mpjpeg"); MediaDescriptor mediaDescriptor = new MediaDescriptor(jvlc, "screen://"); MediaPlayer mediaPlayer = mediaDescriptor.getMediaPlayer(); mediaPlayer.play(); while (!mediaPlayer.hasVideoOutput()) { try { Thread.sleep(100); } catch (InterruptedException e) { e.printStackTrace(); } } while (mediaPlayer.isPlaying()) { }
but I am just getting:

Code: Select all

[0x1006a2f40] main playlist debug: adding item `screen://' ( screen:// ) [0x100605a00] main libvlc debug: creating VLM [0x1006a7860] main input debug: Creating an input for 'screen://' [0x1006a7860] main input debug: thread started [0x1006ad060] main stream output debug: using sout chain=`standard{mux="",access="'#transcode{vcodec=mjpg,vb=1200,fps=1,vfilter=canvas{width=640,height=480}}",dst="standard{access=http{mime=multipart/x-mixed-replace;boundary=--7b3cc56e5f51db803f790dad720ed50a},mux=mpjpeg,dst=127.0.0.1:11111/stream.mjpg}'"}' [0x1006ad060] main stream output debug: stream=`standard' [0x1006ad410] main stream out debug: looking for sout stream module: 1 candidate [0x1006ad410] main stream out warning: missing value for option mux [0x1006ad410] main stream out debug: set config option: sout-standard-access to '#transcode{vcodec=mjpg,vb=1200,fps=1,vfilter=canvas{width=640,height=480}} [0x1006ad410] main stream out debug: set config option: sout-standard-dst to standard{access=http{mime=multipart/x-mixed-replace;boundary=--7b3cc56e5f51db803f790dad720ed50a},mux=mpjpeg,dst=127.0.0.1:11111/stream.mjpg}' [0x1006ad410] stream_out_standard stream out debug: creating `'#transcode{vcodec=mjpg,vb=1200,fps=1,vfilter=canvas{width=640,height=480}}/(null)://standard{access=http{mime=multipart/x-mixed-replace;boundary=--7b3cc56e5f51db803f790dad720ed50a},mux=mpjpeg,dst=127.0.0.1:11111/stream.mjpg}'' [0x1006ad410] stream_out_standard stream out debug: extension is mjpg}' [0x1006ad410] stream_out_standard stream out debug: extension -> mux=(null) [0x1006ad410] stream_out_standard stream out error: no mux specified or found by extension [0x1006ad410] main stream out warning: no sout stream module matching "standard" could be loaded [0x1006ad410] main stream out debug: TIMER module_need() : 3.626 ms - Total 3.626 ms / 1 intvls (Avg 3.626 ms) [0x1006ad410] main stream out debug: destroying chain... (name=(null)) [0x1006ad410] main stream out debug: destroying chain done [0x1006ad060] main stream output error: stream chain failed for `standard{mux="",access="'#transcode{vcodec=mjpg,vb=1200,fps=1,vfilter=canvas{width=640,height=480}}",dst="standard{access=http{mime=multipart/x-mixed-replace;boundary=--7b3cc56e5f51db803f790dad720ed50a},mux=mpjpeg,dst=127.0.0.1:11111/stream.mjpg}'"}' [0x1006a7860] main input debug: thread (input) created at priority 22 (input/input.c:215) [0x1006a7860] main input error: cannot start stream output instance, aborting [0x1006a7860] main input debug: thread ended
I do not get an output stream, when starting the java application.

Any ideas?

Mathias

chrestomanci
New Cone
New Cone
Posts: 2
Joined: 15 Jul 2010 14:22

Re: using transcode module

Postby chrestomanci » 15 Jul 2010 14:30

I have been seeing a similar problem, except I am using a perl script to wrapper vlc. (to capture output etc).

The symptoms I was seeing, is that if I ran the vlc cmd line directly, it would work fine, but if I ran it via my script, it would not work and I got this in the log output:

Code: Select all

main stream output debug: using sout chain=`standard{mux="",access="'...
Where my --sout command line argument had had standard{mux="",access=" prefixed on the front.

After a lot of trial and error, I found that the cause was that I had redirected /dev/null to stdin of vlc, which it does not like, it appears to want it's stdin to be connected to a terminal.

chrestomanci
New Cone
New Cone
Posts: 2
Joined: 15 Jul 2010 14:22

Re: using transcode module

Postby chrestomanci » 09 Aug 2010 11:18

Another gotcha I have come across is having the sout argument wrapped in single quotes so that vlc sees those quotes:

Wrong:

Code: Select all

DB<3> x @cmd_line 0 'cvlc' 1 'http://localhost:8000/4164' 2 'vlc://quit' 3 '--sout' 4 '\'#transcode{venc=x264{keyint=60,aud,profile=baseline, ...
Correct:

Code: Select all

DB<7> x @cmd_line 0 'cvlc' 1 'http://localhost:8000/4164' 2 'vlc://quit' 3 '--sout' 4 '#transcode{venc=x264{keyint=60,aud,profile=baseline ...
When you invoke vlc from a unix shell, then the single quotes are needed to protect all the special characters in the --sout command line from the shell.

If you invoke vlc as a sub process of another program or scripting environment such as perl then in some situations the shell is bypassed and vlc is invoked directly. In those situations you should not be wrapping arguments in quotes as vlc won't like them. In other situations the program will invoke the shell as an intermediate step and in those situations you will need to protect arguments with quotes.

You should check the docs for the programing language or calling program you are using.

If you are programing in perl, then the short answer is that if you pass a single string to system, exec or any of the library routines under IPC::*, then perl will pass that string to the shell for processing, but if you pass an array to those routines, then perl will assume that the first element in the array is the program name, and subsequent elements are the arguments. It will not involve the shell, and will start he program directly.

A further complication to be aware of is the quoting and escaping rules for the language you are using, your editor and your debugger. The string you type may not match the string that is stored internally or what you see in trace output from your debugger, but if you have followed me so far, then this part should be easy.


Return to “Development around libVLC”

Who is online

Users browsing this forum: No registered users and 8 guests