x264 encode files won't play on Amazon Fire TV

Started by kimfr, October 25, 2018, 06:18:18 PM

Previous topic - Next topic

kimfr

Hi there

I'm using avidemux to convert 1080i ts files capture with Plex from either satellite or cable. I can play the re-encodes 1080p25 files on my Apple TV 4 without any transcoding but on my Amazon Fire TV Plex keeps transocding.

The Amazon Fire TV says that h264 level 50 is higher then the supported level 40.

I have tried to get avidemux to encode at level 4 - mediainfo also reports the "Format profile" as "High@L4" but the file still gets transcoded.

Converting the same .ts file with the following ffmpeg command doesn't cause the Plex/Amazon Fire TV to transcode.
ffmpeg -i <filename ts> -vf yadif=0:-1:0 -c:v libx264 -preset slow -crf 17 -level 4.0 -c:a copy <filename mp4>

I have attached the avidemux py file which I'm using.

Any idea why this is happening?

I'm using openSUSE Leap 42.3 and 15 - avidemux is from the Packman repository - currently version 2.7.1

eumagga0x2a

Maybe the actual bitrate is too high for Fire TV? I can't test, have neither.

For unrelated reasons I would recommend building Avidemux from the current git instead of using the 2.7.1 release.

kimfr

Bit rate shouldn't be the issue, if I remember correctly the Fire TV will accept up to 20MBit/s, mediainfo (as much as it can be trusted...) report "Bit rate" 4985 kb/s - for ffmpeg version mediainfo reports 7266 kb/s.

Although my Linux skills are not too bad - I don't have much experience in building code from git hub / scratch - will have to look info that and see if that helps.


eumagga0x2a

Please test with "Main" instead of "High", test also with 720p resolution.

Using current git likely won't help with this particular issue, but quite many important bugs incl. two regressions were fixes since the last release.

eumagga0x2a

I could think of Avidemux writing 50 fps to the container which might be problematic. Also the comparison of time base values shows differences:

ffmpeg: 25 fps, 25 tbr, 12800 tbn, 50 tbc

Avidemux: 25.01 fps, 25 tbr, 50k tbn, 100 tbc

– much higher values in the output of Avidemux.

eumagga0x2a

Would you please test whether adding the "resample" filter with target FPS set to 25 after the deinterlacer in the filter chain helps?

kimfr

I did test with both reSample and running 720p. The reSample into 1080p didn't help but 720p did however work fine. I also went ahead and tried the latest version from github - still the same results.

I do however think that I have found out where the issue is. According my google research, Level 4.0 should not contain more then 4 ReFrames at 1080p. Looking at the mp4 file generated with avidemux, I noticed that mediainfo reported "Format settings, ReFrames : 5 frames" but the ffmpeg generate file only reported "4 frames".

In the avidemux GUI, I'm using the predefined "Preset: slow" and "Profile: high". All I then change is "IDC Level" to "4" and Rate Control I use "Constant Rate Factor (Single Pas)" which I set to "17".

After some more testing, I found that you need to have "useAdvancedConfiguration=True" in my py file (or select it via the GUI after picking the above predefined settings).

With these modifications, I have now successfully re-encode 2 files and mediainfo reports "4 ReFrames", this at 1080p25. These mp4 files play without being transcoded on my Amazon Fire TV.

Not sure if this is a bug in Avidemux or "working as design"?

I have attached an example of my working py file.

btw, using "useAdvancedConfiguration=True" as per above method works using the latest avidemux3 from the Packman repository.

eumagga0x2a

Thank you for identifying the cause which was the selected x264 preset "slow" + profile "high". I think it is "working as designed" as preset and profile take precedence over conflicting settings. A possible enhancement in Avidemux could be making disabled advanced settings reflect the actual parameters enforced by preset and profile.

kimfr

Quoteas preset and profile take precedence over conflicting settings
I'm really glad as I haven't got much idea  what all those settings are :-[ - I just Google and found a suggestion which was to use preset slow and profile High with a CRF of 17 - tested and found it looked good enough  ;)

QuoteA possible enhancement in Avidemux could be making disabled advanced settings reflect the actual parameters enforced by preset and profile.
Has my vote - probably a good idea as I was looking at the information in py file and couldn't make it match what I saw in mediainfo for example.

eumagga0x2a

Quote from: kimfr on October 29, 2018, 09:37:07 AM
QuoteA possible enhancement in Avidemux could be making disabled advanced settings reflect the actual parameters enforced by preset and profile.
Has my vote - probably a good idea as I was looking at the information in py file and couldn't make it match what I saw in mediainfo for example.

Wanna submit a patch? I won't have time for this work in foreseeable future.