Jump to content


Photo

2 years later still not hdr when transcoding or remuxing


  • Please log in to reply
59 replies to this topic

#41 appoli OFFLINE  

appoli

    Advanced Member

  • Members
  • 38 posts
  • Local time: 11:59 PM

Posted 07 February 2020 - 04:04 AM

Oye, still getting a washed out/grainy picture with the mp4 container and the hev1 tag (once again, thank you for the link to the remux command & the TestFlight invite!).

Would you mind spelling out the details as to what this silly Apple TV wants in terms of HDR?

I did a bit of a search before hand, but wasn’t really sure what I should be looking for. Saw that it wants that hevc1 profile, which I assumed was taken care of with the added flag (unless the color profile or something I’m not very familiar needs to brought in line separately?).
The audio is eac3 & based on the search that is OK.

When I play the file there is no ffmpeg transcoding log item made & it’s direct played/streamed (don’t know the difference - think one is where the container needs to be changed, but that’s been handled so if that’s the case then it’s the other one).
I can throw up some metadata or the ffmpeg log file from when I was playing the video via my iPhone web browser.

And I will also mention that during the remux I believe there was a comment made about a sync file or something not being present for the subtitle files? Don’t remember the specifics, but it seemed to be mentioned toward the end where the subs data is if that means anything. Based on the research I did previously maybe this has something to do with it as that seems to be one of the big benefits of the whole imp4 thing, but there are also no subs being used while playing the file as an FYI.

Thanks again for the help guys!
Hopefully I won’t have the same buffering issues vdatanet was having! (And thanks for bringing up Atmos in that thread - I’m like my audio fidelity high & was very pleased with the improved surround performance I’m getting with the new TV. Guess the old one was doing a bad job at passing the files through to my receive which is too old to have 4K/HDR leaving me to use optical from the TV. Apple does it again...but don’t think it was much different when it was coming from the ATV... Regardless the much improved performance got me considering upgrading to an Atmos setup as I have plenty of nice speakers laying around. Saved some money on that front for now 🙂)

#42 vdatanet OFFLINE  

vdatanet

    Advanced Member

  • Members
  • 1739 posts
  • Local time: 05:59 AM
  • LocationCalafell, Spain

Posted 07 February 2020 - 04:10 AM

It's crucial to know if it's direct played/streamed(remuxed). If it's remuxed, h265 will be transcoded to h264. We need to know the remux reason, bandwidth, audio codec, subtitles? Can you post your remux log?


Edited by vdatanet, 07 February 2020 - 04:11 AM.


#43 vdatanet OFFLINE  

vdatanet

    Advanced Member

  • Members
  • 1739 posts
  • Local time: 05:59 AM
  • LocationCalafell, Spain

Posted 07 February 2020 - 04:15 AM

Regarding ATMOS, I would like to say that Apple TV is only compatible with ATMOS / EAC3, not TrueHD. This is limited to streaming services. ATMOS local content is usually TrueHD. If you need that, get an Nvidia Shield.



#44 ebr OFFLINE  

ebr

    Chief Bottle Washer

  • Administrators
  • 50059 posts
  • Local time: 11:59 PM

Posted 07 February 2020 - 09:24 AM

Oye, still getting a washed out/grainy picture with the mp4 container and the hev1 tag (once again, thank you for the link to the remux command & the TestFlight invite!).

Would you mind spelling out the details as to what this silly Apple TV wants in terms of HDR?

I did a bit of a search before hand, but wasn’t really sure what I should be looking for. Saw that it wants that hevc1 profile, which I assumed was taken care of with the added flag (unless the color profile or something I’m not very familiar needs to brought in line separately?).
The audio is eac3 & based on the search that is OK.

When I play the file there is no ffmpeg transcoding log item made & it’s direct played/streamed (don’t know the difference - think one is where the container needs to be changed, but that’s been handled so if that’s the case then it’s the other one).
I can throw up some metadata or the ffmpeg log file from when I was playing the video via my iPhone web browser.

And I will also mention that during the remux I believe there was a comment made about a sync file or something not being present for the subtitle files? Don’t remember the specifics, but it seemed to be mentioned toward the end where the subs data is if that means anything. Based on the research I did previously maybe this has something to do with it as that seems to be one of the big benefits of the whole imp4 thing, but there are also no subs being used while playing the file as an FYI.

