Project

General

Profile

Showing tvheadend stream in web app

Added by ilja leiko 8 months ago

Hey all.

Now:
The way it all works now: tvheadend is receiving digital TV using usb dongle. I can click "play" button and it downloads jebrish-named file to my laptop, which i can open with vlc and watch.

Question:
Has anyone made it work on custom build web app? I have a locally deployed web server written on Flask (it is deployed on the same machine, where tvheadend+dongle are installed). Is there anyway i can make the video play from my web app? So my users could just navigate to http://localhost:5000/video and see channels from tvheadend and play those, without downloading vlc or any other files?

Thank you in advance!
Any help is highly appreciated!


Replies (19)

RE: Showing tvheadend stream in web app - Added by saen acro 8 months ago

You need web player with support HTTP-TS streams
with also support play list.

aka user open page with player
player take playlist with or without autentification
from http://tvh_addres:9981/playlist
/rewrite playlist if authentication used/
play stream

RE: Showing tvheadend stream in web app - Added by ilja leiko 8 months ago

Hey, saen acro. Thank you for your reply.

Is the output stream from tvheadend falls under HTTP-TS stream category? I have very limited knowledge in different streaming profiles, but I could not find any information about HTTP-TS streams while googling.

Do you by any chance know any web players(with playlist support) to play HTTP-TS streams? I have tried looking online, but unfortunately couldn't find any.

The only one i came across was JWplayer, but it's super pricey. And at this point, i would like to go with any possible free solution.

Thank you.

RE: Showing tvheadend stream in web app - Added by ilja leiko 8 months ago

Hey all.

I have found a similar problem here - https://tvheadend.org/boards/5/topics/18851
And using the suggestions made in that thread I was able to import video stream in my flask web app.
Hopefully it will keep working.

Thanks all!

RE: Showing tvheadend stream in web app - Added by ilja leiko 8 months ago

Thank you, saen acro for the links.

I have tried both player - none of them worked.
I m stuck to make it work on Android/iOS devices now.

It works perfectly fine on windows/mac computer under chrome browser if I just use simple html video tag as this:

<video id="player1" width="640" height="360" preload="none" controls playsinline webkit-playsinline>
<source src=""http://192.168.1.72:9981/stream/channelid/2013555866?ticket=388550710ddf21ad5c6ffd61fcd3d0dc24cf46d2&profile=matroska type="video/webm">
</video>

But that doesn't work neither on Android tablet nor on iOS.
I have tried installing multiple different JS player, such as mediaelement, plyr, video.js, mpegts... And i have installed like all three browsers on Android tablet - Chrome, Opera, Mozilla for testings. Every single JS player works fine if i watch the video from my laptop(Chrome), but none of them works when i access from Android device. And the furthest I can get is using Opera+plyr(or video.js) is having an audio playing fine, but just a black screen with no video.

Could you please help me out? :/

RE: Showing tvheadend stream in web app - Added by saen acro 8 months ago

There is a lot of programs as TVHClient for mobile OS

RE: Showing tvheadend stream in web app - Added by ilja leiko 8 months ago

I know, I know, but there is a particular reason the video stream has to be implemented on the web. It is a part of a much bigger "Information Access Project" picture. And TV part of that should be limiting user to the amount of time they can watch TV streams. If the stream is shown of a web there would be simple authentication logic implemented as well as session time limited.

Thank you

RE: Showing tvheadend stream in web app - Added by saen acro 8 months ago

When HLS implementation will arrive this problem will gone.

webtv-vp8-vorbis-webm profile work on almost any device, but transcoding used.

RE: Showing tvheadend stream in web app - Added by ilja leiko 8 months ago

Is there any way I can switch my stream to "webtv-vp8-vorbis-webm" profile and make work on almost any device? :/ How can I do that? Will i need to implement transcoding myself?

Haha, i m pretty much desperate at thus point

RE: Showing tvheadend stream in web app - Added by saen acro 8 months ago

ilja leiko wrote:

<video id="player1" width="640" height="360" preload="none" controls playsinline webkit-playsinline>
<source src=""http://192.168.1.72:9981/stream/channelid/2013555866?ticket=388550710ddf21ad5c6ffd61fcd3d0dc24cf46d2&profile=matroska type="video/webm">
</video>

replace profile=matroska with webtv-vp8-vorbis-webm
also cutoff ticket part from url

http://www.bogotobogo.com/VideoStreaming/ffmpeg_http_live_streaming_hls.php

RE: Showing tvheadend stream in web app - Added by ilja leiko 8 months ago

Thank you, saen acro, for your continues help.

