gkreidl
Posts: 5245
Joined: Thu Jan 26, 2012 1:07 pm
Location: Germany

Re: Real Time Transcoding of DVB TV Streams

Sun Sep 11, 2016 5:52 pm

s1738berger wrote:Hi, just found this interesting post. I was looking for some time for such a solution. Currently I have a HDHomeRun EXPAND DVB-C tuner that is connected to a Tvhedaend server running on a RaspberryPi 2 (jessie lite)
As clients I am using some other RaspberryPi running Kodi with the Tvheadend HTSP Client. That works pretty good.
To have serve bitrates on the network I installed the transcoding software from 'steinerdatenbank.de' on the same Raspi where is Tvhedend server installed. The installation could be completed without any problems.
In Tvheadend I created a user that uses the streaming profile 'pass' to get the raw streaming data.
In channels.dat I included the line 'Arte HD=http://test:test@192.168.178.11:9981/st ... 2a40b6fbc1 sd1 mpeg 2014' (test is the user for streaming, in VLC this stream is showing the tv program)
When I run 'transcode.py' I can choose this channel and it seems to start with the message 'Listening on http://127.0.0.1:9081/xyz.mkv' .... and now? I have no idea how to move on from this point :-(
Do I have to call transcode.py from a client to receive the transcoded stream? In tvheadend I don't see an established stream, nor any connection on the HDHomeRun tuner. I also tried to use a direct connection to HDHomeRun in channels.dat . Same result.
Any hints where is my fault in thinking? Thank you very much for any help. Regards
Stefan
1) tvheadend must be set to send raw TS streams, not its proprietary stream format.
2) Open the http address in VLC or omxlayer(GUI).
http://IP:9081/xyz.mkv'
IP must be the IP of the RPi running the transcoder; on the same machine you can use "localhost",
Minimal Kiosk Browser (kweb)
Slim, fast webkit browser with support for audio+video+playlists+youtube+pdf+download
Optional fullscreen kiosk mode and command interface for embedded applications
Includes omxplayerGUI, an X front end for omxplayer

gigo1988
Posts: 31
Joined: Wed Sep 07, 2016 11:38 pm

Re: Real Time Transcoding of DVB TV Streams

Wed Oct 05, 2016 11:34 pm

Hello gkreidl,

sorry for my late Post but i wasnt able to test at home whatever.

I´ve tried the omxplayer -i url to the stream and i get a lot of information.but i cant copy it.
mpegts from http.....
stream 0:0 deu subtitle
stream 0:1 video h264 high
stream 0:2 deu ac3

i think h264 is mpeg4. Then i doesnt need codec right?

gkreidl
Posts: 5245
Joined: Thu Jan 26, 2012 1:07 pm
Location: Germany

Re: Real Time Transcoding of DVB TV Streams

Thu Oct 06, 2016 10:19 am

gigo1988 wrote:Hello gkreidl,

sorry for my late Post but i wasnt able to test at home whatever.

I´ve tried the omxplayer -i url to the stream and i get a lot of information.but i cant copy it.
mpegts from http.....
stream 0:0 deu subtitle
stream 0:1 video h264 high
stream 0:2 deu ac3

i think h264 is mpeg4. Then i doesnt need codec right?
No, it doesn't need the MPEG2 codec.
If you run the "omxplayer -i URL" it will give all the information you need, e .g;

Code: Select all

    Stream #0:3[0x13ed]: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], 50 fps, 50 tbr, 90k tbn, 100 tbc
    Stream #0:4[0x13ee](deu): Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz, stereo, s16p, 256 kb/s
    Stream #0:5[0x13ef](mis): Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz, stereo, s16p, 256 kb/s
    Stream #0:8[0x13f2](deu): Audio: ac3 ([6][0][0][0] / 0x0006), 48000 Hz, stereo, fltp, 448 kb/s
This means hd1 (1280x720 at 50 fps) for video mode.
You have 3 audio streams available:

Code: Select all

