Page 1 of 1

Transcoding to file don't closes file and waits for playing

Posted: 03 Jan 2012 03:29
by Trebly
Hi,

ERRATA it is a good example of an error in batch definition, but not completely solved, the main problem comes from the position of quotes in the batch which cuts the "VLC://quit" so it is not executed: see the answer.


Nevertheless the files seems not well closed, the stream by WMP, on a system using the mp4 files generated, generates an error at the end "bad encoding" which stops the sequence, this with the parameters given here.

It is the reason why I don't delete the thread.

I first post a detailed item with trace :96587 viewtopic.php?f=2&t=96587, till now without any answer.
I suppose that the formulation is too long and complex.

]Here is a focused summary[/color]

First of all, if I post here it is because :
  • the problem encountered seems not localized as depending of the system used but on treatment of video files (all coming from same source)
  • After seeking to most of post (keywords : < batch, transcoding, file >) I don't found any answer
Phenomenon :
A batch (windows) contains the commands :
  • For memory and context description : A complex batch to make a lot of transcoding which determine 3 parameter %1=inputfile %2=output file %3=tracefile if VLC sends error to stdoutput. This batch repeats for all occurrences of files names some batch whith same traetment parameters using the list of files contained in file temp.dir. These parameters are submitted to the Sub-conv-exe-test_05.cmd :

    Code: Select all

    for /F "usebackq" %%f in (temp.dir) do (call E:\cmdfiles\Sub-conv-exe-test_05.cmd "%%f" "%var1%\%%~nf%fext1%.mp4" "%logf1%")
  • Files input are AVI file coming from a Samsung S28
    The sub contains the vlc command : purpose generate a transcoded file, then close the file and quit VLC :

    Code: Select all

    C:\Progra~2\VideoLAN\VLC\vlc.exe -I dummy -vvv %1 --sout "#transcode{vcodec=h264,vb=0,scale=0,acodec=mp4a,ab=128,channels=2,samplerate=44100}:file{dst=%~2} VLC://quit " >> %3
The transcoding stop at the end of the file, saying "nothing to display, as if was waiting a command to play something while the parameters seems to say "output to file" then close and quit VLC.
May be I have not seen additional parameters to say "close the file, and don't play anything", job is ended; but I have not found examples with such commands.

The trace display into the text window "-I dummy", the trace is reported in notes in item 96587.

Thanks I you notice an error of parameters to obtain the purpose : generate the transcoded file, close it and go to next job (is it well done but not closed, and the job don't stop to chain with another treatment, the file closed by job cancel or quit manually are not available for all streaming - locks the chains)

Best regards

Trebly

Re: Transcoding to file don't closes file and waits for play

Posted: 03 Jan 2012 11:17
by Jean-Baptiste Kempf
Your quotes are misplaced.

Re: Transcoding to file don't closes file and waits for play

Posted: 06 Jan 2012 03:56
by Trebly
Hi,

Thanks for the answer, I had solved just before myself, after reading more about the VLC batch process.

Nevertheless the files seems not well closed, the stream by WMP, on a system using the mp4 files generated, which generates an error at the end of the display by network to a "Free player" with Upnp, bad encoding" which stops the sequence, this with the parameters given here.

It is the first reason why I don't delete the thread, the second is because my error can be done by somebody else and this example can help.

So I give here some complements and the right syntax.

I first post a detailed item with trace :96587 viewtopic.php?f=2&t=96587, till now without any answer.
I suppose that the formulation is too long and complex.

Here is a focused summary of 96587

Files input are AVI file coming from a Samsung S28

The right syntax is :
The sub contains the vlc command which generates a transcoded file, then closes the file and quits VLC (to get the --sout syntax for not current users, use into the GUI of VLC with the Streaming command, not "transcode file", and follow all the steps, at the end you will get a panel which will contain the --sout right syntax - defined with the GUI -, and then, because it is in an editing box, copy it to your batch), you will get such a command :

Code: Select all

<your path>\vlc.exe -I dummy -vvv %1 --sout"#transcode{vcodec=h264,vb=0,scale=0,acodec=mp4a,ab=128,channels=2,samplerate=44100}:file{dst=%~2}" VLC://quit >> %3
%1 is the input filename %2 is the dst filename, %3 a log file.

The transcoding first receives the --sout parameters and the ".." avoids any error which will be generated if a blank character appears in the dst file name, then the transcoding is submitted. After VLC reads the command "QUIT" and goes back to the batch to treat the next file.


Useful Remarks

Note the use of the DOS filter with the %2 (%~2) parameter which will unquote the file name got from the main batch process with the quotes (no effect if the filename is sent without quotes, but as you will send with the quotes to protect against blanks, if the quotes remains the command line interpreter will crash stopping the parameter at the beginning of the filename). The %1 is as red to protect blanks.

The %3 destination for standard output has normally no effect because VLC don't writes his errors on standard output. It is just a standard way to write batches.

The trace display into the text window "-I dummy" textbox. If "-I qt" is used you can follow all the process : in the queue you will see the filename which is being transcoded and on the second line the command "QUIT". The VLC "qt" view shows the progress bar and the resulting duration. You can use the "show" menu to reduce the window.

If you organize your batch in such a way that several --sout are issued before the quit command the treatment will be chained. The lonely problem is the length of the whole command of which limit seems not fixed on windows (it seems 32Ko for all command buffer and environment data in *.cmd or ? *.bat). For a few number of file it is a suitable solution but to build the VLC command it is quite complicated. Then the use of vbs or any other scripting is a more accurate choice than cmd files.

Best regards

Trebly