Live stream to VLC

HDHomeRun development

Moderator: Moderators

Forum rules
This forum is for discussion of development of third-party hardware and software that interacts with HDHomeRun hardware. General questions about past, present, or future HDHomeRun products, or about existing apps that utilize the HDHomeRun, should be posted in the appropriate Support forum.

Live stream to VLC

Postby joelcpatterson » Tue Nov 05, 2013 9:48 pm

So I've been working on trying to get a batch file to start a live stream to VLC, but I can't seem to get it going per instructions I've found on these forums.

Here is my batch file.

Code: Select all
@echo off
echo Launching VLC...
start /d "C:\Program Files (x86)\VideoLAN\VLC\" vlc.exe --deinterlace=-1 udp://@:5000

REM Sleep 3 seconds
ping 127.0.0.1 -n 3 >nul
cls

echo Tuning channel...
cd C:\Program Files\Silicondust\HDHomeRun
hdhomerun_config 1039AB03 set /tuner1/channel auto:7
hdhomerun_config 1039AB03 set /tuner1/program 7
hdhomerun_config 1039AB03 set /tuner1/target udp://192.168.1.100:5000

REM Sleep 5 seconds
ping 127.0.0.1 -n 5 >nul
cls

echo Displaying Status...
HDHomerun_config 1039AB03 get /tuner1/streaminfo
HDHomerun_config 1039AB03 get /tuner1/debug
pause

REM Turn off our tuner twice in case it doesn't work the first time.
hdhomerun_config 1039AB03 set /tuner1/channel none
hdhomerun_config 1039AB03 set /tuner1/target none
hdhomerun_config 1039AB03 set /tuner1/channel none
hdhomerun_config 1039AB03 set /tuner1/target none


The file launches VLC connects looking for UDP connection on port 5000
It then tunes to the desired channel, then points to the ip address of the computer running VLC.

Based on other scripts, this should be working.

I can get VLC to play live streams if I launch them from the Config GUI, I can't however get it to work via command line.

I have the GUI open when I launch this script and it shows that it's correctly tuning the channel and locking. However, there is no output on VLC, and the "Network Rate" shows 0.000 Mbps.

I have no firewalls setup.

What else should I check here? What am I missing?
joelcpatterson
 
Posts: 2
Joined: Tue Nov 05, 2013 9:36 pm

Re: Live stream to VLC

Postby QChannel » Wed Nov 06, 2013 8:35 am

Your BAT file works ok here on a Win7 Toshiba laptop. I edited it to match my IP address, HDHR box ID, and local channel, and saved it as TV.bat onto my desktop. Then I just double-clicked the TV.bat icon, and it brought up VLC and tuned the channel.

I wonder -- you show channel 7 and program 7. Do you really mean to tune program 7? (and I assume your channel 7 is physical (RF) channel 7).

Here's my modified code, for my network.

Code: Select all
@echo off
echo Launching VLC...
start /d "C:\Program Files (x86)\VideoLAN\VLC\" vlc.exe --deinterlace=-1 udp://@:5000

REM Sleep 3 seconds
ping 127.0.0.1 -n 3 >nul
cls

echo Tuning channel...
cd C:\Program Files\Silicondust\HDHomeRun
hdhomerun_config 10365AED set /tuner1/channel auto:28
hdhomerun_config 10365AED set /tuner1/program 1
hdhomerun_config 10365AED set /tuner1/target udp://192.168.1.154:5000

REM Sleep 5 seconds
ping 127.0.0.1 -n 5 >nul
cls

echo Displaying Status...
HDHomerun_config 10365AED get /tuner1/streaminfo
HDHomerun_config 10365AED get /tuner1/debug
pause

REM Turn off our tuner twice in case it doesn't work the first time.
hdhomerun_config 10365AED set /tuner1/channel none
hdhomerun_config 10365AED set /tuner1/target none
hdhomerun_config 10365AED set /tuner1/channel none
hdhomerun_config 10365AED set /tuner1/target none


VLCtest.jpg
VLCtest.jpg (51.33 KiB) Viewed 5022 times
QChannel
 