Thanks again for the help guys!
Hopefully I won’t have the same buffering issues vdatanet was having! (And thanks for bringing up Atmos in that thread - I’m like my audio fidelity high & was very pleased with the improved surround performance I’m getting with the new TV. Guess the old one was doing a bad job at passing the files through to my receive which is too old to have 4K/HDR leaving me to use optical from the TV. Apple does it again...but don’t think it was much different when it was coming from the ATV... Regardless the much improved performance got me considering upgrading to an Atmos setup as I have plenty of nice speakers laying around. Saved some money on that front for now )

 

Did you go into the playback settings and disable the option to use MPV as the player?



#45 RanmaCanada OFFLINE  

RanmaCanada

    Advanced Member

  • Members
  • 309 posts
  • Local time: 11:59 PM

Posted 07 February 2020 - 11:15 PM

Hi.  No, what you assumed is not completely accurate.

 

If your items are in Apple-friendly containers (mp4) then they will direct play with HDR (assuming everything else about them is compatible as well) in the beta version of our app.  When appropriate, we are using HLS to send streams to all of our apps already.  The only issue is the one instance of HEVC via HLS which needs to be adjusted.  All other codecs already work perfectly fine via our streaming and HLS.

And this is 100% the problem with Apple TV.  Because it doesn't understand MKV container, you can't just mux an MKV to mp4 and expect it to work, as the mp4 won't understand the metadata.  Infuse and mrmc manage this through "magic". (they don't give information on how they managed to pull it off)  Once again, Apple is forcing you to conform to "their standard" when a standard already exists.

 

If your video file's audio track is already AC3:

ffmpeg -i "source.mkv" \
-threads 4 \
-map 0:0 -map 0:1 \
-c:v:0 copy \
-c:a:0 copy \
-tag:v hvc1 -movflags +faststart \
"video.mp4"

If your video file needs it's audio track converted to AC3:

ffmpeg -i "source.mkv" \
-threads 4 \
-map 0:0 -map 0:1 \
-c:v:0 copy \
-c:a:0 ac3 \
-tag:v hvc1 -movflags +faststart \
"video.mp4"

 

I found this command on a reddit post about this very problem, from about a year ago.  It's apparently supposed to work, but as only a few of my users have apple tv's, I can not test if this works.  In the end, the user that started this reddit thread, got fed up, and just bought Infuse, as most people have done.



#46 Luke OFFLINE  

Luke

    System Architect

  • Administrators
  • 149390 posts
  • Local time: 11:59 PM

Posted 11 February 2020 - 02:01 PM

Using native player: When we say that the HDR does not work it is not quite true, what really happens is that when Emby delivers HEVC HDR content in an MKV container, it is transcoded to H264 losing the HDR and showing washed colors. If the container is MP4, and audio and video are supported by Apple TV, playback is direct and HDR is triggered. Then you have match content, visual seek and visual chapter navigation. 

 

HDR playback using MPV player is horrible and HDR is not triggered.

 

If video and audio is supported by Apple TV you don't need to re-encode your media, you just need to repack using an MP4 container. You also need to add a video tag hvc1, otherwise your media will be transcoded:

 

https://emby.media/c...14402/?p=829255

 

You can't use Emby conversion tool, because it doesn't add video tag hvc1. @Luke Is it possible to add that tag when converting or remuxing to MP4 H265?

 

If you want to be a beta tester, you can send a PM to @ebr providing him your app store mail.

 

@vdatanet In the upcoming 4.4 server release, The convert feature will now write the hvc1 codec tag when converting into an mp4 container.



#47 vdatanet OFFLINE  

vdatanet

    Advanced Member

  • Members
  • 1739 posts
  • Local time: 05:59 AM
  • LocationCalafell, Spain

Posted 11 February 2020 - 04:49 PM

@vdatanet In the upcoming 4.4 server release, The convert feature will now write the hvc1 codec tag when converting into an mp4 container.

 

 

hvc1 codec tag is still missing in 4.4.0.13. Why conversion is so slow? If I convert myself using command line is 10 times faster.

Attached Files



#48 Luke OFFLINE  

Luke

    System Architect

  • Administrators
  • 149390 posts
  • Local time: 11:59 PM

Posted 11 February 2020 - 05:06 PM

It will need to do a full transcode to write it.



#49 vdatanet OFFLINE  

vdatanet

    Advanced Member

  • Members
  • 1739 posts
  • Local time: 05:59 AM
  • LocationCalafell, Spain

Posted 11 February 2020 - 05:19 PM

