Options for transcode/streaming to Pi


15 posts
by robwriter » Mon Jun 04, 2012 10:58 pm
Just wondering if anyone has had any success setting up a server that will stream to the Pi, transcoding files on the fly?

I've managed to get MythTV to do this but only in a browser on another PC - I don't think there's an XBMC plugin that uses the HTTP streaming API yet. I could try to create one, but I'm looking for easier options!

Next up I tried PS3 Media Streamer - looks like it's supposed to support iPad/iPhone, but I can only get it to transcode to MPEG2, which is kinda missing the point!

Plex may be an option, as is MediaTomb, but thought I'd check if anyone else had success before I cycle through the rest of my options?

Ideally I'd like something that integrates with MythTV so that I can list all of my recordings from my MythTV backend server for playing on the Pi, but for now I'd just live with getting it working.
Posts: 108
Joined: Sat Feb 25, 2012 6:26 pm
by rrwood » Mon Jun 11, 2012 10:52 pm
I have had some success with streaming my PVR recordings via VideoLan and transcoding the MPEG-2 to H.264 on the fly, but the quality of this is very bad. I have not been able to verify where the issue is yet, server, network or Pi.

I'm thinking transcoding offline and then streaming is probably a better idea as will reduce load on server, I never need to record and watch instantly anyway.

Would be interested in knowing if anyone else gets a neater solution working.
Posts: 1
Joined: Mon Jun 11, 2012 10:41 pm
by lenod » Fri Jun 15, 2012 3:05 pm
This is also my goal, this is what I can tell:

I managed to record dvb-t with tvheadend into mkv but didnt manage to transcode it correctly.
I tried to cat directly the adapter output into a .ts.
I finally managed to transcode files produced by vdr using this tutorial : http://www.linuxtv.org/wiki/index.php/Post-processing.