Posts: 38
Joined: Sun Sep 30, 2012 4:57 pm

Re: Live stream to VLC

Postby joelcpatterson » Wed Nov 06, 2013 5:57 pm

Oh boy...feeling really dumb now. That was the trick. Thanks for seeing what I wasn't.

The goofy part is that the GUI would show the correct channel and program tuned. That threw me off!

At least it's all working now. Thanks for the help!

Here is my final script for anybody else who may want it

Code: Select all
@echo off
echo Launching VLC...
start /d "C:\Program Files (x86)\VideoLAN\VLC\" vlc.exe --deinterlace=-1 udp://@:5000

REM Sleep 2 seconds
ping 127.0.0.1 -n 2 >nul
cls

echo Tuning channel...
cd C:\Program Files\Silicondust\HDHomeRun
hdhomerun_config 1039AB03 set /tuner1/channel auto:7
hdhomerun_config 1039AB03 set /tuner1/program 1
hdhomerun_config 1039AB03 set /tuner1/target udp://192.168.1.100:5000

REM Sleep 2 seconds
ping 127.0.0.1 -n 4 >nul
cls

echo Displaying Status...
echo.
HDHomerun_config 1039AB03 get /tuner1/streaminfo
HDHomerun_config 1039AB03 get /tuner1/debug

REM Sleep
ping 127.0.0.1 -n 15 >nul
CLS
echo Continue to shutdown...
echo.
pause


REM Turn off our tuner twice in case it doesn't work the first time.
taskkill /im vlc.exe /f
hdhomerun_config 1039AB03 set /tuner1/channel none
hdhomerun_config 1039AB03 set /tuner1/target none
hdhomerun_config 1039AB03 set /tuner1/channel none
hdhomerun_config 1039AB03 set /tuner1/target none
joelcpatterson
 
Posts: 2
Joined: Tue Nov 05, 2013 9:36 pm

Re: Live stream to VLC

Postby QChannel » Thu Nov 07, 2013 7:27 am

I've done that too -- stared at the same code over and over, missing something. It's a neat little bat file.

Another idea: if your bat file is called "myfile.bat" then you could do this on the command line:

Code: Select all
myfile 7 1  (or other channel and program number)

if you have this in your file:

Code: Select all
hdhomerun_config 1039AB03 set /tuner1/channel auto:%1
hdhomerun_config 1039AB03 set /tuner1/program %2

Doing that would select the channel and program# from the command line without editing the bat file.
QChannel
 
Posts: 38
Joined: Sun Sep 30, 2012 4:57 pm

Re: Live stream to VLC

Postby jmha » Tue Feb 11, 2014 11:56 pm

I came across this thread when searching for alternative front-ends for my HDHomeRun. I liked this idea for quick testing HDHomeRun on VLC. I modified the code for user selection of (Channel, Program, Tuner). It also gets your local IP address and HDHR Box ID so the only thing to have to modify is your program locations (VLC Player and HDHomeRun software). Quick and easy.

I have a question, I like WMC and QuickTV. I tried out XBMC but I dislike the stop and play selection of tuning using files in Windows. What else is there that has quick channel selection? that can use a WMC remote?


Code: Select all
@echo off
REM Select Channel, Program and Tuner
set /p _channel=Please enter channel:
set /p _pro=Please enter program:
set /p _tun=Please enter tuner:

set "str3=tuner"
set "_tuner=%str3%%_tun%"

REM Get your IP address
for /f "delims=[] tokens=2" %%a in ('ping -4 %computername% -n 1 ^| findstr "["') do (set thisip=%%a)

set "str1=udp://"
set "str2=:5000"
set "t=%str1%%thisip%%str2%"

REM Get your HDHomeRun ID
cd C:\Program Files\Silicondust\HDHomeRun
for /f "tokens=3" %%a in ('hdhomerun_config discover') do (set hdid=%%a)

REM Display info and then click to continue
echo HDID: %hdid%, Channel: %_channel%, Program: %_pro%, Tuner: %_tuner%, IP: %thisip%
pause
   
