Save playlist FLV streams, command line

Microsoft Windows specific usage questions
Forum rules
Please post only Windows specific questions in this forum category. If you don't know where to post, please read the different forums' rules. Thanks.
nanomir
Blank Cone
Blank Cone
Posts: 22
Joined: 09 Jun 2007 09:27

Save playlist FLV streams, command line

Postby nanomir » 09 Jun 2007 09:50

Greetings ladies and gentlemen,


Since I have a poor internet connection, my prefferred way of watching online FLV video fullscreen is to use VLC to stream it to disk, and then use another player to view the unfinished streams fullscreen (since VLC I have, 0.8.6b, starts playing FLV streams fine, but once it ends up having to wait for a segment, it freezes :( )

To ease the process, I like to save a command line in a bat file, and edit the URLs in it, and then just run everything from a command line. For a single stream/file, the following command works for me:

Code: Select all

"C:\Program Files\VideoLAN\VLC\vlc.exe" --no-play-and-stop http://www...... :demux=dump :demuxdump-file="C:\VID\myfile.flv" vlc:quit
If I run the batch file with this command, VLC starts streaming to a flv file, I wait some 10 seconds, then start watching the flv, all good. Note that for some reason, if you do not incldue "--no-play-and-stop" VLC will start up, but it will not start streaming. By including "vlc:quit" on the end, you force the player to end, so you can copy several of these commands in a bat file, and have unique URLs be copied to unique file names - as in a playslist.

Although great for single file, it is still a bit too much typing if it is for several streams :), so I'd like to have it easier, and I'm wandering if it is possible. I so tried this command line:

Code: Select all

