belos
Posts: 3
Joined: Tue Nov 20, 2018 4:08 pm

Raspberry Pi TV Hat DVB-T2 Gateway (Tvheadend with FFmpeg and realtime hardware video stream transcoding)

Tue Nov 20, 2018 4:23 pm

This is a very-very short installation manual that gives 100% working result.
Hardware: Raspberry Pi 3 Model B and Raspberry Pi TV Hat.

1. Install Raspbian Jessie (not Raspbian Stretch!) and update the system.

2. Install Tvheadend v4.3 (unstable) as described here:
https://tvheadend.org/projects/tvheaden ... tories#fn3

3. Configure Tvheadend, and test viewing your air TV channels using default MPEG-TS Pass-through "pass" stream profile.

4. Download and compile OpenMAX-enabled FFmpeg:
https://www.reddit.com/r/raspberry_pi/c ... ith_ffmpeg

4. Run the following command and make sure you can see the test picture. This means that hardware acceleration works properly:

Code: Select all

"gst-launch-1.0 -v videotestsrc ! omxh264enc ! h264parce ! omx264dec ! glimagesink"

5. Create new streaming profile in Tvheadend web interface (Configuration->Stream->Stream Profiles) using "MPEG-TS Spawn/ built-in" type with the command line:

Code: Select all

"ffmpeg -i - -f mpegts -c:a copy -c:v h264_omx -b:v 368k pipe:1"

This will generate the stream with the bitrate about 500-600 kbit/s instead of several Mbit/s using GPU hardware transcoding.
During the transcoding CPU usage will not be higher than 40-60% comparing to 150% in case if you are using any other software transcoding. CPU temperature will not raise above 60-65°C.

Most probably this configuration will work on any Raspberry Pi (even on RPi Zero), of course, depending on the input signal complexity.
I also have Kodi on my RPi Zero connected to TV that is used as a client system for the described installation.

Hope this info will help someone. I´m open for any comments and questions.

fruitoftheloom
Posts: 19782
Joined: Tue Mar 25, 2014 12:40 pm
Location: Delightful Dorset

Re: Raspberry Pi TV Hat DVB-T2 Gateway (Tvheadend with FFmpeg and realtime hardware video stream transcoding)

Tue Nov 20, 2018 6:23 pm

belos wrote:
Tue Nov 20, 2018 4:23 pm
This is a very-very short installation manual that gives 100% working result.
Hardware: Raspberry Pi 3 Model B and Raspberry Pi TV Hat.

1. Install Raspbian Jessie (not Raspbian Stretch!) and update the system.

2. Install Tvheadend v4.3 (unstable) as described here:
https://tvheadend.org/projects/tvheaden ... tories#fn3

3. Configure Tvheadend, and test viewing your air TV channels using default MPEG-TS Pass-through "pass" stream profile.

4. Download and compile OpenMAX-enabled FFmpeg:
https://www.reddit.com/r/raspberry_pi/c ... ith_ffmpeg

4. Run the following command and make sure you can see the test picture. This means that hardware acceleration works properly:

Code: Select all

"gst-launch-1.0 -v videotestsrc ! omxh264enc ! h264parce ! omx264dec ! glimagesink"

5. Create new streaming profile in Tvheadend web interface (Configuration->Stream->Stream Profiles) using "MPEG-TS Spawn/ built-in" type with the command line:

Code: Select all

"ffmpeg -i - -f mpegts -c:a copy -c:v h264_omx -b:v 368k pipe:1"

This will generate the stream with the bitrate about 500-600 kbit/s instead of several Mbit/s using GPU hardware transcoding.
During the transcoding CPU usage will not be higher than 40-60% comparing to 150% in case if you are using any other software transcoding. CPU temperature will not raise above 60-65°C.

Most probably this configuration will work on any Raspberry Pi (even on RPi Zero), of course, depending on the input signal complexity.
I also have Kodi on my RPi Zero connected to TV that is used as a client system for the described installation.

Hope this info will help someone. I´m open for any comments and questions.

Raspbian Jessie is no longer supported and any user not aware will try this on the 3B+ / 3A+......
adieu

My other Computer is an Asus CS10 ChromeBit running Chrome Operating System.
HP Envy 4500 Wireless Printer supported by HPLIP software in Raspbian Buster.
Raspberry Pi Model 2B v1.1

belos
Posts: 3
Joined: Tue Nov 20, 2018 4:08 pm

