PDA

View Full Version : HEVC/x265 stream transcode and restream: I did it!



David75
Sun, 12-21-2014, 10:46 AM
Well, maybe you don't remember but I do restream a particular TV channel called Nolife.

Technically, my DSL (Free, Illiad group) provider at work gives access to IP TV streams through VLC or any other compatible player. It's the only provider doing this with quality/no restriction.
At home, I can't use DSL sluggish connexion, so I opted for cable access. I have a great connexion, but no access to IPTV. And Nolife is only accessible that way, with an ISP box giving you IPTV streams. But all other ISPs close all accesses to the streams.
Since there's only one ISP player/decoder at home for my wife and I don't want to pay 10€/month for 2 hours a week at max, I decided I would cook myself a solution.

I simply use VLC as a transcoder and stream server.
At first I did with x264. Since DSL is limited to 1mbps upload, the quality is below average, even more so I only had a low power box to transcode at work. From the 2 qualities available, I had to choose the lower one.
576p@50 2mbps stream I had to transcode to 1mbps @25fps to upload to my home. I also had to reduce resolution to 490 lines because of the CPU.

Recently, there's been an upgrade, and now I can transcode from the 1080p@50 5mbps stream to 1156*648 resolution @25fps 1mpbs HEVC/x265 stream.
The quality boost is simply incredible.
On my 42" low quality screen, the difference at 3 meters watching distance is stunning.
Every part of the screen that does not move becomes cristal clear. Particularly text of any size.
Oh, I do watch the stream with an openelec box. Latest versions have HEVC/x265 support.

The last hurdle, not the easiest one, would be to get rid of some rebuffering happening at times. I have a stable stream, less than 60-70% of the upload for 5 minutes, then there's a sudden spike in upload and buffering.

I have been able to get rid of CPU spikes, resulting in lost frames, which made them easy to spot.
I am not yet able to degrade quality when video complexity increases. At least not enough to prevent the rebuffering.
Then there are some cases when there are no upload spikes and no cpu spikes, but there's some rebuffering. My guess is that I get some packet or frame loss, then these packets are restreamed. If the restream size is superior to the buffer... rebuffering occurs.

I don't know if you guys played with encoders and streams. I've been doing it for 3 to 4 years now, only with the trial and error method.
I tried searching for help on the web, but it seems no one really streams with HEVC/x265. Maybe because they think it's not possible with today's computers and software. Well it was the case 6 months ago, but with powerful CPUs becoming cheaper and x265 getting more and more functionnal, it's clearly possible now.


If you happen to have info, threads, links on the matter, thanks for sharing ;) Not the vlc BBS, there's hardly any answer to questions. I was lucky to get an answer on an undocumented criteria for output rez... but that was a first and last case...

Have fun!

Kraco
Sun, 12-21-2014, 11:11 AM
You absolutely need to watch these 2 hours a week live and streamed? Seems to me that if it's so little so rarely, you might as well rip it and watch it when it's finished. I guess another choice would be to watch it a few minutes delayd, which ought to solve all the buffering troubles.

I don't really have anything concrete to say here. Never touched stuff like that, myself. The only video encoding I've done are x264 reencodes of anime eps and video from my camera.

Congrats for your nearly success, in any case!

David75
Sun, 12-21-2014, 12:07 PM
Well, this is a Japanese videoclip charts live. And there are comments on dedicated BBSes. So the smaller the buffer/delay, the better if I trully want to participate/enjoy.
That's why I have to find the best compromise and still have it work regardless of the difficulties.
One solution would be fiber at work, only that it should have been there 3 years ago and every semester it gets delayed.
Since the upload is 10 times the best stream bandwidth, I'd only need a VPN to access those streams from anywhere without transcoding.
Beauty of this is that this provider has a builtin OpenVPN server in his boxes... making the process dead simple. Only I do not have fiber there yet, hence the solutions I use.
Buffering isn't that often and I'm used to it, but I could do with it if there's somewhere on the intrawebs where they fiddle with x265 and found some solutions.