Jump to content

transcoding SD content - aspect ratio & quality issues


veehexx1

Recommended Posts

veehexx1

server: Linux with docker container 4.5.4.0 using AMD athlon 3000g APU (Vega3) HW transcoding, with TVHeadend via native emby m3u.

clients: Shield pro 2019 & Windows Emby theatre

 

my test Source file is recorded livetv content at 720x576, from DVB-S2 in the UK

This appears to be a problem with any content that is in SD format and gets transcoded. With the source content in SD format and transcoding is used then the client will play back in a 4:3 ratio (480p) and very obvious compression artifacts. there's almost a watermark type effect vertically down the entire left side of the picture area that does not appear in the direct play source.

direct play does not exhibit either of these issues, and nore does transcoded HD content (720, 1080 or 4k). This is a bit of a problem as my main TV uses the shield which appears to transcode much more content than my Windows Theater client does and not all freesat UK channels are in HD still.

is there anything i can do to improve this behavior?

Link to comment
Share on other sites

pwhodges

Have you done anything to the recorded file?  What tuner is your stream coming from?

I just played back a 720x576 stream (channel 3, ITV, as it happens) in the TS container that Emby saved it in from my HDHomeRun tuner - with transcoding - and it played back correctly.  Mine's DVB-T, though, from Freeview.

Paul

Edited by pwhodges
Link to comment
Share on other sites

veehexx1

tuner is TBS6981. i just picked a random channel; 4seven for my test file. I've been a mythtv user for years without issue, and migrated to emby last weekend so there could be something i've mis-configured or overlooked or something...

just tried itv (non-HD) to match your test - same issue. direct play ok, transcoding put it into a forced 4:3. it even looks squashed horizontally.

sounds like theres something in the transcoding side with my setup. when all transcoding jobs are compelted i'll try software transcoding to see if that makes a difference...

Link to comment
Share on other sites

veehexx1

hardware transcoding issue, specifically with h264 (avc). Disabling hw h264 encoding in advanced options makes it scale properly.

is there anything i can do to fix that (eg, something at driver level), or is it firmly within hardware and ultimately a dedicated GPU is the only option?

 

if driver setting; bear in mind i'm linux, container and also headless server so cmdline only methods! i am using the latest 20.45 amd drivers rather than kernel.

Link to comment
Share on other sites

veehexx1

Hi @Luke, I've got 2 sets of info for you.

logs for HW encoder enabled (specifically 'VAAPI Device 4098:5592 - H.264 (AVC)' ticked) which has the 4:3 issue, and SW encoder (h.264 AVC unticked) which scales fine.

screenshots also taken of direct play from recorded LiveTV, and two for what it looks like with each encoder type.

direct play:

RecordedTV HW direct play 720x576.png

SW transcode:

RecordedTV SW transcode 480p 2mbps.png

HW transcode:

RecordedTV HW transcode 480p 2mbps.png

HW ffmpeg-transcode-6e0d47f1-6282-4136-b3e9-148f1cfd42af_1.txt SW ffmpeg-transcode-163f3ab2-4a63-4f01-b826-ba22e143a927_1.txt

Edited by veehexx1
Link to comment
Share on other sites

veehexx1

any thoughts to what could be the issue? i'm assuming its a software issue but i guess theres not much i can do but wait for the devs to fix... or is it something else like a hardware/driver issue i need to look at more?

Link to comment
Share on other sites

You get the same thing in Theater and Android ATV?

What about in a web browser?

Link to comment
Share on other sites

veehexx1

windows theater: yes; thats where the screenshots were taken from.

same experience on android (sheild pro 2019), LG SmartTV (device i originally found the issue on) and browser (win10 firefox) with hw transcoded SD content (as per screenshots).

Definately related to the h264 hw encoder on server side.

I'm torn on where i think the issue is. based off no one else experiencing this issue (either "me too", or in my searches for similar problems), it seems specific to my setup rather than Emby. But then if it was hardware/driver then i'd expect to see the problem across any h264 encoding like 4k, 1080 or 720p. I've also found very little info online about the Athlon 3000G cpu w/vega3 iGPU as majority seem to be using dGPU's.

I am open to buying a dGPU if thats what it needs (likely end up going ebay for nv quadro as single slot is hugely preferable), but i'm looking for something more conclusive than my hunches and guesses on this...

Link to comment
Share on other sites

When I look at the ffmpeg transcode log I do some errors/warnings such as:
18:53:00.563 [mpeg2video @ 0x25491c0] Invalid frame dimensions 0x0.

18:53:00.654 [h264_vaapi @ 0x25723c0] Driver does not support some wanted packed headers (wanted 0xd, found 0).
18:53:00.654 [h264_vaapi @ 0x25723c0] Driver does not support packed sequence headers, but a global header is requested.
18:53:00.654 [h264_vaapi @ 0x25723c0] No global header will be written: this may result in a stream which is not usable for some purposes (e.g. not muxable to some containers).