Re: Raspberry Pi TV Hat DVB-T2 Gateway (Tvheadend with FFmpeg and realtime hardware video stream transcoding)

Wed Nov 21, 2018 8:35 am

Thanks, that´s right. But sometimes we have to use old, but proved solutions to achieve the desired result.

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

Re: Raspberry Pi TV Hat DVB-T2 Gateway (Tvheadend with FFmpeg and realtime hardware video stream transcoding)

Wed Nov 21, 2018 9:36 am

My rtranscode V4 package offers a complete transcoding solution which works with different backends on both Jessie and Stretch. Transcoding on Jessie is more efficient though because the gst-omx module has implemented hardware scaling, which is missing in the Stretch version.

viewtopic.php?f=38&t=123876
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

fanoush
Posts: 454
Joined: Mon Feb 27, 2012 2:37 pm

Re: Raspberry Pi TV Hat DVB-T2 Gateway (Tvheadend with FFmpeg and realtime hardware video stream transcoding)

Wed Nov 21, 2018 12:47 pm

Just wondering what type of trancoding (resolution? codec types?) is this targeted for? Can this transcode HEVC/h265 to h264 in realtime on pi3b+? Or does it trancode mpeg-2 to h264? Can it do mpeg-2 in realtime without paid HW codec?

john564
Posts: 83
Joined: Tue Oct 30, 2012 7:05 am

Re: Raspberry Pi TV Hat DVB-T2 Gateway (Tvheadend with FFmpeg and realtime hardware video stream transcoding)

Sun Jul 07, 2019 11:21 am

OMG...

Code: Select all

gst-launch-1.0 -v videotestsrc ! omxh264enc ! h264parce ! omx264dec ! glimagesink
should be

Code: Select all

gst-launch-1.0 -v videotestsrc ! omxh264enc ! h264parse ! omxh264dec ! glimagesink
list parameters with gst-inspect-1.0

you have no idea how long time I spent to find out the 100% working guide was wrong

fruitoftheloom
Posts: 19782
Joined: Tue Mar 25, 2014 12:40 pm
Location: Delightful Dorset

Re: Raspberry Pi TV Hat DVB-T2 Gateway (Tvheadend with FFmpeg and realtime hardware video stream transcoding)

Sun Jul 07, 2019 11:57 am

john564 wrote:
Sun Jul 07, 2019 11:21 am
OMG...

Code: Select all

gst-launch-1.0 -v videotestsrc ! omxh264enc ! h264parce ! omx264dec ! glimagesink
should be

Code: Select all

gst-launch-1.0 -v videotestsrc ! omxh264enc ! h264parse ! omxh264dec ! glimagesink
list parameters with gst-inspect-1.0

you have no idea how long time I spent to find out the 100% working guide was wrong

I stated above the guide is for Jessie, not Stretch or Buster :shock:
adieu

My other Computer is an Asus CS10 ChromeBit running Chrome Operating System.
HP Envy 4500 Wireless Printer supported by HPLIP software in Raspbian Buster.
Raspberry Pi Model 2B v1.1

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 6873
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: Raspberry Pi TV Hat DVB-T2 Gateway (Tvheadend with FFmpeg and realtime hardware video stream transcoding)

Sun Jul 07, 2019 12:39 pm

It's not a jessie/stretch/buster complaint, but the typo with h264parce instead of h264parse.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

belos
Posts: 3
Joined: Tue Nov 20, 2018 4:08 pm

Re: Raspberry Pi TV Hat DVB-T2 Gateway (Tvheadend with FFmpeg and realtime hardware video stream transcoding)

Sun Jul 07, 2019 2:53 pm

6by9 wrote:
Sun Jul 07, 2019 12:39 pm
It's not a jessie/stretch/buster complaint, but the typo with h264parce instead of h264parse.
Actually, you can skip this gst-launch-1.0 command and go strait to number 5 :)
I am still on Jessie. If you want, you can try to repeat it on Buster and tell the community if it works or not. I can repeat it in August when I have physical access to the system.

Update as of 16.07.2019:
I confirm, that the above instruction also works on Raspbian Buster. It´s easy and free.
Just compile FFmpeg with options, install TVheadend 4.3, and use Spawn profile for the HW-accelerated stream transcoding.
tvh1.png
tvh1.png (80.74 KiB) Viewed 3 times
tvh3.png
tvh3.png (228.4 KiB) Viewed 3 times
tvh4.jpg
tvh4.jpg (170.31 KiB) Viewed 3 times

Return to “HATs and other add-ons”