0x13ee: audiopid = 5102 decimal, audio mode = mpeg
0x13ef: audiopid = 5103 decimal, audio mode = mpeg
0x13f2: audiopid = 5106 decimal, audio mode = ac3
a matching command line might look like this:

Code: Select all

transcode.py URL hd1 mpeg 5102
Minimal Kiosk Browser (kweb)
Slim, fast webkit browser with support for audio+video+playlists+youtube+pdf+download
Optional fullscreen kiosk mode and command interface for embedded applications
Includes omxplayerGUI, an X front end for omxplayer

gigo1988
Posts: 31
Joined: Wed Sep 07, 2016 11:38 pm

Re: Real Time Transcoding of DVB TV Streams

Thu Oct 06, 2016 10:11 pm

Hello and thank you for your Post. I´ve try again and find my mistake. I dont know the audio pid id and try wich i find on other pages to configure the receiver with the frequenz. ok now my next step ist to transcode rtl HD which is 1920x1080. I define it as 1080i hd2 in my chanel list and make audio pid which is shorter as others 259.

RTL HD HDTV Deutschland 61200 255 259 255 32 07.05.2012

is it possible?

gkreidl
Posts: 5245
Joined: Thu Jan 26, 2012 1:07 pm
Location: Germany

Re: Real Time Transcoding of DVB TV Streams

Fri Oct 07, 2016 8:11 am

gigo1988 wrote:Hello and thank you for your Post. I´ve try again and find my mistake. I dont know the audio pid id and try wich i find on other pages to configure the receiver with the frequenz. ok now my next step ist to transcode rtl HD which is 1920x1080. I define it as 1080i hd2 in my chanel list and make audio pid which is shorter as others 259.

RTL HD HDTV Deutschland 61200 255 259 255 32 07.05.2012

is it possible?
yes, but AC3 5,1 audio transcoding has memory leaks (while AC3 stereo works fine). You either have to restart the stream about once per hour or add the "vo" ( video only ) option which avoids audio tramscoding and uses the selected audio stream as it is.
transcode.py URL hd2 ac3 259 vo
Minimal Kiosk Browser (kweb)
Slim, fast webkit browser with support for audio+video+playlists+youtube+pdf+download
Optional fullscreen kiosk mode and command interface for embedded applications
Includes omxplayerGUI, an X front end for omxplayer

gigo1988
Posts: 31
Joined: Wed Sep 07, 2016 11:38 pm

Re: Real Time Transcoding of DVB TV Streams

Fri Oct 07, 2016 9:30 am

Ok thx. Now i See deinterlace fail by this qualtiy. What can i do?

gkreidl
Posts: 5245
Joined: Thu Jan 26, 2012 1:07 pm
Location: Germany

Re: Real Time Transcoding of DVB TV Streams

Fri Oct 07, 2016 3:24 pm

gigo1988 wrote:Ok thx. Now i See deinterlace fail by this qualtiy. What can i do?
Deinterlacing is a real problem. I've tried a lot but nothing worked.
The best solution is to use an output size which is only half the size of the original image size on interlaced video streams, e. g. 384x288 for SD video. For 1080i souces 910x512 is the best output size you can use.
It doesn't matter with movie channels, because the original material is not interlaced.
Minimal Kiosk Browser (kweb)
Slim, fast webkit browser with support for audio+video+playlists+youtube+pdf+download
Optional fullscreen kiosk mode and command interface for embedded applications
Includes omxplayerGUI, an X front end for omxplayer

gigo1988
Posts: 31
Joined: Wed Sep 07, 2016 11:38 pm

Re: Real Time Transcoding of DVB TV Streams

Fri Oct 07, 2016 3:46 pm

Ok Thank you. I ve read something like to activate for deinterlace by enigma2 Devices

newspeer
Posts: 4
Joined: Sat Oct 08, 2016 8:22 am

Re: Real Time Transcoding of DVB TV Streams

Sat Oct 08, 2016 8:34 am

Hello,