echo Launching VLC...
start /d "C:\Program Files (x86)\VideoLAN\VLC\" vlc.exe --deinterlace=-1 udp://@:5000

REM Sleep 2 seconds
ping 127.0.0.1 -n 2 >nul
cls

echo Tuning channel...
cd C:\Program Files\Silicondust\HDHomeRun
hdhomerun_config %hdid% set /%_tuner%/channel auto:%_channel%
hdhomerun_config %hdid% set /%_tuner%/program %_pro%
hdhomerun_config %hdid% set /%_tuner%/target %t%

REM Sleep 2 seconds
ping 127.0.0.1 -n 4 >nul
cls

echo Displaying Status...
echo.
HDHomerun_config %hdid% get /%_tuner%/streaminfo
HDHomerun_config %hdid% get /%_tuner%/debug

REM Sleep
ping 127.0.0.1 -n 15 >nul
CLS
echo HDID: %hdid%, Channel: %_channel%, Program: %_pro%, Tuner: %_tuner%, IP: %thisip%
   echo Continue to shutdown...
echo.
pause


REM Turn off our tuner twice in case it doesn't work the first time.
taskkill /im vlc.exe /f
hdhomerun_config %hdid% set /%_tuner%/channel none
hdhomerun_config %hdid% set /%_tuner%/target none
hdhomerun_config %hdid% set /%_tuner%/channel none
hdhomerun_config %hdid% set /%_tuner%/target none
Last edited by jmha on Wed Feb 12, 2014 8:25 am, edited 4 times in total.
jmha
 
Posts: 3
Joined: Tue Feb 11, 2014 11:44 pm

Re: Live stream to VLC

Postby mikeb » Wed Feb 12, 2014 1:07 am

The newer HDHomeRun devices* support UPNP and DLNA which makes things even easier; start VLC, hit the playlist button then select Univeral Plug'n'Play and you should see the HDHomeRun and channels.

You can also use the DLNA URLs directly; http://x.x.x.x:5004/auto/v123 will stream channel 123.

* Prime (HDHR3-CC), Plus (HDTC) and HDHR4 models; VLC's UPNP support appears to be broken on windows after VLC 2.0.8.
mikeb
Silicondust
 
Posts: 776
Joined: Thu Sep 28, 2006 10:20 am

Re: Live stream to VLC

Postby opensteel » Mon Feb 17, 2014 12:36 am

The bat-file works fine.

i have made a bat-file for each program, and I just dobbeltclick.

But....

I some cases the tuner I have entered is already in use. Can someone made a modification, so if the tuner is in use, it just try with the other tuner?

How to?

Regards.
opensteel
 
Posts: 8
Joined: Mon Nov 25, 2013 12:32 am

Re: Live stream to VLC

Postby jmha » Mon Feb 17, 2014 12:38 pm

I modified my code again for automatic tuner number selection. If both tuners are in use, it will give you a notice.
Remember, all you have to enter is the Channel and Program number, local IP address and HDHomeRun ID is automatically found. See my post #5 (https://www.silicondust.com/forum2/viewtopic.php?f=16&t=15932#p97995).

1. User Selection Batch file (Just choose Channel and Program Number).
Code: Select all
@echo off
REM Select Channel and Program
set /p _channel=Please enter channel:
set /p _pro=Please enter program:

REM Get your IP address

for /f "delims=[] tokens=2" %%a in ('ping -4 %computername% -n 1 ^| findstr "["') do (set thisip=%%a)

set "str1=udp://"
set "str2=:5000"
set "t=%str1%%thisip%%str2%"

REM Get your HDHomeRun ID
cd C:\Program Files\Silicondust\HDHomeRun
for /f "tokens=3" %%a in ('hdhomerun_config discover') do (set hdid=%%a)

REM Get status of tuner0 and tuner1 and set tuner number
cd C:\Program Files\Silicondust\HDHomeRun
for /f "tokens=7" %%a in ('hdhomerun_config %hdid% get /tuner0/status') do (set inuse0=%%a)
for /f "tokens=7" %%b in ('hdhomerun_config %hdid% get /tuner1/status') do (set inuse1=%%b)

