Page 1 of 1

Transcode 4K video to 1080 HD

PostPosted: Thu May 19, 2016 6:40 am
by attonyzhou
Recently installed Serviio on my Mac and all was awesome, be able to view my 500G of all family photos/videos on my two Samsung TV happily. I kept transcoding=OFF as I didn’t want to lose resolution to let Serviio transcode them. I have some 1080p H264 *.mp4 file which can be played on Samsung E-series TV perfectly without transcoding.

Untill I bought a 4K video camera and captured some 4k videos, the assets can only be played on Mac. I edit them via iMovie then saved to 1080p *.mp4 before watching on TV. I though I should give a go of Serviio transcoding 4K to 1080p HD so that I can watch directly on my TV that doesn’t support 4K.

My 4k video files are *.MP4 which I assumed they’re MP4 container, codec is H264, resolution is 2160x3840. When I tried to play that file from TV with Seriio trancoding=off, TV report the file format isn’t supported.
When I turned serviio transcoding ON, TV reported resolution 2160x3840 isn’t supported. Looks Serviio is doing transcoding(to some format) with same solution.

So, I loacated profile file and added following under Samsung E TV session:

  Code:
         <!-- transcode 4K video to 1080*1920 H264 -->
         <!-- transcode with H264 video -->
         <Video targetContainer="mp4" targetVCodec="h264" targetACodec="ac3" maxHeight="1080" DAR="16:9" aBitrate="448" maxVBitrate="40000">
            <Matches container="*" vCodec="h264"  />
         </Video>



By which I wish Serviio will transcode 4K video to 1920x1080 file by assigning maxHeight="1080". However the TV is still reporting resolution 2160x3840 is not supported so transcoding/changing resolusion is not happening. My guess are a) option maxHeight="1080" doesn’t work b) the profile I inserted isn’t called. I tried with forceVTranscoding on as well.

Any one has experience implementing that? My serviio version is 1.6.1. Thanks.

Re: Transcode 4K video to 1080 HD

PostPosted: Thu May 19, 2016 12:18 pm
by atc98092
Did you restart the Serviio service (or reboot the computer) after you edited the profile? That is necessary for the change to take effect.

MP4 is not an acceptable target container. It can only be asf, mpeg (MPEG2PS), mpegts (MPEG2TS) or applehttp (HLS). Your TV should support MPEG or MPEGTS.

See this page for more transcoding information: http://www.serviio.org/index.php?option ... icle&id=24

Re: Transcode 4K video to 1080 HD

PostPosted: Sat May 21, 2016 11:07 am
by attonyzhou
Transcoding started to working with modified code:

  Code:
                        <!-- transcode 4K video to 1080*1920 H264 -->
                        <!-- transcode with H264 video -->
                        <Video targetContainer="mpeg" targetVCodec="h264" targetACodec="ac3" maxHeight="1080" maxVBitrate="20000">
                                <Matches container="mp4" vCodec="h264" profile="high" levelGreaterThan="4.2" />
                        </Video>


However, My TV keeps "loading" after around 20 secs, sometimes it will just exit. A performance problem of Mac transcoding?!

Re: Transcode 4K video to 1080 HD

PostPosted: Mon May 23, 2016 12:41 pm
by atc98092
I have no Mac experience, so I have to defer to someone else about this.

Re: Transcode 4K video to 1080 HD

PostPosted: Mon May 23, 2016 11:56 pm
by attonyzhou
atc98092 wrote:I have no Mac experience, so I have to defer to someone else about this.

Thanks mate for your reply – it has been very useful
My Mac is 2015 4K with Fusion driver – transcoding buffer is on solid disk so it should be quite fast enough. The problem is there is no native CPU/Memory monitoring utility on latest iOS, El Capitan, so I’m unable to know how much CPU/memory has been used during transcoding. The 4K video bitrate is 20Mbps and network is wired so bottleneck is not there either.

Under Serviio delivery setting, I set CPU number to “Optimal”, I may try to force it to maximum which is 4 and get it a go tonight.

Re: Transcode 4K video to 1080 HD

