video_transcoding: HEVC output is not playable by QuickTime on macOS 10.13 High Sierra Beta 6

Using transcode-video --handbrake-option encoder=x265 --mp4 I am unable to create a file that can be played back by QuickTime on 10.13. It appears the output is not compatible with the upcoming HEVC support in macOS. I have not tested playback on iOS 11 beta yet.

video_transcoding 0.17.3 macOS 10.13 beta 6

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 36 (14 by maintainers)

Commits related to this issue

Most upvoted comments

Been digging a bit and might have some info.

It looks like ffmpeg has added hvc1 tag support with these two commits: https://github.com/FFmpeg/FFmpeg/commit/974d508e571085dce43e688595da058804169088 https://github.com/FFmpeg/FFmpeg/commit/369a3e111cb8015c3a3acc5c2c15728c8f37084f

They are currently in master and do not appear to be in a ffmpeg release yet. With the patches, you should be able to do the following with ffmpeg directly to get an hvc1 tagged version:

ffmpeg -i input.mp4 -vcodec copy -acodec copy -tag:v hvc1 output.mp4

I will try to build from master and test, but probably won’t have time to check until tomorrow.

Confirming FFmpeg compiled from source works as described above. I tagged a version of the docker image that has the necessary patches (as well as latest libx265) if anyone needs it. Run it with: docker run -itv "pwd":/data ntodd/video-transcoding:0.17.3-ffmpeg

You can then convert hev1 tagged h265 to hvc1 with: ffmpeg -i input.mp4 -vcodec copy -acodec copy -tag:v hvc1 output.mp4 or similar.

Output works in QuickTime on MacOS 10.13 beta 6.

Install HEAD version of ffmpeg:

brew install ffmpeg --with-x265 --HEAD

Update hev1 tag to hvc1:

ffmpeg -i input.mp4 -vcodec copy -acodec copy -tag:v hvc1 output.mp4

Full version posted here: https://gist.github.com/k06a/45f4ff4e52a7c0ad2add370ab1a315e7

Installation:

brew install mp4box
brew install ffmpeg --with-fdk-aac --with-tools --with-freetype --with-libass --with-libvorbis --with-libvpx --with-x265 --HEAD

Converting video, than audio, than combining into 1 file and finally fix tag:

ffmpeg -i input.mov -c:v libx265 -c:a aac -preset ultrafast -an -x265-params crf=25 video.mp4
ffmpeg -i input.mov -c:a libfdk_aac -profile:a aac_he_v2 audio.aac
mp4box -add audio.aac -add video.mp4 output.mp4
ffmpeg -i output.mp4 -vcodec copy -acodec copy -tag:v hvc1 output_apple.mp4

@ntodd @donmelton I just found this. Haven’t tested it yet, but looks like the latest handbrake nightly builds will support hvc1 out of the box: https://github.com/HandBrake/HandBrake/commit/67dfaca7ac3ec56cc4ab3c7f9f60ab3b7c43a0db

Maybe we just have to wait a little 😃

Update: Tested & Works

@ntodd Thank you so much for this. I was able to convert a large batch of improperly tagged files in seconds and they now all play flawlessly on my Apple TV. You’re my hero. 😃

@mikumi Thanks for the information! That would explain a lot to @ntodd and myself. 😃

However, it’s not transcode-video that is marking the streams as such. It’s HandBrakeCLI or the LibAV library within it.

Of course, if the HandBrake team doesn’t fix this problem, I could do it within transcode-video by calling mp4box directly. However, that would add another dependency.

@ntodd I had the same problem. I’m no expert, but looks like it has to do with the packaging of the stream, see this stackoverflow answer: https://stackoverflow.com/a/32485240/968099

From what I understand transcode-video marks the video stream has hev1, but it actually needs to be marked as hvc1 in order to be recognized by Quick Time.

Running mp4box -raw 1 file.mp4 ans then mp4box -add file_track1.hvc output.mp4 as described in the stackoverflow answer solved the issue for me.

Ideally transcode-video would be able to output hvc1 streams directly, maybe as an option. But it’s also possible Quick Time won’t have this issue anymore in future betas.

This worked for me: https://danconnor.com/posts/21d8bd7c22f6ae6b423c3c09/how_to_encode_h_265_hevc_video_that_will_play_in_quicktime_on_macos_using_ffmpeg_

I had some files from an older camera that just refused being converted by any software I threw at them. Now it works flawlessly in HEVC.

@necktwi The -an option for ffmpeg disables audio output so I don’t think you want to use that.

If it helps anyone, I built a version of the docker image that compiles more current versions of ffmpeg and handbrake so output from transcode-video is tagged with hvc1 correctly. You can also use included ffmpeg to re-tag any existing h265 videos.

You can pull ntodd/video-transcoding:head to get this version and the dockerfile is at https://github.com/ntodd/video_transcoding_docker/blob/head/video-transcoding/Dockerfile.

Instructions for basic usage of the docker image are at https://hub.docker.com/r/ntodd/video-transcoding/, just be sure to pull the head version to get the latest.

@donmelton I mean Brorsoft Video Converter. It is a good HEVC/h265 converting tool. Converting always brings some loss but it can be ignore when you play it.