Out of curiosity has you tried to remux the source file and then trying the new file?

Link to comment
Share on other sites

veehexx1

same issue (assuming i've remuxed correctly). i'm not familiar at all with the correct process but i ran the orginal .ts file through VLC media > convert option. then used the 'Video - h264+mp3 (mp4)' profile. that output mp4 was copied into emby library.

HW encode scales to 4:3, SW encode keeps original apsect ratio.

Link to comment
Share on other sites

Would you be able to upload this file somewhere so we can take a look at it and use it to test?

If you know how to use ffmpeg I could give you a command line to cut the first 5 minutes which would be good enough for testing.

Link to comment
Share on other sites

Downloading it now.

ffmpeg -i input.mkv -c copy -t 300 output.mkv

It can be as simple as that.  300 is seconds in this case so 5 minutes.

Link to comment
Share on other sites

veehexx1

tried it with ffmpeg on the emby host (nb: emby is in a docker container on this host), and tested the output.mkv file; same issue with HW encoding rescaling to 4:3. direct play/sw encode at the correct 16:9.

Edited by veehexx1
Link to comment
Share on other sites

@ebr I've been trying to force a transcode of this file but can't do it.

It shows as 3.35 Mbps when direct playing but even setting shield to 1Mbps it's still direct playing.

It direct plays correctly.

Link to comment
Share on other sites

veehexx1

@cayars- you tagged/responded to the correct person?

Direct play works fine for me too. if i choose, say, 2mbit it will transcode. something sounds off...

Edited by veehexx1
Link to comment
Share on other sites

Yea I tagged the dev.

I'm trying to reproduce your issue but it plays back correctly for me. Tested on a couple of clients but couldn't get the shield to transcode code it.

I'm using an nvidia 1065 so this MAY seem to indicate the issue only happens in VAAPI or similar which I don't have and can't test.

Link to comment
Share on other sites

veehexx1

ah, didnt realise ebr was a dev..

probably not useful but this is the output from Dashboard with HW encode enabled and the 4:3 issue;

Theater set to 'auto' Quality - correct 16:9:

image.png.21f636bb6851a33239f41d4e42f03af0.png

Theater set to '480p - 2mbps', and exhibits the 4:3 issue. Transcode reason states bitrate exceeded.

image.png.0d1a11b058de8eafec65ff4b73a1e08d.png

 

annoyingly all my other hardware is either WAAY to old (nv 210), no iGPU, or probably not worth experimenting with as it so wildly different from original issue?

my laptop is linux with i5-5200u with intel gfx (5th gen doesn't do encoding, 6th gen does afaik).

gaming pc is windows i5-8600k & nv3090 so would likely show same results as you; nvenc works fine.

Edited by veehexx1
Link to comment
Share on other sites

veehexx1

span up a new emby server on gamingpc (windows10, i5-8600, nv3090), applied premier key to enable transcoding, copy source example file to it, and retest with hw encoding; problem is not present using nvenc.

also tested with the i5-8600k quicksync dx11 encoding (nvenc on decode side) and that too works as expected.

Neither of these HW encode tests show the vertical 'highlighted' line as you can see on the left side of the SW & HW transcode screenshots in my original post.

so... unless i've overlooked something, that confirms the issue is server side and either linux or VAAPI.

 

Edit:

turns out i5-5200u does h264 encoding, just not h265 (that is 6th gen>). Fedora with official rpm & HW transcodes fine. this is pointing to either AMD or container specific issue. guess theres no point trying to get my fedora server working anymore as AMD dont officially support it with their drivers (even though kernel comes with amdgpu modules). time to try my server with a ext usb drive and a properly support distro like ubuntu and retest...

Edited by veehexx1
  • Like 1
Link to comment
Share on other sites

veehexx1

same issue with fresh install.

ubuntu server 20.20 (non-LTS), amdgpu 20.45 (edit: same with 20.20 driver too), emby server 4.5.4.0, and same issue with HW encoding; 4:3 aspect ratio with the left vertical line.

I dont think theres anything more i can do now - i assume you guys have amd vaapi hardware to dev with to confirm if it's an emby issue? Otherwise it looks specific to my hardware/driver bug. i am swaying towards my hardware as if emby/drivers i'd of thought others would be reporting similar issues.

 

Edited by veehexx1
Link to comment
Share on other sites

veehexx1

that wasn't intentional although logs were grabbed with the transcode in progress. sounds like i should've stopped it before grabbing log files.

i'll reproduce from the same example file in a few hours and ensure the new logs contain the ExtraData section.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...