PostPosted: Tue May 24, 2016 4:18 am
by DenyAll
I also am not a MAC user but in general encoding to h264 can be processor intensive. There is no real advantage in trancoding on-the-fly to h264, so you may also want to try transcoding to mpeg2video which is far less intensive. Change your transcode line to (note - I have also changed the container type to mpeg-ts):

<Video targetContainer="mpegts" targetVCodec="mpeg2video" targetACodec="ac3" maxHeight="1080" maxVBitrate="20000">

Save and restart your MAC. ps: I set my CPU's to 4 rather than Optimal but can't really say it makes much difference that I have noticed.

Re: Transcode 4K video to 1080 HD

PostPosted: Tue May 24, 2016 5:00 am
by attonyzhou
DenyAll wrote:I also am not a MAC user but in general encoding to h264 can be processor intensive. There is no real advantage in trancoding on-the-fly to h264, so you may also want to try transcoding to mpeg2video which is far less intensive. Change your transcode line to (note - I have also changed the container type to mpeg-ts):

<Video targetContainer="mpegts" targetVCodec="mpeg2video" targetACodec="ac3" maxHeight="1080" maxVBitrate="20000">

Save and restart your MAC. ps: I set my CPU's to 4 rather than Optimal but can't really say it makes much difference that I have noticed.

Thanks for reply, will try mpeg2video too.
Tried with “mpeg2ts” container before, there were just severe pixilation on my TV so moved to “mpeg” container and pixilation problem disappeared.

Re: Transcode 4K video to 1080 HD

PostPosted: Tue May 24, 2016 11:42 pm
by attonyzhou
It turned out the problem is caused my old FFMPEG, version 2.4, included within Serviio by default. I upgrade to FFMPEG v3.0 and then I am able to get smooth transcoded video without disruption. Although, transcoding still takes upto 95% of my Quad Intel 3.1G CPU usage, Mpeg2 or H264 really doesn’t make too much difference.

Have gone through the FFMPEG release note, the later version supports Intel QSV (Quick Sync Video) technology which allows decoding and encoding using recent Intel CPU and integrated GPU. However, need a parameter “h264_qsv” passed to FFMPEG command like this:
  Code:
ffmpeg -i INPUT -c:v h264_qsv -preset:v faster out.qsv.mp4

Guess Serviio doesn’t really support this option so still using software transcoding. Anyone have an idea if Serviio has a plan to support it?

PS, when I watch transcoded video on TV, after end of a file, TV will report no network connection and exit DLNA, I have to re-enter to watch next one. When watch non-transcoded files, it’s able to return to video list nicely. Any idea on the cause?

Re: Transcode 4K video to 1080 HD

PostPosted: Wed May 25, 2016 12:14 pm
by atc98092
Samsung hasn't done a bang up job on their DLNA functionality. I often (like almost always) get a network disconnect after a video ends and it tries to load the next one. If I select the video manually, it plays fine. Sometimes I get the same disconnect error on initial attempt to play, and the second attempt works fine.

It's a Samsung issue, not Serviio. My Sony players never encounter the issue.

Re: Transcode 4K video to 1080 HD

PostPosted: Wed May 25, 2016 2:31 pm
by DenyAll
attonyzhou wrote:Guess Serviio doesn’t really support this option so still using software transcoding. Anyone have an idea if Serviio has a plan to support it?
It's being discussed - see https://bitbucket.org/xnejp03/serviio/i ... celeration

Re: Transcode 4K video to 1080 HD

PostPosted: Thu May 26, 2016 1:19 am
by attonyzhou
DenyAll wrote:

Found this there, looks it ought to work.

Support for an external ffmpeg with QSV included (--enable-libmfx) is now implemented. It's done only for h264 encoding. To enable this, you need
the proer FFmpeg and
set -Dserviio.useQSVAcceleration system variable in the startup script of the server

Re: Transcode 4K video to 1080 HD

PostPosted: Tue May 31, 2016 9:18 pm
by zip
.. for the future 1.7

Re: Transcode 4K video to 1080 HD

PostPosted: Wed Jun 01, 2016 5:18 am
by DenyAll
... and supported by your CPU.

Am including this link to a list of supported CPU for future reference - http://ark.intel.com/search/advanced?s= ... Video=true