Why conversion is so slow? If I convert myself using command line is 10 times faster.

 

 

Enabling full convert speed made conversion speed faster.


Edited by vdatanet, 11 February 2020 - 05:19 PM.


#50 vdatanet OFFLINE  

vdatanet

    Advanced Member

  • Members
  • 1739 posts
  • Local time: 05:59 AM
  • LocationCalafell, Spain

Posted 11 February 2020 - 05:20 PM

It will need to do a full transcode to write it.

Ok, I'll wait for a full transcode and I'll report back.



#51 vdatanet OFFLINE  

vdatanet

    Advanced Member

  • Members
  • 1739 posts
  • Local time: 05:59 AM
  • LocationCalafell, Spain

Posted 11 February 2020 - 06:19 PM

It will need to do a full transcode to write it.

 

Video tag is not correct. It's hev1 instead of hvc1. Apple TV native player transcodes because tag hvc1 is missing.



#52 Luke OFFLINE  

Luke

    System Architect

  • Administrators
  • 149390 posts
  • Local time: 11:59 PM

Posted 11 February 2020 - 07:00 PM

Video tag is not correct. It's hev1 instead of hvc1. Apple TV native player transcodes because tag hvc1 is missing.

 

can you post the media info from the web app?



#53 vdatanet OFFLINE  

vdatanet

    Advanced Member

  • Members
  • 1739 posts
  • Local time: 05:59 AM
  • LocationCalafell, Spain

Posted 12 February 2020 - 01:33 AM

can you post the media info from the web app?


@softworkz Codec tag is hev1, then Apple TV transcodes video because it requires hvc1. Doing this, it direct plays:
ffmpeg -i input.mkv -map 0:0 -map 0:1 -c:v copy -c:a copy -tag:v hvc1 output.mp4
5e438d5e0cbb2_Anotacin20200212062622.jpg

#54 softworkz ONLINE  

softworkz

    Advanced Member

  • Developers
  • 2407 posts
  • Local time: 05:59 AM

Posted 12 February 2020 - 09:13 PM

@vdatanet - I'm not sure about what situation you're talking here.

 

Could you please show an ffmpeg log from Emby to which you think your suggestion should be applied to?



#55 vdatanet OFFLINE  

vdatanet

    Advanced Member

  • Members
  • 1739 posts
  • Local time: 05:59 AM
  • LocationCalafell, Spain

Posted 13 February 2020 - 03:26 AM

@vdatanet - I'm not sure about what situation you're talking here.

 

Could you please show an ffmpeg log from Emby to which you think your suggestion should be applied to?

 

@softworkz

 

I will try to summarize it:

 

1. As Apple TV does not support direct MKV playback, I want to repack all my HEVC HDR MKVs to MP4, to avoid H265 to H264 transcoding

2. There are many tools that do the job, but my server is headless and I prefer to run commands on the server side

3. I use a command similar to this one, depending on audio tracks:

ffmpeg -i input.mkv -map 0:0 -map 0:1 -c:v copy -c:a copy -tag:v hvc1 output.mp4

This way Apple TV can direct play those MP4s, the key is: -tag:v hvc1, without that tag, video is transcoded when played on Apple TV

 

4. As I'm a bit lazy, I don't want to write those commands and I want to use Emby built-in conversion utility.

5. The problem is that tag is not written:

6. This is the command:

>>>>>  Legacy Command

/opt/emby-server/bin/ffmpeg -re  -f matroska -i file:"/media/4k/Star Wars Episodio 4 [4K UHDrip][2160p][HDR][AC3 5.1-DTS 5.1 Castellano-DTS 5.1-Ingles+Subs][ES-EN]/Star Wars Episodio 4 4Krip2160.www.pctnew.org.mkv" -map 0:0 -map 0:1 -map 0:2 -map 0:3 -sn -c:v:0 copy -vsync -1 -map_metadata -1 -map_chapters -1 -threads 0 -codec:a:0 aac -metadata:s:a:0 language=spa -disposition:a:0 default -ac:a:0 6 -ab:a:0 384000  -codec:a:1 copy -metadata:s:a:1 language=spa -disposition:a:1 none -codec:a:2 aac -metadata:s:a:2 language=eng -disposition:a:2 none -ac:a:2 6 -ab:a:2 384000  -y "/var/lib/emby/sync/6/14/04e7fd2e-258f-4108-ab47-8d942dfcef91.mp4"

>>>>>  Actual Command