thanks for this wonderful tool. I tested it a few days ago and it worked like a charm with my dvb-s2 adapter, tvheadend 4.0.8, raspi2 and 2016-05-27-raspbian-jessie-lite.

I changed my setup and now it won't work. I now have a DVB-C adapter, raspi2, tvheadend 4.0.8 and 2016-09-23-raspbian-jessie-lite. I compiled the kernel on my own to add two patches to get my DVB-C adpater working.

I can open the stream directly from tvheadend with vlc, but if I start streaming via transcode.py and open this stream, it won't start.
On the raspi I get:

Code: Select all

Listening on http://127.0.0.1:1234/xyz.mkv
New connection 192.168.178.20:54490
Starting to stream to 192.168.178.20:54490
Starting pipeline
Removing connection 192.168.178.20:54490
Maybe you can help me.
Thanks

newspeer

gkreidl
Posts: 5245
Joined: Thu Jan 26, 2012 1:07 pm
Location: Germany

Re: Real Time Transcoding of DVB TV Streams

Sat Oct 08, 2016 11:27 am

newspeer wrote:Hello,

thanks for this wonderful tool. I tested it a few days ago and it worked like a charm with my dvb-s2 adapter, tvheadend 4.0.8, raspi2 and 2016-05-27-raspbian-jessie-lite.

I changed my setup and now it won't work. I now have a DVB-C adapter, raspi2, tvheadend 4.0.8 and 2016-09-23-raspbian-jessie-lite. I compiled the kernel on my own to add two patches to get my DVB-C adpater working.

I can open the stream directly from tvheadend with vlc, but if I start streaming via transcode.py and open this stream, it won't start.
On the raspi I get:

Code: Select all

Listening on http://127.0.0.1:1234/xyz.mkv
New connection 192.168.178.20:54490
Starting to stream to 192.168.178.20:54490
Starting pipeline
Removing connection 192.168.178.20:54490
Maybe you can help me.
Thanks

newspeer
Are you sure that tvheadend sends a TS stream (and not their proprietary format)?
Open the message/codec box in VLC and check for details.
Another test: Try to watch the original stream in omxplayer.
Post the output of:
omxplayer -i URL
where URL is the original stream from tvheadend.

BTW, I'm just preparing version 2.0 of the transcoder package for publication.
Minimal Kiosk Browser (kweb)
Slim, fast webkit browser with support for audio+video+playlists+youtube+pdf+download
Optional fullscreen kiosk mode and command interface for embedded applications
Includes omxplayerGUI, an X front end for omxplayer

newspeer
Posts: 4
Joined: Sat Oct 08, 2016 8:22 am

Re: Real Time Transcoding of DVB TV Streams

Sat Oct 08, 2016 12:09 pm

Thanks for your help.
Are you sure that tvheadend sends a TS stream (and not their proprietary format)?
Yes, only TS streaming is enabled in tvheadend
Another test: Try to watch the original stream in omxplayer.
Post the output of:
omxplayer -i URL
where URL is the original stream from tvheadend.

Code: Select all

[mpeg2video @ 0x2260f0] Invalid frame dimensions 0x0.
[mpeg2video @ 0x2260f0] Invalid frame dimensions 0x0.
[...a few timnes more]
Input #0, mpegts, from 'http://admin:admin@127.0.0.1:9981/stream/channel/ffb0e02281f8a4d3b28d27287054d7bb':
  Duration: N/A, start: 93620.596922, bitrate: N/A
  Program 28014
    Stream #0:0[0x294]: Video: mpeg2video (Main) ([2][0][0][0] / 0x0002), yuv420p(tv), 720x576 [SAR 64:45 DAR 16:9], max. 15000 kb/s, 25 fps, 25 tbr, 90k tbn, 50 tbc
    Stream #0:1[0x29e](deu): Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz, stereo, s16p, 192 kb/s
    Stream #0:2[0x29f](mis): Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz, stereo, s16p, 192 kb/s
    Stream #0:3[0x2a0](mul): Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz, stereo, s16p, 192 kb/s
    Stream #0:4[0x2a3](deu): Audio: ac3 ([6][0][0][0] / 0x0006), 48000 Hz, stereo, fltp, 448 kb/s
    Stream #0:5[0x2a8](deu): Subtitle: dvb_teletext ([6][0][0][0] / 0x0006)
    Stream #0:6[0x2a9](deu): Subtitle: dvb_subtitle ([6][0][0][0] / 0x0006) (hearing impaired)