set "str3=tuner"

if "%inuse0%" EQU "pps=0" if "%inuse1%" EQU "pps=0" set "_tuner=%str3%0"
if "%inuse0%" EQU "pps=0" if "%inuse1%" NEQ "pps=0" set "_tuner=%str3%0"
if "%inuse0%" NEQ "pps=0" if "%inuse1%" EQU "pps=0" set "_tuner=%str3%1"
if "%inuse0%" NEQ "pps=0" if "%inuse1%" NEQ "pps=0" echo NOTICE: tuner0 and tuner1 are in use.

REM Display info and then click to continue
echo HDID: %hdid%, Channel: %_channel%, Program: %_pro%, Tuner: %_tuner%, IP: %thisip%
pause
   
echo Launching VLC...
start /d "C:\Program Files (x86)\VideoLAN\VLC\" vlc.exe --deinterlace=-1 udp://@:5000

REM Sleep 2 seconds
ping 127.0.0.1 -n 2 >nul
cls

echo Tuning channel...
cd C:\Program Files\Silicondust\HDHomeRun
hdhomerun_config %hdid% set /%_tuner%/channel auto:%_channel%
hdhomerun_config %hdid% set /%_tuner%/program %_pro%
hdhomerun_config %hdid% set /%_tuner%/target %t%

REM Sleep 2 seconds
ping 127.0.0.1 -n 4 >nul
cls

echo Displaying Status...
echo.
HDHomerun_config %hdid% get /%_tuner%/streaminfo
HDHomerun_config %hdid% get /%_tuner%/debug

REM Sleep
ping 127.0.0.1 -n 15 >nul
CLS
echo HDID: %hdid%, Channel: %_channel%, Program: %_pro%, Tuner: %_tuner%, IP: %thisip%
   echo Continue to shutdown...
echo.
pause


REM Turn off our tuner twice in case it doesn't work the first time.
taskkill /im vlc.exe /f
hdhomerun_config %hdid% set /%_tuner%/channel none
hdhomerun_config %hdid% set /%_tuner%/target none
hdhomerun_config %hdid% set /%_tuner%/channel none
hdhomerun_config %hdid% set /%_tuner%/target none


2. Manual Batch file (Just replace the numbers for Channel and Program Number). Currently set to Channel 41 and Program 1.
Code: Select all
@echo off
REM Replace Channel "_channel" and Program "_pro" Number
set "_channel=41"
set "_pro=1"

REM Get your IP address

for /f "delims=[] tokens=2" %%a in ('ping -4 %computername% -n 1 ^| findstr "["') do (set thisip=%%a)

set "str1=udp://"
set "str2=:5000"
set "t=%str1%%thisip%%str2%"

REM Get your HDHomeRun ID
cd C:\Program Files\Silicondust\HDHomeRun
for /f "tokens=3" %%a in ('hdhomerun_config discover') do (set hdid=%%a)

REM Get status of tuner0 and tuner1 and set tuner number
cd C:\Program Files\Silicondust\HDHomeRun
for /f "tokens=7" %%a in ('hdhomerun_config %hdid% get /tuner0/status') do (set inuse0=%%a)
for /f "tokens=7" %%b in ('hdhomerun_config %hdid% get /tuner1/status') do (set inuse1=%%b)

set "str3=tuner"

if "%inuse0%" EQU "pps=0" if "%inuse1%" EQU "pps=0" set "_tuner=%str3%0"
if "%inuse0%" EQU "pps=0" if "%inuse1%" NEQ "pps=0" set "_tuner=%str3%0"
if "%inuse0%" NEQ "pps=0" if "%inuse1%" EQU "pps=0" set "_tuner=%str3%1"
if "%inuse0%" NEQ "pps=0" if "%inuse1%" NEQ "pps=0" echo NOTICE: tuner0 and tuner1 are in use.

REM Display info and then click to continue
echo HDID: %hdid%, Channel: %_channel%, Program: %_pro%, Tuner: %_tuner%, IP: %thisip%
pause
   
