This shows you the differences between two versions of the page.
— |
sw:vlc [d-m-Y H:i] (current) |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== VLC ====== | ||
+ | ===== Fragments ===== | ||
+ | |||
+ | :sout=#transcode{vcodec=mp1v,vb=,scale=1,acodec=mpga,ab=192,channels=2}:duplicate{dst=std{access=udp,mux=ts,url=192.168.178.2:1234}} | ||
+ | |||
+ | :sout=#transcode{vcodec=mp4v,vb=2500,scale=0.75,acodec=mp4a,ab=128,channels=2,deinterlace}:duplicate{dst=std{access=file,mux=mp4,url="test.mpeg"}} | ||
+ | |||
+ | |||
+ | ===== Command Lines ===== | ||
+ | |||
+ | ===== Scripts ===== | ||
+ | |||
+ | ==== Shell ==== | ||
+ | |||
+ | <code> | ||
+ | #!/bin/bash | ||
+ | /Applications/VLC.app/Contents/MacOS/VLC -vvv "$1.mpg" \ | ||
+ | --sout "#transcode{vcodec=mp4v,vb=1024,scale=1, \ | ||
+ | acodec=mp4a,ab=128,channels=2}:standard{access=file, \ | ||
+ | url=$1.mp4}" \ | ||
+ | --aspect-ratio "4:3" --sout-transcode-width 360 \ | ||
+ | --sout-transcode-height 240 --sout-transcode-fps 30 | ||
+ | </code> | ||
+ | |||
+ | ==== Java ==== | ||
+ | |||
+ | === Transcode and scale === | ||
+ | <code> | ||
+ | // dbvlc.js - Dreambox VLC Script 2004 - Lars Ronnback (lars@delicate.se) | ||
+ | |||
+ | // Configuration | ||
+ | var dreambox = "192.168.0.2"; | ||
+ | var useTranscoding = "true" | ||
+ | |||
+ | // Transcoding options | ||
+ | var windows = "192.168.0.3"; | ||
+ | var port = 8080; | ||
+ | var videoCodec = "mp4v"; | ||
+ | var videoBitrate = 400; | ||
+ | var scale = 0.5; | ||
+ | var audioCodec = "vorb"; | ||
+ | var audioBitrate = 96; | ||
+ | var mux = "ogg"; | ||
+ | var access = "http"; | ||
+ | |||
+ | // Used for reading registry and calling vlc | ||
+ | var shell = new ActiveXObject("WScript.Shell"); | ||
+ | |||
+ | // Fetch the streaminfo from the Dreambox | ||
+ | var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); | ||
+ | xmlhttp.open("GET", "http://" + dreambox + "/cgi-bin/streaminfo", false); | ||
+ | xmlhttp.send(); | ||
+ | var streaminfo = xmlhttp.responseText; | ||
+ | |||
+ | // Get rid of some HTML junk | ||
+ | var trTag = /<tr>/g; | ||
+ | streaminfo = streaminfo.replace(trTag, "\n"); | ||
+ | var anyTag = /<[^>]*>/g; | ||
+ | streaminfo = streaminfo.replace(anyTag, ""); | ||
+ | |||
+ | // Parse the important values | ||
+ | // shell.popup(streaminfo); | ||
+ | var pmt = streaminfo.substr(streaminfo.indexOf("PMT:") + 4, 4); | ||
+ | var aPid = streaminfo.substr(streaminfo.indexOf("APID:") + 5, 4); | ||
+ | var vPid = streaminfo.substr(streaminfo.indexOf("VPID:") + 5, 4); | ||
+ | var vfIndex = streaminfo.indexOf("Video Format:"); | ||
+ | var width = streaminfo.substr(vfIndex + 13, | ||
+ | streaminfo.indexOf("x", vfIndex) - vfIndex - 13); | ||
+ | var height = streaminfo.substr(streaminfo.indexOf("x", vfIndex) + 1, | ||
+ | streaminfo.indexOf(" ", vfIndex) - vfIndex - 2); | ||
+ | |||
+ | // Read the VLC location from the registry | ||
+ | var key = "HKLM\\Software\\Classes\\Applications\\vlc.exe\\shell\\Play\\command\\"; | ||
+ | var vlc = shell.regRead(key); | ||
+ | vlc = vlc.substr(0, vlc.lastIndexOf(" ")); | ||
+ | |||
+ | // Set up transcoding options | ||
+ | var transcoding = "" | ||
+ | if (useTranscoding == "true") | ||
+ | transcoding = "--sout \"#transcode{acodec=" + audioCodec + ",ab=" + audioBitrate + | ||
+ | ",vcodec=" + videoCodec + ",width=" + width * scale + | ||
+ | ",height=" + height * scale + ",deinterlace}:standard{access=" + | ||
+ | access + ",mux=" + mux + ",url=" + windows + ":" + port + "}\""; | ||
+ | |||
+ | // Start VLC with all options | ||
+ | var commandLine = "\"" + vlc + "\" -vvv http://" + dreambox + ":31339/0," + pmt + | ||
+ | "," + vPid + "," + aPid + " " + transcoding; | ||
+ | shell.run(commandLine); | ||
+ | </code> |