have a nice day ;)

gkreidl
Posts: 5245
Joined: Thu Jan 26, 2012 1:07 pm
Location: Germany

Re: Real Time Transcoding of DVB TV Streams

Sat Oct 08, 2016 12:53 pm

newspeer wrote:Thanks for your help.
Are you sure that tvheadend sends a TS stream (and not their proprietary format)?
Yes, only TS streaming is enabled in tvheadend
Another test: Try to watch the original stream in omxplayer.
Post the output of:
omxplayer -i URL
where URL is the original stream from tvheadend.

Code: Select all

[mpeg2video @ 0x2260f0] Invalid frame dimensions 0x0.
[mpeg2video @ 0x2260f0] Invalid frame dimensions 0x0.
[...a few timnes more]
Input #0, mpegts, from 'http://admin:admin@127.0.0.1:9981/stream/channel/ffb0e02281f8a4d3b28d27287054d7bb':
  Duration: N/A, start: 93620.596922, bitrate: N/A
  Program 28014
    Stream #0:0[0x294]: Video: mpeg2video (Main) ([2][0][0][0] / 0x0002), yuv420p(tv), 720x576 [SAR 64:45 DAR 16:9], max. 15000 kb/s, 25 fps, 25 tbr, 90k tbn, 50 tbc
    Stream #0:1[0x29e](deu): Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz, stereo, s16p, 192 kb/s
    Stream #0:2[0x29f](mis): Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz, stereo, s16p, 192 kb/s
    Stream #0:3[0x2a0](mul): Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz, stereo, s16p, 192 kb/s
    Stream #0:4[0x2a3](deu): Audio: ac3 ([6][0][0][0] / 0x0006), 48000 Hz, stereo, fltp, 448 kb/s
    Stream #0:5[0x2a8](deu): Subtitle: dvb_teletext ([6][0][0][0] / 0x0006)
    Stream #0:6[0x2a9](deu): Subtitle: dvb_subtitle ([6][0][0][0] / 0x0006) (hearing impaired)
have a nice day ;)
this should run with

Code: Select all

transcode.py http://admin:admin@127.0.0.1:9981/stream/channel/ffb0e02281f8a4d3b28d27287054d7bb sd1 mpeg 670
Last edited by gkreidl on Tue Oct 18, 2016 2:59 pm, edited 1 time in total.
Minimal Kiosk Browser (kweb)
Slim, fast webkit browser with support for audio+video+playlists+youtube+pdf+download
Optional fullscreen kiosk mode and command interface for embedded applications
Includes omxplayerGUI, an X front end for omxplayer

gkreidl
Posts: 5245
Joined: Thu Jan 26, 2012 1:07 pm
Location: Germany

Real Time Transcoding of DVB TV Streams V. 2.0

Sat Oct 08, 2016 2:11 pm

Version 2.0 of the transcoder package is now available for download.
I've updated the first 3 posts of this thread accordingly.
Minimal Kiosk Browser (kweb)
Slim, fast webkit browser with support for audio+video+playlists+youtube+pdf+download
Optional fullscreen kiosk mode and command interface for embedded applications
Includes omxplayerGUI, an X front end for omxplayer

newspeer
Posts: 4
Joined: Sat Oct 08, 2016 8:22 am

Re: Real Time Transcoding of DVB TV Streams

Sun Oct 09, 2016 2:22 pm

gkreidl wrote: this should run with

Code: Select all

