Command line scripts and/or GUI Batch file conversions

Feature requests for VLC.
Trebly
Blank Cone
Blank Cone
Posts: 22
Joined: 20 May 2009 00:52

Command line scripts and/or GUI Batch file conversions

Postby Trebly » 06 Jun 2011 01:48

Hi,

Note : Some elements of topic have been partially treated previously

The problem and question can be formulated by the history of tries to find a solution in treating conversion of a lot of files (batch treatment by GUI or command line:
  • * I have into a subdir a group of file to convert (or any other treatment which can be done by GUI)
    * My aim is to get easily a command to make the conversion
    * if I load the files into the first conversion panel, If I submit "convert and save" I will get only on second panel the first file. So I have not other solution that to repeat the whole GUI command with six panels per file. If you got sixty little sequences you can program half of a day...
    * Then I think if I use the command line I will be able to write a script (cmd windows) to run in one click the whole treatments
    * I have to build a command line. So I try to find into the GUI the corresponding command line generated by the GUI, It don't exist fully.
    * I try to learn how to write the command line (simple convert an AVI file to H264_MP4 for example). Dead lock the best is to build a seminar... It is not so complicated but you need to spend one week and build a study document as when you learn a language or a quite sophisticated tool as Apache or Mysql servers
    * You can't avoid to think that you where near of the solution if you could use a pattern as destination for the treatment of the files of the first selection panel
    (for example <sourcedir>/filenames.AVI -> <destinationdir/*.mp4)
    * End of story.
    * VLC don't contain any useful tools to convert files repeatedly on a file list using the same parameters
Solutions ?, my proposals

1- With GUI Batch treatment of the list of selected files user the syntax : <sourcedir>/filenames.ext1 -> <destinationdir/*<Comp>.ext2. For each file in the list a corresponding filename "*" which will be ended <Comp>.ext2 where is any valid part of a file name. For this all the selected files must be into the same subdir.
2- A new command is "show corresponding command line". The text of the command line can be copied to generate scripts, and can be modified to add manually options that are not in GUI and can be executed. Command lines executed can be send to a log file.

best regards
trebly

VLC_help
Mega Cone Master
Mega Cone Master
Posts: 25661
Joined: 13 Sep 2006 14:16

Re: Command line scripts and/or GUI Batch file conversions

Postby VLC_help » 06 Jun 2011 17:17

You can use format strings if you want to batch process whole playlist.
http://wiki.videolan.org/Documentation: ... mat_String

Media -> Streaming... shows the command-line parameters in last page.

Trebly
Blank Cone
Blank Cone
Posts: 22
Joined: 20 May 2009 00:52

Re: Command line scripts and/or GUI Batch file conversions

Postby Trebly » 10 Jul 2011 19:52

Hi,

I go back to this subject (while, now I have near 250 files to convert) but with the information which you have given I am not still able to do the job :
1- I know how to build a string to give all parameters to Videolan to send conversion of file to new file but :
2- A still don't know which menu option to submit neither which field will contain these parameters. Media -> streaming (French menu option : "ouvrir un flux réseau" asks for an URL : dead line.

Thanks to tell me how to reach the field where I can put the "Format_string", and the way to reach the panel where I can define the conversion to apply and the Format-string. I have not found the way to do this, and be ready to run the batch by a "run" command.

Best regards

Trebly

VLC_help
Mega Cone Master
Mega Cone Master
Posts: 25661
Joined: 13 Sep 2006 14:16

Re: Command line scripts and/or GUI Batch file conversions

Postby VLC_help » 11 Jul 2011 15:33

It is the last page where you can edit the transcode command. So first you select the files, then you select streaming method, profile and then the last page should show it.

Trebly
Blank Cone
Blank Cone
Posts: 22
Joined: 20 May 2009 00:52

Re: Command line scripts and/or GUI Batch file conversions

Postby Trebly » 15 Jul 2011 21:54

Hi,

Sorry but this remains for me not usable, I have still not reached the end of the way.
You will find below all the step I met in my tests.
I have presented this as a draft for a tutorial (without screenshots).

The first group, the selection of a "filelist" to submit :
  • To select a group of files you need to use the advanced selection or you can only fill the list file by file, a full directory...,
  • In advanced selection you can select file or an *.xspf file (because you had to test and try a lot of times). Then you can "enqueue". This adds the files to the fileand when it's double clicked the content is loaded into playlist.
  • Then you have got a playlist. From this point the access to "streaming" by right click just selects the current file. If is is an xspf file it become the source, if it is a media, or several media files you will stream just the current pointed one. May be the solution is to use an xspf for a multiple selection
  • On main screen, with menu you submit "media" : "streaming". This command don't matters with the playlist. This leads you to the previous "advanced selection" and the *.xsps file is still there. You can then think that an xsps file can be held. Because, if not, you cannot use xspf file or stream the files coming from an xspf file.
  • Let's go with the xspf file.
  • At this time you have submitted "streaming" but there no next or last page to reach. You need to submit again "stream" on the advanced selection panel. let's go to the steps after launching "stream"
Second group : define all streaming parameters
  • this panel show the source and propose the command "Next" , below "destination" and "options" then "stream" or "Cancel.Let's think that you want not to "stream" immediately or "cancel" but define the "destination" (nothing shows that this lines "destination" and "options" are "command lines" and are "optional next steps".
  • Then you get a new panel which defines the stream destination which contains too the "transcoding options (with the well known transcoding setup, same as the one you can use for one lonely media in advanced selection panel)
  • you have there 8 choices of types destinations. You chose "file", the problem is that you want to mean "files" (the stream must create a file for each file defined in xspf file).
  • If you make the choice of "Add" (file(?s)) the panel says "This module writes the transcoded stream to a file". It is not what you want, then go back using the "red cross"
  • There is no way to define in "destination" separate files for each file source of the stream at this step. Let's go on.
  • You can specify the "transcoding options" . After do "next" or "options" it is the same. This is the "last page"
  • You have not any special field to specify the path and new files options contents
  • Then you get the "generated stream output string", you can still add some "automatic" options and after you can add manually others options.
  • Select "Stream all elementary Options". This seams obvious it add the parameter "sout-all"
  • At this step you have to add the parameters for "sout-all"
Third group : define the parameters for "sout-all" : definition of files to generate from "streaming"
For this you will refer to :
Documentation:Play HowTo/Format String - VideoLAN Wiki
http://wiki.videolan.org/Documentation: ... mat_String
This as recommanded.
  • I tried to find the way to define the streaming destination files with sout-all options into :
    Documentation:Streaming HowTo/Advanced Streaming Using the Command Line - VideoLAN Wiki
    http://wiki.videolan.org/Documentation: ... d_Line#sap
  • Though I found the way to define options of header (meta-data) into "format string", I still don't know,
  • and I have not found example on how to define the destination files :
    - path
    - name mask (from origin names, but with new extension for example)
End line, not found the way.

Best regards

Trebly

VLC_help
Mega Cone Master
Mega Cone Master
Posts: 25661
Joined: 13 Sep 2006 14:16

Re: Command line scripts and/or GUI Batch file conversions

Postby VLC_help » 16 Jul 2011 13:28

There isn't any easy mask option, you can use $F : full name with path and add another file extension to the end, but if you want better control, use .bat files, .sh scripts or similar.

Trebly
Blank Cone
Blank Cone
Posts: 22
Joined: 20 May 2009 00:52

Re: Command line scripts and/or GUI Batch file conversions

Postby Trebly » 21 Jul 2011 03:39

Hi,

Your answer is clear, and I imagine that can use others options of the format string to set meta data of the output files.

Nevertheless, probably because of my lack of experience in string command of VLC I still don't know exactly what to write :

The option command, is like :
":sout=#transcode{vcodec=h264,vb=0,scale=0,acodec=mp4a,ab=128,channels=2,samplerate=44100} :no-sout-rtp-sap :no-sout-standard-sap :sout-all :ttl=1 :sout-keep

I don't see the input definition (I imagine that it is not displayed in options) but no command listed in "string-command" concerned as defined begin of the doc page about "format string".

so I can imagine that #transcode is the command and I can write something like :
":sout=#transcode{vcodec=h264,vb=0,scale=0,acodec=mp4a,ab=128,channels=2,samplerate=44100},$F='F:\__S28-Data-Backups\B10708\AVI-conv-to-h264-by-VLC\*.mp4 ':no-sout-rtp-sap :no-sout-standard-sap :sout-all :ttl=1 :sout-keep
or
":sout=#transcode{vcodec=h264,vb=0,scale=0,acodec=mp4a,ab=128,channels=2,samplerate=44100}:$F='F:\__S28-Data-Backups\B10708\AVI-conv-to-h264-by-VLC\*.mp4' :no-sout-rtp-sap :no-sout-standard-sap :sout-all :ttl=1 :sout-keep

The *.mp4 that I wrote wants to mean "any of sout-all files input defined by the xspf file" will be written individually converted with "mp4" file extension into the path defined
But this makes nothing.
May be "":sout=#transcode{vcodec=h264,vb=0,scale=0,acodec=mp4a,ab=128,channels=2,samplerate=44100} : ????,$F='F:\__S28-Data-Backups\B10708\AVI-conv-to-h264-by-VLC\*.mp4' :no-sout-rtp-sap :no-sout-standard-sap :sout-all :ttl=1 :sout-keep
where ???? is a command but which one ?

I have searched one hour into documentation about string commands, but I have not found any use of $F in another place than setting meta-data.

So I would want to know if the file *.xspf are supported with the stream with GUI.

I have not found any information that could let me imagine that xspf file are hold by command line to define an input list of files.

Then depending of your answer I will leave the GUI to command line and command files or farther to a web application written with php using xspf files.
I found the example of a script command to treat all files of a dir.
Then with sufficient place, it is possible to put into a temporary directory all the file to treat or repeat the treatment for a list of dirs with various output dirs;
This is surely without limit, but take time.

The capability to read a xspf file for list of input and then apply the #trancode parameters generated by the GUI to end with a file into a specified dir should be simple and easy.

It is sure that because xspf can define various sources it can be difficult to write something like :
for %%a in (*.mp3) do cmd /c "C:\Programme\VideoLAN\VLC\vlc.exe" -I dummy -vvv %%a --sout #transcode{acodec=s16l,channels=2,samplerate=44100}:standard{access=file,mux=wav,dst=g:\_audio_conv\%%a.wav} vlc://quit
as
for %%a in (my_playlist.xspf) do cmd /c "C:\Programme\VideoLAN\VLC\vlc.exe" -I dummy -vvv %%a --sout #transcode{acodec=s16l,channels=2,samplerate=44100}:standard{access=file,mux=wav,dst=g:\_audio_conv\%%a.wav} vlc://quit

This is the challenge.

If I would want to integrate commands into js file into XHTML file generated by php, is it an existing plugin to install on the client computer ?

Here are many question which makes a loop to my first questions and proposals.
I will choice the good way depending of your answers.
Thanks
Best regards

Trebly

VLC_help
Mega Cone Master
Mega Cone Master
Posts: 25661
Joined: 13 Sep 2006 14:16

Re: Command line scripts and/or GUI Batch file conversions

Postby VLC_help » 21 Jul 2011 19:33

1. You can remove :no-sout-rtp-sap :no-sout-standard-sap :sout-all :ttl=1 :sout-keep, those aren't needed.
2. You define input as VLC parameter, not as transcode parameter, so e.g
vlc input.avi :sout=#transcode{vcodec=h264,vb=0,scale=0,acodec=mp4a,ab=128,channels=2,samplerate=44100}:standard{access=file,mux=mp4,dst=output.mp4}
3. Something like $F='F:\__S28-Data-Backups\B10708\AVI-conv-to-h264-by-VLC\*.mp4' won't work. $F is already defined and you cannot define variables like that in VLC.

Trebly
Blank Cone
Blank Cone
Posts: 22
Joined: 20 May 2009 00:52

Re: Command line scripts and/or GUI Batch file conversions

Postby Trebly » 22 Jul 2011 14:43

Hi,

Still some questions because, running on the thread I feel apparent contradictions.
This I believe that his comes comes from the fact that into the last message I give example of two type of strings :
  • Options string of the last page of the GUI stream definition
  • Line commands

About the options :
  • You tell me
    ":no-sout-rtp-sap :no-sout-standard-sap :sout-all :ttl=1 :sout-keep", those aren't needed.
    So I suppose that the options generator creates this by default but it is not useful
  • You tell me
    You define input as VLC parameter, not as transcode parameter, so e.g
    vlc input.avi :sout=#transcode{vcodec=h264,vb=0,scale=0,acodec=mp4a,ab=128,channels=2,samplerate=44100}:standard{access=file,mux=mp4,dst=output.mp4}
    This line looks like a simplified command line not an option string. My question was about the options strings with the use of $F parameter.
  • You told me into a previous message :
    There isn't any easy mask option, you can use $F : full name with path and add another file extension to the end, but if you want better control, use .bat files, .sh scripts or similar.
    and now, when I try to find a way to use $F parameter and check the syntax (referring to http://wiki.videolan.org/Documentation: ... mat_String) I propose (to be unconfirmed, but where ?)
    The option command, is (like=the generated option command by VLC GUI) :
    ":sout=#transcode{vcodec=h264,vb=0,scale=0,acodec=mp4a,ab=128,channels=2,samplerate=44100} :no-sout-rtp-sap :no-sout-standard-sap :sout-all :ttl=1 :sout-keep

    I don't see the input definition (I imagine that it is not displayed in options) but no command listed in "string-command" concerned as defined begin of the doc page about "format string".

    so I can imagine that #transcode is the command and I can write something like :
    ":sout=#transcode{vcodec=h264,vb=0,scale=0,acodec=mp4a,ab=128,channels=2,samplerate=44100},$F='F:\__S28-Data-Backups\B10708\AVI-conv-to-h264-by-VLC\*.mp4 ':no-sout-rtp-sap :no-sout-standard-sap :sout-all :ttl=1 :sout-keep
    or
    ":sout=#transcode{vcodec=h264,vb=0,scale=0,acodec=mp4a,ab=128,channels=2,samplerate=44100}:$F='F:\__S28-Data-Backups\B10708\AVI-conv-to-h264-by-VLC\*.mp4' :no-sout-rtp-sap :no-sout-standard-sap :sout-all :ttl=1 :sout-keep

    The *.mp4 that I wrote wants to mean "any of sout-all files input defined by the xspf file" will be written individually converted with "mp4" file extension into the path defined
    But this makes nothing.
    May be "":sout=#transcode{vcodec=h264,vb=0,scale=0,acodec=mp4a,ab=128,channels=2,samplerate=44100} : ????,$F='F:\__S28-Data-Backups\B10708\AVI-conv-to-h264-by-VLC\*.mp4' :no-sout-rtp-sap :no-sout-standard-sap :sout-all :ttl=1 :sout-keep
    where ???? is a command but which one ?
    Yoy answers :
    Something like $F='F:\__S28-Data-Backups\B10708\AVI-conv-to-h264-by-VLC\*.mp4' won't work. $F is already defined and you cannot define variables like that in VLC.
So I don't understand anymore, anything : It was just trying to find a way to get from you good samples of the use of "$F" as you have proposed, but you answer :
vlc input.avi :sout=#transcode{vcodec=h264,vb=0,scale=0,acodec=mp4a,ab=128,channels=2,samplerate=44100}:standard{access=file,mux=mp4,dst=output.mp4}
seems to me a simplified sample of command line when I propose a batch script command (on the VLC site "command lines", without taking care of transcode parameter which are out of subject) :
for %%a in (my_playlist.xspf) do cmd /c
"C:\Programme\VideoLAN\VLC\vlc.exe" -I dummy -vvv %%a --sout #transcode{acodec=s16l,channels=2,samplerate=44100}:standard{access=file,mux=wav,dst=g:\_audio_conv\%%a.wav}
vlc://quit
It seems that "input.avi" and "output.mp4" is a sample of files names (input file list and one output file, the reason of the "for" of the script) not parameters. So the command line that I give is a sample of line command but don't contents the good transcode parameter, which don't matters.
The matter was the batch command and a question about the capability of VLC to treat as input xspf files. This seems for the moment impossible, every sample shows that VLC is designed to broadcast, stream n files -> output (which can be any destination and as part of, one unique file).
So If we want to trat several fule and get transcode each one separately we need to repeat manually or use scripting.
Another way could be that the xspf file could content the output file name (or destination) then the batch could become an internal function of VLC.

Your sample give for one file for one file the transcode parameters which I know since the beginning of this thread and are not the subject :
- how can we use the GUI to make a batch treatment of files with the same transcode parameters which produce at the end a file for each file defined into a playlist -with any available restrictions

When at the end I imagine that it is impossible, I ask for the use of xspf file. I had, till now, no answer and I could not find into documentation synthetic information about use of xspf files. I imagine that xspf file are just available to generate a file list into main playlist panel, because it seems without use into extended playlist and for all the functions which uses this extended definition panel. The lonely use seems to "queue" the xspf defined files which are loaded into play list which can be only played to current output device but not converted or streamed.

Be sure that I understand that the whole features and capabilities of VLC are very extended. This leads to complex syntax of command lines. The GUI make this more easy to use in cas we don't need to use sophisticated commands (no time to write or to learn).
One of the current needs is not only to build and play list of file with a "playlist" which can be saved as xspf file (XML), but too, to convert file format and get the result into new file. For the moment I don't got the answer "it is" or "it is not possible " or "it will be" or "it should be" or "we would it should be" or "we are going in a future version that this function will be easy to execute with the GUI".
99% of the job is made by the GUI but at the end it seems that :
  • The playlist can't be used for transcoding the group, only file per file selected
  • xspf files seems can be used only to load a playlist
  • to defined any batch treatment either than playing on current display device, we need to use scripts (the GUI helps to build the parameter for transcoding, if we go to the last screen of stream and forget others options parameters.
  • The GUI can be used to treat a playlist (which can't be saved as xspf : no sample found) but the output is only one cumulative stream - can have any destination)
Best regards

Trebly

Note : more your answers are short more they are implying "opened questions", more my answers are long and full of new questions. We invent an 'H' bomb.
So please tell me were I am wrong, this will be obviously useful too for others users (and not false information provided by this forum).
For my first question opened in this thread, I just will write scripts using the help of the options field displayed at the end of the "streaming" command.

VLC_help
Mega Cone Master
Mega Cone Master
Posts: 25661
Joined: 13 Sep 2006 14:16

Re: Command line scripts and/or GUI Batch file conversions

Postby VLC_help » 22 Jul 2011 20:50

If you want to use $F, then it something like

Code: Select all

vlc input.avi :sout=#transcode{vcodec=h264,acodec=mp4a,ab=128,channels=2,samplerate=44100}:file{dst=$F.mp4}
but it seems $F is broken under Win32.

Trebly
Blank Cone
Blank Cone
Posts: 22
Joined: 20 May 2009 00:52

Re: Command line scripts and/or GUI Batch file conversions

Postby Trebly » 24 Jul 2011 04:49

Hi,

Sorry but you have quite never answer to my questions.

You say :
If you want to use $F, then it something like ...
and ...
but it seems $F is broken under Win32.
I just ask how to use because you have said before :
Post by VLC_help » Sat Jul 16, 2011 1:28 pm
There isn't any easy mask option, you can use $F : full name with path and add another file extension to the end, but if you want better control, use .bat files, .sh scripts or similar.
I have asked :
So please tell me where I am wrong, this will be obviously useful too for others users (and not false information provided by this forum).
For my first question opened in this thread, I just was willing to understand and teach to somebody how to use VLC GUI to transcode by batch several file as they are stored in playlist and farther save into xspf files (XML).
If this could not be done I would have to write windows scripts.
You have not answered at all.

Finally I have understood :
  • VLC GUI is not able to generate transcoding for several files separately
  • VLC GUI is not able to manage xspf file to generate a streaming (we need to generate the list from extended generation of list of files which don't supports xspf files. This because I ask this and you have not answered, so I suppose that the answer is "NO".
  • xspf files are only useful for generate and save playlist to current display (no stream). This because I ask this and you have not answered, so I suppose that the answer is "NO".
  • To generate transcoding for more than one file we need to write and launch a script using a command like :
    (in the example convert AVI files (generated a samsung S28) and stored into a dir to, H264 + MP4 and put the results to a new dir as *.mp4 files)
    Windows scripting :

    Code: Select all

    ... for %%a in (X:\my_playlist-input\*.AVI) do cmd /c "C:\Programme\VideoLAN\VLC\vlc -I dummy -vvv %%a --sout #transcode{vcodec=h264,acodec=mp4a,ab=128,channels=2,samplerate=44100}:file{dst=X:\my_playlist-output\%%a.mp4} "C:\Programme\VideoLAN\VLC\vlc://quit
  • To be help in writing VLC parameters for transcoding and not to have to study in details the syntax, I can using the help of the options field displayed at the end of the "streaming" command.
    ...
This can be done for (tested):
- AVI (S28) to MP4 (H264+MP4a)
- MPEG2 (TNT) to MP4 (H264+MP4a)
- not for files generated by Nokia N95 (MP4) to MPEG2 to view on storage for TNT decoder (encryption MPEG2 available but not MP4 - no HD) - Bug
- test to do : AVI to MPEG2 (for TNT decoder storage)

Finally, I have understood the job that is to be done and I have a measure of the time to spend to do the full job of transcoding files contained in various directories and generate the output as new files transcoded.
This will be my report about this very accurate and limited aim to reach.

I am not at all an expert in using VLC (to many other things to do, and no time to study) but I was thinking that this could be done more easily.
I need a lot of time to get at the end some tiny answers.

Best regards

Trebly

muchado
New Cone
New Cone
Posts: 3
Joined: 15 Sep 2014 05:44

Re: Command line scripts and/or GUI Batch file conversions

Postby muchado » 15 Sep 2014 06:14

I would like to second the identification of an issue posted by the original poster:
The problem and question can be formulated by the history of tries to find a solution in treating conversion of a lot of files (batch treatment by GUI or command line:
* I have into a subdir a group of file to convert (or any other treatment which can be done by GUI)
* My aim is to get easily a command to make the conversion
* if I load the files into the first conversion panel, If I submit "convert and save" I will get only on second panel the first file. So I have not other solution that to repeat the whole GUI command with six panels per file. If you got sixty little sequences you can program half of a day...
I also have a list of files that I wish to convert. The first dialog allows me to create a list, but the second dialog does not provide any way of specifying a filename conversion or a default conversion (replacement of MOV with MP4, for example). I know that one can do this conversion by means of a script, but I am not confident that I will get it right, and I am sure that other people would like to be able to do this sort of batch conversion as well. My example is that we have a lot of movie files that we created from analyses ten years ago that are in MOV format and many computers don't have the codecs to play them. I don't really want to sit down to convert them one by one and I don't have confidence in my scripting skills. If someone who has the source code and the knowledge to add to it could add a batch conversion option, then that would be really appreciated </grovel>.

(... hmm - can't see how to upload an image file of the dialog... sorry... <Media | Convert/Save>)
VLN 2.1.5 on Win7

muchado
New Cone
New Cone
Posts: 3
Joined: 15 Sep 2014 05:44

Re: Command line scripts and/or GUI Batch file conversions

Postby muchado » 15 Sep 2014 06:17

[img]file:///D:/delme/VLC_Batch_Option.PNG[/img]


Return to “VLC media player Feature Requests”

Who is online

Users browsing this forum: No registered users and 3 guests