It is quite long on the pi, but if I manage to fully script this I can use crontab to do it overnight.
It consists in using projectx to "repair" the stream (and avoid audio/video synchronization issues), mux the audio and video together (in case of several audio streams you must chose the right one, and I don't know how to do this automatically). Finally I transcoded the mpeg file into mpeg4 using ffmpeg. If I remember well, the command line was something like:
ffmpeg -i source.mpeg -acodec aac -vcodec mpeg4 -sameq target.avi

Note that this solution requires a lot of space (and projectx lets a lot of temporary files in the directory).

I am also interested in lightweight, clean solution to stream live tv and/or record and transcode it (no matter if it take 5 hours to transcode).
Posts: 20
Joined: Wed May 23, 2012 3:57 pm
by jdldb » Tue Jun 19, 2012 5:34 am
What kind of device (USB - DVB-T) capture card did you use ?

(looking at building an DVB-T recorder which records in 1 minute chunks to later process those video's).
Posts: 2
Joined: Tue Jun 19, 2012 5:32 am
by lenod » Tue Jun 19, 2012 8:22 am
It's an emtec dvbt-t usb stick (don't know the precise model, but the chipset is a YUAN one). But this is quite a low quality one.
Why would it be easier to record byt 1mn chunks?

Anyone has Ideas on how to deal with the multiple audio streams?
Posts: 20
Joined: Wed May 23, 2012 3:57 pm
by Arcain » Sun Jul 22, 2012 8:53 pm
lenod wrote:I managed to record dvb-t with tvheadend into mkv but didnt manage to transcode it correctly.


Mind sharing your build? I made my own and it works, but for very short time. After a minute or so i keep getting errors in TvHeadend log, screen gets choppy and buffers every few seconds plus, both my DVB-T stick (based on RTL2832u chipset) and the USB port in Pi heats up a lot. Pi uses up to 25% CPU when streaming SD signal to one client, expected it to be less. Any action being done on Pi (apt-get for example) makes it even worse so the stream is totally unplayable.

Same DVB-T stick works fine on x86 HTPC i have lying around with perfect signal quality and no heat issue.
Posts: 26
Joined: Fri Jun 15, 2012 1:31 pm
by lenod » Mon Jul 23, 2012 7:56 am
In fact it doesn't work more than that. My errors were something like discontinuity errors (and there were indeed discontinuities in the resulting video) and as for you, it's even worse if I do something else on the pi (even if the cpu usage is lower than 50%!).
My dvb-t usb stick also heats up on other computers, but even more on the pi.

I also had a similar issue with a webcam (discontinities and it seemed to draw all the current from my powered usb hub).

It might be a debian issue, because I think that some people had no trouble with the archlinux image.
Posts: 20
Joined: Wed May 23, 2012 3:57 pm
by Arcain » Mon Jul 23, 2012 1:29 pm
lenod wrote:It might be a debian issue, because I think that some people had no trouble with the archlinux image.


Which distribution are you using? I tried that on Raspbian with custom made 3.3.21 kernel (based on Raspbian .config, sources from apt-get) to get DVB support and being able to compile my DVB-T stick drivers. I'll try with ArchLinux later next week then to see if it helps.
Posts: 26
Joined: Fri Jun 15, 2012 1:31 pm
by lenod » Mon Jul 23, 2012 1:46 pm
I tried on regular debian with custom build.
Now I have raspbian, but I need to rebuild to get my usb stick working (even though I asked for the modules to be included and they seem to be, but maybe it still misses something), and I am too lazy to recompile my kernel again.
Posts: 20
Joined: Wed May 23, 2012 3:57 pm
by Arcain » Mon Jul 23, 2012 2:07 pm
Their default kernel (3.19 i think) should have both V4L and DVB support included (but no support for any card, even as a module afair) but i couldn't get kernel headers for that version to build a driver for the tuner. I simply grabbed a fresh one, built the kernel and driver, seemed like the only choice.

I'm not sure if that aint that heat issues. It seems that both ethernet and USB are on the same chip, which might be a bit too hot loosing performance so either tuner or network works unstable. I know there was some cache tweak for ethernet to work fine when downloading bigger files and it should be applied to Raspbian by default but not sure if it helps at all for USB.
Posts: 26
Joined: Fri Jun 15, 2012 1:31 pm
by Arcain » Wed Jul 25, 2012 7:35 pm
Installed ArchLinux and to be honest it seems to be more responsive than Raspbian, even without swap enabled by default. On the other hand i ran into few issues. At first i had to compile new kernel since the standard one and the fresh one from pacman couldn't find my DVB-T stick after install. Once i compiled kernel (3.1.9) i managed to build rtl2832u driver successfully, even load it but there's an error:

dvb-usb: no frontend was attached by 'DVB-T TV Stick'


That result's that tuner is not being detected by tvheadend at all. From what i remember same driver on Debian detected my stick as RTL2832u and at least was seen by tvheadend. Any ideas? https://github.com/ambrosa/DVB-Realtek-RTL2832U-2.2.2-10tuner-mod_kernel-3.0.0 - that's the driver i'm using.
Posts: 26
Joined: Fri Jun 15, 2012 1:31 pm
by Arcain » Wed Jul 25, 2012 10:10 pm
Well, managed to get tuner to work. Recompiled kernel again disabling any frontend available there. Tvheadend finally sees the stick, but it's still unusuable, at least with tvheadend. It's better than with what i had on Raspbian, buffers every 15-20 seconds instead of 3-5, but it's still impossible to watch it live nor record as there are same errors in tvheadend log in both cases. I'll try with MythTV backend (there's a package in pacman) later out of curiosity but starting to doubt if Pi is powerful enough to handle even SD streaming from DVB-T Tuner.
Posts: 26
Joined: Fri Jun 15, 2012 1:31 pm
by Arcain » Fri Jul 27, 2012 6:47 pm
It's worse on MythTV. Backend along with MySQL is using 100% Pi CPU most of the time. Sound cracks, artifacts on the screen, unplayable. Not sure, maybe another tuner and/or antena would help but i'm out of options and really not in position to buy another stuff just to check, especially that the same tuner with my current antena works perfectly on x86 HTPC running OpenELEC. If you got any better results, please let me know. I'm done with that for now.
Posts: 26
Joined: Fri Jun 15, 2012 1:31 pm
by lenod » Mon Jul 30, 2012 5:29 pm
I think mythtv is a bit too heavy (as well as mysql) for the Pi.
Posts: 20
Joined: Wed May 23, 2012 3:57 pm
by Arcain » Mon Jul 30, 2012 5:40 pm
MythTV could do ok, just without MySQL on the same machine. I found MuMuDVB handling streams quite well so if you don't need a PVR and need Live TV only you might want to try it. XBMC was able to play its streams fine, same for VLC, almost no artifacts, no buffering, no problems with sound. MuMu uses a bit more CPU (30% in unicast, 50% in multicast), but that's not a problem here.

Unfortunatelly for me, it doesn't support recording so i would have to run it as multicast and add MuMuDVB streams as IPTV channels to Tvheadend for example. If i do that (running both software on Pi at the same time) it become unplayable again. After all, the problem might be in Tvheadend or kernel. Maybe there's a change to optimize it more and it's gonna work on Pi one day.
Posts: 26
Joined: Fri Jun 15, 2012 1:31 pm