transcode,py http://admin:admin@127.0.0.1:9981/stream/channel/ffb0e02281f8a4d3b28d27287054d7bb sd1 mpeg 670
That is the line I used, but it didn't work.
But good news. I switched from the new jessie minimal image to the new jessie full image with transcoder 2.0 and now it works again. I don't know if it's because I use transcoder 2.0 or the jessie full image, but I'm happy it works again. Thank you for your support and your great work!

gkreidl
Posts: 5245
Joined: Thu Jan 26, 2012 1:07 pm
Location: Germany

Re: Real Time Transcoding of DVB TV Streams

Sun Oct 09, 2016 3:03 pm

newspeer wrote:
gkreidl wrote: this should run with

Code: Select all

transcode,py http://admin:admin@127.0.0.1:9981/stream/channel/ffb0e02281f8a4d3b28d27287054d7bb sd1 mpeg 670
That is the line I used, but it didn't work.
But good news. I switched from the new jessie minimal image to the new jessie full image with transcoder 2.0 and now it works again. I don't know if it's because I use transcoder 2.0 or the jessie full image, but I'm happy it works again. Thank you for your support and your great work!
I suppose on Jessie light most or all the gstreamer-1.0 packages are missing.
Minimal Kiosk Browser (kweb)
Slim, fast webkit browser with support for audio+video+playlists+youtube+pdf+download
Optional fullscreen kiosk mode and command interface for embedded applications
Includes omxplayerGUI, an X front end for omxplayer

newspeer
Posts: 4
Joined: Sat Oct 08, 2016 8:22 am

Re: Real Time Transcoding of DVB TV Streams

Mon Oct 10, 2016 8:44 am

gkreidl wrote:I suppose on Jessie light most or all the gstreamer-1.0 packages are missing.
That is correct. I installed them via apt-get and it worked flawless on 2016-05-27-raspbian-jessie-lite, but not on 2016-09-23-raspbian-jessie-lite. So maybe there were changes from the May version to the September version.

The important part is, that we shouldn't use the lite version anymore.

gigo1988
Posts: 31
Joined: Wed Sep 07, 2016 11:38 pm

Re: Real Time Transcoding of DVB TV Streams

Tue Oct 18, 2016 2:49 pm

gkreidl wrote:
newspeer wrote:
gkreidl wrote: this should run with

Code: Select all

transcode,py http://admin:admin@127.0.0.1:9981/stream/channel/ffb0e02281f8a4d3b28d27287054d7bb sd1 mpeg 670
That is the line I used, but it didn't work.
But good news. I switched from the new jessie minimal image to the new jessie full image with transcoder 2.0 and now it works again. I don't know if it's because I use transcoder 2.0 or the jessie full image, but I'm happy it works again. Thank you for your support and your great work!
I suppose on Jessie light most or all the gstreamer-1.0 packages are missing.
ähm maybe you use transcode,py and not transcode.py

gigo1988
Posts: 31
Joined: Wed Sep 07, 2016 11:38 pm

Re: Real Time Transcoding of DVB TV Streams

Tue Oct 18, 2016 2:51 pm

Other Question from me.

I try to transcode 2 Sources at the same time and collect the second comand with -c=1.py but my transcoder v2 doesnt react

gkreidl
Posts: 5245
Joined: Thu Jan 26, 2012 1:07 pm
Location: Germany

Re: Real Time Transcoding of DVB TV Streams

Tue Oct 18, 2016 3:03 pm

gigo1988 wrote:Other Question from me.

I try to transcode 2 Sources at the same time and collect the second comand with -c=1.py but my transcoder v2 doesnt react
I'm not even sure that running multiple transcodings at the same time will work - perhaps for SD streams.

But you must make sure, that the second transcoder uses a different port for the http server (can be set in the config file).

Sometimes I have to transcode more than one stream, but then I always use multiple Raspberry Pis.
Minimal Kiosk Browser (kweb)
Slim, fast webkit browser with support for audio+video+playlists+youtube+pdf+download
Optional fullscreen kiosk mode and command interface for embedded applications
Includes omxplayerGUI, an X front end for omxplayer