I am using tvheadend 4.3-1234~g78081ea on Raspberry Pi 3 and under Configurations-Stream-Stream Profiles i just have three basic profiles (see screenshoot - https://i.imgur.com/melQNbj.png), do you think replacing matroska profile with webtv-vp8-vorbis-webm would still work for me?

If so, following your guidance, I would make URL as this:
http://192.168.1.72:9981/stream/channelid/2013555866?webtv-vp8-vorbis-webm
Am i right?

P.S. While fighting with raw TS stream i can across on-the-go transoding app(https://www.raspberrypi.org/forums/viewtopic.php?f=38&t=123876&p=1305839&hilit=multiple&sid=3f8d74bbcc1b8b578a047b5b4f069559#p1305839), and i have tried it. Unfortunately, it can only transcode one channel at a time due to poor RPi GPU performance. But what's interesting, that I was able to play perfectly trasncoded video stream(inserting as html5 video tag on my local web server) from Android tablet(using Chrome). Which is already a good result. Sadly, I have 6 channels which i need to provide through local web server and they all have to work individually (so a few ppl would be able to watch different streams), so this transcoding approach would not work for me :(

RE: Showing tvheadend stream in web app - Added by saen acro 8 months ago

Forget about 5 coins stuff use some real x86_64 with intel or nvidia GPU

RE: Showing tvheadend stream in web app - Added by ilja leiko 8 months ago

Thank you, saen acro.

Do you know any good(within 150$) device i could use?
And know, when I am looking for a better solution to my problem, do you think I could use something as:
https://www.amazon.com/dp/B07BLXVLCV/ref=sspa_dk_detail_4?pd_rd_i=B075SS1YX4&pd_rd_wg=9p6C9&pd_rd_r=RJV98DRMEY0HP3K7GAVK&pd_rd_w=KAO0R&th=1

Only thing i need is to be able to decode, trascode and stream to the local web server like 6 channels. Taking into account that I need multiple users to be able to stream different channel from local web server.

RE: Showing tvheadend stream in web app - Added by saen acro 8 months ago

At less i5 4xxx ebay second hand ;)
my personal choice will be 24-27" AiO, tuner on usb + Open/LibreElec or Linux with auto-login Kodi and remote

RE: Showing tvheadend stream in web app - Added by ilja leiko 8 months ago

Haha, your personal choice would definitely be a massive overkill for our purposes & budget.

(sorry for a long message)

In short, I am currently working in East Africa, where our company is working on providing local TV in a simply accessible manner for local inhabitants in rural areas.

So, I am looking now for people coming from US, who can bring some components, which i ll order from Amazon(quick shipment). Once here, i ll move the tvheadend backend + usb tuner to the new intel-based pc. All of that will be installed in a rural African area. The goal is to successfully decode channels(tvheadend is taking care of that), and then make the stream work from locally accessible web server. People would use some of their tablets and cheap Android phones to login into a portal and watch local TV. (That's an ultimate goal)

Currently, all of that is implemented on Raspberry Pi and is working "fine" if i m using laptop(Win/Mac+chrome) to stream the videos from browser. But it does not work if i use any android device.

From what I have understood so far, tvheadend version for Pi can only output 'matroska'-type stream, which is raw TS stream. Win/Mac Chrome can handle that, but not an Android devices. I have tried transcoding(on-the-go) one of the TS raw stream using RPi app(rtranscode) and transoded stream was working fine both on Win/Mac and android devices. Unfortunately, RPi written transoder(rtranscode) can only deal with 1-2 streams at the time. And i have like 6-7 channels which needs to be transcoded.

What i have learned by googling, full version of tvheadend(not for RPi) has multiple various streaming profiles. So i think, that upgrading hardware will allow me to install and use full version of tvheadend and use different streaming profiles, like "webtv-vp8-vorbis-webm" and i hope that would work find both on android and win/mac devices.

Do you think I am going to the right direction?

Speaking of hardware, I am aiming at reusing our USB tv tuner(based on Realtek RTL2832U):
https://www.ebay.com/itm/USB-DVB-T-RTL-SDR-Realtek-RTL2832U-R820T-DVB-T-Tuner-Receiver-MCX-Input-BP-/112263012776
Some intel based PC (using some linux distribution) which is within 150-200$ budget (still am looking for a device).

Thank you, saen acro, for continues help! (what you do it a great help and impact into African community)

RE: Showing tvheadend stream in web app - Added by saen acro 8 months ago

If you have good Linux knowledge you can use ffmpeg to transcode and stream HLS with multiple Bitrates (sizes)
With nvidia 6xx + you can transcode perfectly full dvb-t/c mux or near ome transponder on dvb-s2 with base models

RE: Showing tvheadend stream in web app - Added by ilja leiko 8 months ago

Thank you, saen acro.

That would probably be one of my main options to use ffmpeg to transcode and stream HLS to my local web server.

The main concern i have now, do you think i would be able to transcode 6 channels in parallel using that small-cute Intel Atom? https://www.amazon.com/dp/B07BLXVLCV/ref=sspa_dk_detail_4?pd_rd_i=B075SS1YX4&pd_rd_wg=9p6C9&pd_rd_r=RJV98DRMEY0HP3K7GAVK&pd_rd_w=KAO0R&th=1

I couldnt find anything available, small-factor and "budget" with nvidia video card

RE: Showing tvheadend stream in web app - Added by ilja leiko 8 months ago

Dear saen acro,
could you please help me to understand if Intel Atom would work for us to transcode 6 channels in parallel ?
https://www.amazon.com/dp/B07BLXVLCV/ref=sspa_dk_detail_4?pd_rd_i=B075SS1YX4&pd_rd_wg=9p6C9&pd_rd_r=RJV98DRMEY0HP3K7GAVK&pd_rd_w=KAO0R&th=1

RE: Showing tvheadend stream in web app - Added by saen acro 8 months ago

ilja leiko wrote:

Dear saen acro,
could you please help me to understand if Intel Atom would work for us to transcode 6 channels in parallel ?
https://www.amazon.com/dp/B07BLXVLCV/ref=sspa_dk_detail_4?pd_rd_i=B075SS1YX4&pd_rd_wg=9p6C9&pd_rd_r=RJV98DRMEY0HP3K7GAVK&pd_rd_w=KAO0R&th=1

I dont have access to this CPU but as written
https://en.wikichip.org/wiki/intel/atom_x5/x5-z8350
h264 supported on HD Graphics (Cherry Trail)

keep in mind that this cpu (Intel Atom x5-Z8350) is designed for tablets
far away from Intel Atom® x7-E3950 Processor
https://www.amazon.com/fitlet-FITLET2-CE3950-fitlet2-E3950-Barebone/dp/B0795V4W5G/

    (1-19/19)