echo Launching VLC...
start /d "C:\Program Files (x86)\VideoLAN\VLC\" vlc.exe --deinterlace=-1 udp://@:5000

REM Sleep 2 seconds
ping 127.0.0.1 -n 2 >nul
cls

echo Tuning channel...
cd C:\Program Files\Silicondust\HDHomeRun
hdhomerun_config %hdid% set /%_tuner%/channel auto:%_channel%
hdhomerun_config %hdid% set /%_tuner%/program %_pro%
hdhomerun_config %hdid% set /%_tuner%/target %t%

REM Sleep 2 seconds
ping 127.0.0.1 -n 4 >nul
cls

echo Displaying Status...
echo.
HDHomerun_config %hdid% get /%_tuner%/streaminfo
HDHomerun_config %hdid% get /%_tuner%/debug

REM Sleep
ping 127.0.0.1 -n 15 >nul
CLS
echo HDID: %hdid%, Channel: %_channel%, Program: %_pro%, Tuner: %_tuner%, IP: %thisip%
   echo Continue to shutdown...
echo.
pause


REM Turn off our tuner twice in case it doesn't work the first time.
taskkill /im vlc.exe /f
hdhomerun_config %hdid% set /%_tuner%/channel none
hdhomerun_config %hdid% set /%_tuner%/target none
hdhomerun_config %hdid% set /%_tuner%/channel none
hdhomerun_config %hdid% set /%_tuner%/target none
jmha
 
Posts: 3
Joined: Tue Feb 11, 2014 11:44 pm

Re: Live stream to VLC

Postby opensteel » Mon Feb 17, 2014 11:27 pm

Excellent - absolut excellent.

I will give it a try this afternoon when I get home from work.
opensteel
 
Posts: 8
Joined: Mon Nov 25, 2013 12:32 am

Re: Live stream to VLC

Postby opensteel » Wed Feb 26, 2014 1:37 am

Hi.

I'm having some troubles with this (sorry for the late reply).

I someway I have locked the one tuner, and cannot get it released again.

Is it possible to make a script that releases both tuners, if they should be stucked?

I cannot get it to work every time the batch-file you provided. But for now my new problem is that one tuner is in use all the time even though I'm not using it.

Can you help again?
opensteel
 
Posts: 8
Joined: Mon Nov 25, 2013 12:32 am

Re: Live stream to VLC

Postby jmha » Sun Mar 02, 2014 3:00 am