gigo1988
Posts: 31
Joined: Wed Sep 07, 2016 11:38 pm

Re: Real Time Transcoding of DVB TV Streams

Wed Oct 19, 2016 7:54 am

I´ve change the port but it didnt work. OK whatever im able to use multiple pis and its ok.
Next Question :D
While the stream is onlinne the transcoding work. I ve a cronjob on my stream that he make a restart. After the restar the transcoding didnt work so i´ve to restart the transcoding. What can i do ?

gkreidl
Posts: 5245
Joined: Thu Jan 26, 2012 1:07 pm
Location: Germany

Re: Real Time Transcoding of DVB TV Streams

Wed Oct 19, 2016 8:19 am

gigo1988 wrote:I´ve change the port but it didnt work. OK whatever im able to use multiple pis and its ok.
Next Question :D
While the stream is onlinne the transcoding work. I ve a cronjob on my stream that he make a restart. After the restar the transcoding didnt work so i´ve to restart the transcoding. What can i do ?
The gstreamer tool chain (and also http-launch) will stop if the stream is closed (or lost). I don't see a way around it. You could write a short script which calls transcode.py (with the matching arguments) from an endless while loop. You should incude a short delay before the transcoder is started again.
Minimal Kiosk Browser (kweb)
Slim, fast webkit browser with support for audio+video+playlists+youtube+pdf+download
Optional fullscreen kiosk mode and command interface for embedded applications
Includes omxplayerGUI, an X front end for omxplayer

gigo1988
Posts: 31
Joined: Wed Sep 07, 2016 11:38 pm

Re: Real Time Transcoding of DVB TV Streams

Thu Oct 20, 2016 12:40 am

Thank you for this answer. What do you think about Watchdog? I ve put transcode.py in my cronjob with arguments. After restart it starts every time the same channel. I think it ll be possible that Watchdog make a restart if some Options are not changed but my problem is to explain it. I can put for cheking a Lot of Things but i dont unterstand it. Do you think it is possible with file cheking and i Type http://localhost:9080/xyz.mkv.

gkreidl
Posts: 5245
Joined: Thu Jan 26, 2012 1:07 pm
Location: Germany

Re: Real Time Transcoding of DVB TV Streams

Thu Oct 20, 2016 7:32 am

gigo1988 wrote:Thank you for this answer. What do you think about Watchdog? I ve put transcode.py in my cronjob with arguments. After restart it starts every time the same channel. I think it ll be possible that Watchdog make a restart if some Options are not changed but my problem is to explain it. I can put for cheking a Lot of Things but i dont unterstand it. Do you think it is possible with file cheking and i Type http://localhost:9080/xyz.mkv.
I've never used watchdog, but I believe there are simpler solutions. A simple script that (re)starts your TV streams, waits for a few seconds and then starts the transcoder. Then you can use it in your cronjob,
Minimal Kiosk Browser (kweb)
Slim, fast webkit browser with support for audio+video+playlists+youtube+pdf+download
Optional fullscreen kiosk mode and command interface for embedded applications
Includes omxplayerGUI, an X front end for omxplayer

gigo1988
Posts: 31
Joined: Wed Sep 07, 2016 11:38 pm

Re: Real Time Transcoding of DVB TV Streams

Thu Oct 20, 2016 10:46 am

Thank you for your reply. I´ve do that. i´ve wrote a script which sleep for 60 seconds before restart. I hope that the transcoder give eos if the stream dont work correctly. after every step i think know it must be complet but every time new mistakes :D but as a hobby its cool.

gigo1988
Posts: 31
Joined: Wed Sep 07, 2016 11:38 pm

Re: Real Time Transcoding of DVB TV Streams

Thu Oct 20, 2016 10:48 am

I ve seen a mistake by the audio video sync if you dont transcode audio. It will stop for a moment every 5 seconds by transcoding a 1080i stream.

Return to “Graphics, sound and multimedia”

Who is online

Users browsing this forum: No registered users and 10 guests