"C:\Program Files\VideoLAN\VLC\vlc.exe" --no-play-and-stop http://www1.... http://www2..... http://www3..... --demux=dump --demuxdump-file="C:\VID\myfile.flv" --demuxdump-append vlc:quit
This command will queue all the URLs in the plalist, and will start streaming - however, each time a stream ends and a new one starts, obviously myfile.flv is overwritten. I hoped then, if I remove the demuxdump-file argument, I would cause auto naming - but, I get a file called "stream-demux.dump" with the exact same behaviour as before (maybe if the streams ended with *.flv those names would have been used, but the streams don't end like that) So first question is - is there a possibility for auto naming?

Ideally, I'd like these streams all appended to a single file, so I tried

Code: Select all

"C:\Program Files\VideoLAN\VLC\vlc.exe" --no-play-and-stop http://www1.... http://www2..... http://www3..... --demux=dump --demuxdump-file="C:\VID\myfile.flv" --demuxdump-append vlc:quit
But, although the streams are indeed appended (on disk), only the first stream is played back... So, another question is, is there a way to do this, so all appended streams play? Must it necesarilly involve transcoding? If so, what would a command line be like?

I've seen these answers from before:
viewtopic.php?t=37653
VLC has no means (ATM) to create a new file name for the new incoming file. Appending the new file won't work as most containers will play only the first file saved. Try the features request section of the forum. An auto naming convention would be a logical solution.
viewtopic.php?t=36151
Transcoding, copying or dumping info is done one file at a time naming each file individually.
so I'm guessing that probably what I'm asking for is not implemented (yet), but I'd really appreciate an answer/confirmation..

Thanks

DJ
Cone Master
Cone Master
Posts: 8206
Joined: 01 Jan 2006 04:30
Location: Koloa, Hawaii USA

Postby DJ » 09 Jun 2007 12:03

It's been said many times in many ways. VLC does NOT do batch encoding well at all. Appending files should only be attempted through an editor where each file begins and ends on a keyframe. In mane editors this also assumes that the formats and container are always the same.

nanomir
Blank Cone
Blank Cone
Posts: 22
Joined: 09 Jun 2007 09:27

Re: Save playlist FLV streams, command line

Postby nanomir » 23 Jul 2007 19:05

Hi, thanks for the reply !!! I am a bit late to answer, but:
VLC does NOT do batch encoding well at all
Well, I guess I did not make myself clear - I did not necesarilly want batch encoding, simply a batch download... Somthing of a YouTube playlist, avoiding the browser.,.. Why I like VLC's download is that it makes a visible file as soon as download has started, so one can open that very file and view the contents downloaded up to that point..

Well, in any case, I solved my problem by making a small AJAX script in a HTML page - the idea is to enter plain youtube and the like permalinks, and the script will ask online what the proper flv url is, and compose the proper VLC command; execute several of these and you get a text, which can then be copypasted in a text file, and renamed as .bat. Then, as this bat is executed, VLC will download all listed flv's one by one... Here is the code (note you may have to give permissions to the script to execute):

GetCommand.htm

Code: Select all

<!-- saved from url=(0023)http://www.contoso.com/ --> <HTML> <HEAD> <TITLE>Get Command</TITLE> <script src="GetCommand.js"></script> </HEAD> <BODY onLoad="startit()"> <form name="Form1"> <P>Enter URL: <INPUT id=vidPgUrl style="WIDTH: 476px; HEIGHT: 22px" size=60 onClick="this.value=''"></P> <P><INPUT id=getCmdBtn type=button value="Add URL as command" onClick="fetchUrlCommand()"></P> <P>VLC location: <INPUT id=vlcLoc style="WIDTH: 431px; HEIGHT: 22px" size=54 value="C:\Program Files\VideoLAN\VLC\vlc.exe"></P> <P>Saved stream folder: <INPUT id=outLoc style="WIDTH: 431px; HEIGHT: 22px" size=54 value="O:\VID\"></P> <P> <HR> <P></P> <P> Command list:</P> <P><TEXTAREA id=cmdTA style="WIDTH: 800px; HEIGHT: 239px" rows=9 cols=79></TEXTAREA></P> <P><div id=conninfo></div> <P></P> </form> </BODY> </HTML>
GetCommand.js

Code: Select all

/* based on AJAX Chat Client - Kevin Mesiab */ // Global variables // var isFirefox; var isIE; var timeout; var pingtimeout; var pingsent = 0; var requestsent = 0; var postsent = 0; var chatsent = 0 var pingRate = 1000 * 60; // one minute // one second - too low for online, so 2 // with the proxy even that too fast, try 4 var refreshRate = 4000; var rnd = Math.random(); // random seed var noanswercount = 0; var targetURL = 'passproxy.aspx'; var pgtitle = ""; var realURL = ""; var parseURL = "http://megaupload.net/keepvid.php"; // // Get an XMLHttpRequest object // function getAjax() { if ( isFirefox ) { return new XMLHttpRequest(); } else if ( isIE ) { try { return new ActiveXObject( "Msxml2.XMLHTTP" ); } catch( ex ) { return new ActiveXObject( "Microsoft.XMLHTTP" ); } } } // // Get a DOM element // function getElement( id ) { if( isIE ) { return document.all[ id ]; } if( isFirefox ) { return document.getElementById( id ); } } // // Get browser type // function sniff() { var ff = "Netscape"; var ie = "Microsoft Internet Explorer"; isFirefox = ( navigator.appName == ff ); isIE = (navigator.appName == ie ); } // // Get the command for a given URL // function fetchUrlCommand() { //first call URL directly, to retrieve the title var videoURL = document.Form1.vidPgUrl.value; req = getAjax(); noanswercount = 0; req.onreadystatechange = function(){ obj = getElement( "conninfo" ); if( req.readyState == 4 && req.status == 200 ) { var myresp = req.responseText; pgtitle = ""; pgtitle = myresp.substring(myresp.indexOf("<TITLE>"), myresp.indexOf("</TITLE>")); if (pgtitle == "") pgtitle = myresp.substring(myresp.indexOf("<title>"), myresp.indexOf("</title>")); pgtitle = CleanTitle(pgtitle); obj.innerHTML = pgtitle; document.Form1.cmdTA.value += "REM " + pgtitle + " \r\n"; document.Form1.cmdTA.value += "REM page url " + document.Form1.vidPgUrl.value + " \r\n"; fetchRealUrl(); } else { //obj.innerHTML = "No answer" + targetURL; noanswercount++; if (noanswercount > 3) obj.innerHTML = "No answer"; } } req.open( 'GET', videoURL, true ); req.send( null ); } function fetchRealUrl() { //now call keepvid to get the real stream url var videoURL = document.Form1.vidPgUrl.value; var getURL = parseURL + videoURL; req1 = getAjax(); noanswercount = 0; req1.onreadystatechange = function(){ obj = getElement( "conninfo" ); if( req1.readyState == 4 && req1.status == 200 ) { //realURL without quotation marks. var myresp = req1.responseText; realURL = ""; realURL = myresp.substring(0, myresp.indexOf('(.flv - Flash Video)')); realURL = realURL.substring(realURL.lastIndexOf('<a href=')); realURL = realURL.substring(realURL.indexOf('"')+1); realURL = realURL.substring(0, realURL.indexOf('"')); obj.innerHTML = realURL; document.Form1.cmdTA.value += "REM stream url " + realURL + " \r\n"; GenerateCommand(); } else { noanswercount++; if (noanswercount > 3) obj.innerHTML = "No answer"; } } var postString = "url=" + escape(videoURL); postString += "&site=aa"; req1.open( 'POST', parseURL, true ); req1.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); req1.send( postString ); } function GenerateCommand() { var comms = '"' + document.Form1.vlcLoc.value + '" --no-play-and-stop '; comms += '"' + realURL + '"'; comms += ' :demux=dump :demuxdump-file="'; comms += document.Form1.outLoc.value + pgtitle + '.flv" vlc:quit'; document.Form1.cmdTA.value += comms + " \r\n\r\n"; obj.innerHTML = ""; } function startit() { sniff(); document.focus(); } function Replace ( target, todo, withwhat) { //http://www.anaesthetist.com/mnm/javascript/part2j.htm var fixme = target; // load string to alter (into fixme) var atpos = fixme.indexOf(todo); // find position of string to replace while ( atpos > -1) // while still to replace.. { fixme = fixme.substring(0,atpos) + withwhat + fixme.substring(todo.length + atpos); //replace atpos = fixme.indexOf(todo); // find next position (if exists) }; // .. end while return fixme; // return altered string } function CleanTitle (inTitle) { temp = inTitle; temp = temp.substring(7); temp = Replace(temp, ":", "_"); // replace colon, temp = Replace(temp, "/", "_"); // and slash temp = Replace(temp, " ", "_"); // and spaces. temp = Replace(temp, "'", ""); temp = Replace(temp, "?", ""); temp = Replace(temp, "|", ""); return temp; }
Well, hope this helps someone...

Cheers

dionoea
Cone Master
Cone Master
Posts: 5157
Joined: 03 Dec 2003 23:09
Location: Paris, France

Re: Save playlist FLV streams, command line

Postby dionoea » 24 Jul 2007 18:30

The developement version of VLC has something called Lua Playlist Scripts (see Documentation:Play_HowTo/Building_Lua_Playlist_Scripts) which automates what you wanted to do. Current scripts shipped with VLC include support for sites like Youtube, dailymotion and metacafe. You just need to enter the video's webpage URL in VLC and it will translate it into the FLV's URL automatically. You can give it a try by using a nightly build.
Antoine Cellerier
dionoea
(Please do not use private messages for support questions)


Return to “VLC media player for Windows Troubleshooting”

Who is online

Users browsing this forum: Bing [Bot] and 25 guests