Apple Intelligence is now available on iPhone, iPad, and Mac!

Quicktime Exports displaying artifacts only on HEVC 1080p exports

Whenever I export a video using HEVC at 1080p, I get this square line along the right side of the video.

I searched all across the internet for it but couldn't find a solution.

I even installed MacOS on an external disk to try it and it gives the same issue. The first video exports properly and then any consequent video exports like this.

H264 all sizes and H265 4k and 720 export just fine.

This is a huge headache because I am all set to resize all my iPhone videos to save space.


This also happens if I select "Encode selected Video Files" from finder.



MacBook Pro 14″, macOS 15.0

Posted on Oct 11, 2024 10:06 AM

Reply
5 replies

Oct 12, 2024 1:55 AM in response to aditya18thm

aditya18thm wrote:

I also think the GPU is failing.

If that is the case, and the Mac otherwise works, then one option is to use a workflow that encodes H.265 with CPU instead GPU.


For example you might do it with Handbrake, Shutter Encoder or ffmpeg.


I prefer ffmpeg via the Terminal. ffmpeg does not handle metadata (locations, captions etc) correctly so you must babysit it with exiftool. There are two options for that. I prefer the 1st where ffmpeg does not even try to preserve metadata and exiftool then copies metadata from the originals and also sets the file dates. In the examples below input is .mov and output is .mp4 (for other suffixes you must modify the commands):


Convert .mov to H.265 .mp4:


ffmpeg -i input.mov -c:v libx265 -crf 28 -preset medium -timecode 00:00:00:00 -tag:v hvc1 -c:a copy output.mp4


Convert .mov to H.265 .mp4 in batch mode:


for i in *.mov; do ffmpeg -i "$i" -c:v libx265 -crf 28 -preset medium -timecode 00:00:00:00 -tag:v hvc1 -c:a copy "${i%.*}".mp4; done


Copy metadata from the originals:


exiftool -m -overwrite_original -ext mp4 -api QuickTimeUTC=1 -api LargeFileSupport=1 -tagsFromFile %-.0f.mov -All:All '-Track*Date<QuickTime:CreateDate' '-Media*Date<QuickTime:CreateDate' '-FileCreateDate<QuickTime:CreateDate' '-FileModifyDate<QuickTime:CreateDate' .


...


Convert .mov to H.265 .mp4 and copy metadata (which needs fixing):


ffmpeg -i input.mov -c:v libx265 -crf 28 -preset medium -timecode 00:00:00:00 -tag:v hvc1 -c:a copy -movflags use_metadata_tags -map_metadata 0 output.mp4


Convert .mov to H.265 .mp4 in batch mode (which needs fixing):


for i in *.mov; do ffmpeg -i "$i" -c:v libx265 -crf 28 -preset medium -timecode 00:00:00:00 -tag:v hvc1 -c:a copy -movflags use_metadata_tags -map_metadata 0 "${i%.*}".mp4; done


Fix metadata:


exiftool -m -overwrite_original -ext mp4 -api LargeFileSupport=1 -Keys:All= -tagsFromFile @ -Keys:All .


Those '-crf 28 -preset medium' are the defaults. If you want more compression, and faster encoding increase -crf (The range is exponential, so increasing the CRF value +6 results in roughly half the bitrate / file size. Sane range is 17–28. Consider 18 to be visually lossless.) or use fast (Other options are ultrafast, superfast, veryfast, faster, fast, medium, slow, slower, veryslow, placebo. Compared to medium, veryslow requires 280% of the original encoding time, with only minimal improvements over slower in terms of quality).


Oct 15, 2024 12:15 PM in response to Matti Haveri

Hey Matti, Thank you so much for the detailed answer.

I was really hoping to use the ASIC hardware in the Mac to encode videos.

I tried your solution and converted my video library with Handbrake using the Video Toolbox at CQ 62 and then copying over the metadata in batch mode using exiftool as you stated.


One more thing I saw is that the artifacts only occur for H265 portrait videos which have HDR. For no other exports including H265 1080p Landscape videos does this issue occur. I am at a loss to debug this, but since the rest of the machine works flawlessly I can live with this.


I have created my presets in Handbrake and batch convert videos and then copy over metadata whenever I need to save space now. I am usually done with ~100GB worth of videos in under an hour now and end up with sizes close to ~12GB while maintaining pretty good quality for the iPhone screen. I keep the originals backed up on OneDrive and for whichever videos I need to be maintained in original quality, I keep them as is.


This is not totally optimal since it is high CPU usage for close to an hour and now that I have had my iPhone 13 and 2 Macbook 16" Intel i9 models and one 2017 13" Pro fail over the last 4 years due to heat (All Macbooks repaired under Corporate Apple Care/Extended Warranties/Insurance but I am sick about the iPhone 13 as you would see in another post), I am a bit vary of this even though it's a pro machine...

Oct 15, 2024 9:52 PM in response to aditya18thm

> Handbrake using the Video Toolbox at CQ 62 [...] artifacts only occur for H265 portrait videos which have HDR


AFAIK "H.265 Video Toolbox" uses GPU while the plain H.265 uses CPU. Do you get artifacts with the latter encoder? I must test HDR/HLG portrait mode later because I do not have that kind of footage.


The corresponding ffmpeg GPU/CPU encode options are something like (GPU option with 2600K or even much lower produces pretty good output with 5-10x encoding speed compared to CPU option on my Mac mini 2018 Intel):


ffmpeg -i input.mov -c:v hevc_videotoolbox -profile 1 -b:v 6000K -timecode 00:00:00:00 -tag:v hvc1 -c:a copy output.mp4


ffmpeg -i input.mov -c:v libx265 -crf 28 -preset medium -timecode 00:00:00:00 -tag:v hvc1 -c:a copy output.mp4


Or to convert HDR/HLG to 8-bit SDR H.265 with CPU (ffmpeg7 recommended):


ffmpeg -i input.mov -vf zscale=t=linear:npl=250,format=gbrpf32le,zscale=p=bt709,tonemap=tonemap=hable:desat=0,zscale=t=bt709:m=bt709:r=tv,format=yuv420p -c:v libx265 -crf 28 -preset medium -timecode 00:00:00:00 -tag:v hvc1 -c:a copy output.mp4



Quicktime Exports displaying artifacts only on HEVC 1080p exports

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.