The original batch file (Post #1: https://www.silicondust.com/forum2/viewtopic.php?f=16&t=15932&p=98982#p93306) and all batch modifications in this forum thread requires that you use the batch file to close VLC Player program and turn off the tuner.

If you just close the VLC Player program and/or the Batch file, your HDHomeRun tuner is still streaming.

The batch file displays:
Continue to shutdown...

Press any key to continue...


So you have to "Press any key to continue . . . " in the batch file program to shutdown VLC Player program and turn off the tuner.

Well if you forgot to do that, here is a simple batch file that should turn off VLC Player and both tuners.
Code: Select all
@echo off

REM Get your HDHomeRun ID
cd C:\Program Files\Silicondust\HDHomeRun
for /f "tokens=3" %%a in ('hdhomerun_config discover') do (set hdid=%%a)

REM Get status of tuner0 and tuner1 and set tuner number
cd C:\Program Files\Silicondust\HDHomeRun
for /f "tokens=7" %%a in ('hdhomerun_config %hdid% get /tuner0/status') do (set inuse0=%%a)
for /f "tokens=7" %%b in ('hdhomerun_config %hdid% get /tuner1/status') do (set inuse1=%%b)

if "%inuse0%" EQU "pps=0" if "%inuse1%" EQU "pps=0" echo NOTICE: tuner0 and tuner1 are NOT in use.
if "%inuse0%" EQU "pps=0" if "%inuse1%" NEQ "pps=0" echo NOTICE: tuner0 is NOT in use. tuner1 is in use.
if "%inuse0%" NEQ "pps=0" if "%inuse1%" EQU "pps=0" echo NOTICE: tuner0 is in use. tuner1 is NOT in use.
if "%inuse0%" NEQ "pps=0" if "%inuse1%" NEQ "pps=0" echo NOTICE: tuner0 and tuner1 are in use.
 
echo Close VLC Player and Turn off both tuners
pause
cd C:\Program Files\Silicondust\HDHomeRun

REM Turn off our tuners twice in case it doesn't work the first time.

taskkill /im vlc.exe /f

hdhomerun_config %hdid% set /tuner0/channel none
hdhomerun_config %hdid% set /tuner0/target none
hdhomerun_config %hdid% set /tuner0/channel none
hdhomerun_config %hdid% set /tuner0/target none

hdhomerun_config %hdid% set /tuner1/channel none
hdhomerun_config %hdid% set /tuner1/target none
hdhomerun_config %hdid% set /tuner1/channel none
hdhomerun_config %hdid% set /tuner1/target none

jmha
 
Posts: 3
Joined: Tue Feb 11, 2014 11:44 pm

Re: Live stream to VLC

Postby mysticpete » Fri Apr 25, 2014 4:36 am

This is great work forum members, as an fyi you can add fullscreen mode for vlc also as per below

echo Launching VLC...
start /d "C:\Program Files (x86)\VideoLAN\VLC\" vlc.exe --fullscreen --deinterlace=-1 udp://@:5000
mysticpete
 
Posts: 7
Joined: Fri Apr 25, 2014 4:31 am

Re: Live stream to VLC

Postby mysticpete » Fri Apr 25, 2014 5:42 am

I have one issue that is perplexing

whenever I enter a Program number the batch file opens VLC and nothing is displayed, the really interesting thing is that the batch displays no program numbers against the channels, they are all 0, if however I enter 0 as a program number (or nothing) I get the program numbers displayed but a random program is sent to VLC which works. This has me stumped right now?
mysticpete
 
Posts: 7
Joined: Fri Apr 25, 2014 4:31 am

Re: Live stream to VLC

Postby jasonl » Fri Apr 25, 2014 1:29 pm

When a channel+program (or vchannel) is set, other programs in the stream are filtered out to minimize network usage. When the program is not set, or is set to 0, the entire stream is passed. With the filtered stream, VLC doesn't know that other programs exist, because it only sees the one.
jasonl
Silicondust
 
Posts: 9007
Joined: Sun Oct 28, 2007 9:23 pm

Re: Live stream to VLC

Postby wejones » Wed May 07, 2014 1:48 pm

I also have a strange problem.
I my area, we have a channel 6 (actual 44.1), channel 8 (actual 8.1) and channel 13 (actual 38.1).

Before trying the above scripts, I had downloaded the current HDHR software, re scanned and got the above channels, and tried to play channel 44 with the quick view thing in the gui. That worked, but there was no sound for some reason. I then found a link to making a shortcut to play with Windows Media Player. I tried that, also with channel 44, and it worked great. So I went on to make shortcuts for the other channels, however they wouldn't work. WMP just sat there and wouldn't play.
So I did a search that led to this thread for playing with VLC. AGAIN, the original batch file at the top of this thread worked fine for channel 44, but as before, the other 2 channels wouldn't work. The cmd line window showed that the correct channel was being tuned, but VLC just sat there and did nothing. I tried going back into the GUI and tuning one of the other channels, playing it with their quick view thing, and then quitting the gui, and trying again with VLC, but I got the same results.
All three channels play fine on other computers via TSREADER--> VLC, but I just can't get them to play directly from the batch file. I tried the longer version above that finds the IP#s, but it kept giving me an error, and wouldn't tune.
I'm really confused re what's going on. I'm going to run a packet sniffer to see if there is any stream or other communication going on, but I thought I'd ask here first.
Thanks in advance.
wejones
 
Posts: 9
Joined: Sat Dec 08, 2007 7:33 am

Next

Return to Development Forum

Who is online

Users browsing this forum: No registered users and 4 guests