/opt/emby-server/bin/ffmpeg -loglevel +timing -y -print_graphs_file /var/lib/emby/logs/ffmpeg-remux-04e7fd2e-258f-4108-ab47-8d942dfcef91_1graph.txt -copyts -start_at_zero -f matroska,webm -re -c:v:0 hevc -i "/media/4k/Star Wars Episodio 4 [4K UHDrip][2160p][HDR][AC3 5.1-DTS 5.1 Castellano-DTS 5.1-Ingles+Subs][ES-EN]/Star Wars Episodio 4 4Krip2160.www.pctnew.org.mkv" -map 0:0 -map 0:1 -map 0:2 -map 0:3 -sn -c:v:0 copy -c:a:0 aac -ab:a:0 384000 -ac:a:0 6 -metadata:s:a:0 language=spa -disposition:a:0 default -c:a:1 copy -metadata:s:a:1 language=spa -disposition:a:1 0 -c:a:2 aac -ab:a:2 384000 -ac:a:2 6 -metadata:s:a:2 language=eng -disposition:a:2 0 -avoid_negative_ts disabled -f mp4 -map_metadata -1 -map_chapters -1 "/var/lib/emby/sync/6/14/04e7fd2e-258f-4108-ab47-8d942dfcef91.mp4"

7. Since version 4.4.0.13, a video tag is written, but it writes hev1 instead of hvc1.

8. Videos tagged as hev1 are transcoded when played on Apple TV

 

My suggestion is to write hvc1 tag instead of hev1, if possible.

 

Thanks!  


Edited by vdatanet, 13 February 2020 - 03:30 AM.

  • Dibbes likes this

#56 softworkz ONLINE  

softworkz

    Advanced Member

  • Developers
  • 2407 posts
  • Local time: 05:59 AM

Posted 13 February 2020 - 05:43 PM

@vdatanet - Thanks for explaining. I wasn't sure whether this is about playback or conversion and mkv or mp4.

 

HEV1 and HVC1 are so-called FourCC tags. These are supported by MP4 containers but not MKV containers (these have their own 'Codec IDs').

 

I have already made a change in the latest beta to write an HVC1 tag instead of HEV1, when...

  • ..the conversion feature is used and...
  • ...the target container is MP4 and...
  • ...the codec is HEVC

I have tested and verified that this is working.

 

But using the convert feature on 10bit HEVC normally causes transcoding and not remuxing, so I wonder how you managed to end up with the (remuxing) command line above?


  • Dibbes and vdatanet like this

#57 vdatanet OFFLINE  

vdatanet

    Advanced Member

  • Members
  • 1739 posts
  • Local time: 05:59 AM
  • LocationCalafell, Spain

Posted 13 February 2020 - 05:47 PM

Selecting "Original quality" remuxes the file without reencoding video.


  • Dibbes likes this

#58 vdatanet OFFLINE  

vdatanet

    Advanced Member

  • Members
  • 1739 posts
  • Local time: 05:59 AM
  • LocationCalafell, Spain

Posted 15 February 2020 - 05:29 AM

@vdatanet - Thanks for explaining. I wasn't sure whether this is about playback or conversion and mkv or mp4.

 

HEV1 and HVC1 are so-called FourCC tags. These are supported by MP4 containers but not MKV containers (these have their own 'Codec IDs').

 

I have already made a change in the latest beta to write an HVC1 tag instead of HEV1, when...

  • ..the conversion feature is used and...
  • ...the target container is MP4 and...
  • ...the codec is HEVC

I have tested and verified that this is working.

 

But using the convert feature on 10bit HEVC normally causes transcoding and not remuxing, so I wonder how you managed to end up with the (remuxing) command line above?

 

@softworkz - With server version .14 tag hev1 is still written instead of hvc1.

 

5e47b9b2b8f74_Anotacin20200215102708.jpg



#59 vdatanet OFFLINE  

vdatanet

    Advanced Member

  • Members
  • 1739 posts
  • Local time: 05:59 AM
  • LocationCalafell, Spain

Posted 18 February 2020 - 02:17 AM

Using beta version 4.4.0.15 hvc1 tag is written. Thanks!


  • sfatula likes this

#60 Luke OFFLINE  

Luke

    System Architect

  • Administrators
  • 149390 posts
  • Local time: 11:59 PM

Posted 18 February 2020 - 02:19 AM

Using beta version 4.4.0.15 hvc1 tag is written. Thanks!


Thanks for confirming.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users