Cannot import HEVC

spider916
spider916 Posts: 6 Just Starting Out*

Hi,

I'm having difficulty opening/importing a HEVC file

The error I receive is a load error and "The Media could not be imported"

All the support articles I've managed to find all refer to older HitFilm versions (without HEVC support) where the reference manual for 2021.3 says it now supports HEVE once the MS HEVC extensions are installed

I'm running HitFilm Express 2021.3 (18.0.12110.52955) on Windows 10 (20H2)

Acer Triton 500, I7, 16GB Mem, Geforce RTX 2060

I had to do a refresh of windows to get the MS HEVC extensions to install but they're now installed as well

The file is from a Uniden dash cam.

It plays quite happily in the MS "Film and TV" app

This version is recorded at FHD, but intending to step up to 4k later and I'd rather not recode everything to H264 or other if I can avoid it.

The media Info detail on the file is below

Any assistance would be appreciated

Regards

T

---Media Info Detail---

General

Complete name              : D:\2022_02_11_055133_00.MP4

Format                  : MPEG-4

Format profile              : Base Media / Version 2

Codec ID                 : mp42 (mp42/isom)

File size                : 400 MiB

Duration                 : 5 min 2 s

Overall bit rate             : 11.1 Mb/s

Encoded date               : UTC 2022-02-11 05:51:33

Tagged date               : UTC 2022-02-11 05:51:33


Video #1

ID                    : 2

Format                  : HEVC

Format/Info               : High Efficiency Video Coding

Format profile              : [email protected]@Main

Codec ID                 : hvc1

Codec ID/Info              : High Efficiency Video Coding

Duration                 : 5 min 0 s

Bit rate                 : 9 781 kb/s

Width                  : 1 920 pixels

Height                  : 1 080 pixels

Display aspect ratio           : 16:9

Frame rate mode             : Constant

Frame rate                : 30.000 FPS

Color space               : YUV

Chroma subsampling            : 4:2:0

Bit depth                : 8 bits

Bits/(Pixel*Frame)            : 0.157

Stream size               : 350 MiB (87%)

Title                  : Hisilicon VIDEO

Language                 : English

Encoded date               : UTC 2022-02-11 05:51:33

Tagged date               : UTC 2022-02-11 05:51:33

Color range               : Full

Color primaries             : BT.709

Transfer characteristics         : BT.709

Matrix coefficients           : BT.709

Codec configuration box         : hvcC


Video #2

ID                    : 4

Format                  : AVC

Format/Info               : Advanced Video Codec

Format profile              : [email protected]

Format settings             : CABAC / 1 Ref Frames

Format settings, CABAC          : Yes

Format settings, Reference frames    : 1 frame

Codec ID                 : avc1

Codec ID/Info              : Advanced Video Coding

Duration                 : 5 min 0 s

Bit rate                 : 1 184 kb/s

Width                  : 960 pixels

Height                  : 540 pixels

Display aspect ratio           : 16:9

Frame rate mode             : Constant

Frame rate                : 30.000 FPS

Color space               : YUV

Chroma subsampling            : 4:2:0

Bit depth                : 8 bits

Scan type                : Progressive

Bits/(Pixel*Frame)            : 0.076

Stream size               : 42.3 MiB (11%)

Title                  : Hisilicon VIDEO

Language                 : English

Encoded date               : UTC 2022-02-11 05:51:33

Tagged date               : UTC 2022-02-11 05:51:33

Color range               : Full

Color primaries             : BT.709

Transfer characteristics         : BT.709

Matrix coefficients           : BT.709

Codec configuration box         : avcC


Audio

ID                    : 3

Format                  : AAC LC

Format/Info               : Advanced Audio Codec Low Complexity

Codec ID                 : mp4a-40-2

Duration                 : 4 min 59 s

Bit rate mode              : Constant

Bit rate                 : 128 kb/s

Channel(s)                : 2 channels

Channel layout              : L R

Sampling rate              : 48.0 kHz

Frame rate                : 46.875 FPS (1024 SPF)

Compression mode             : Lossy

Stream size               : 4.48 MiB (1%)

Title                  : Hisilicon AUDIO

Language                 : English

Encoded date               : UTC 2022-02-11 05:51:33

Tagged date               : UTC 2022-02-11 05:51:33


Other

Type                   : meta

Duration                 : 5 min 2 s

Bit rate mode              : Constant

Best Answer

Answers

  • Stargazer54
    Stargazer54 Posts: 3,899 Ambassador

    My understanding is that you have to buy the HEVC extension from M$ (for a dollar). A windows update will not give it to you for free. Did you go here to download and install it? https://www.microsoft.com/en-us/p/hevc-video-extensions/9nmzlz57r3t7#activetab=pivot:overviewtab

  • spider916
    spider916 Posts: 6 Just Starting Out*
    Hi @Stargazer54 ,
    Yes have the HEVC extensions installed (screen shot attached). It wouldn't download and install cleanly for starters so was the cause for me reinstall a clean copy of Windows.

    Hi @NormanPCN,
    I was wondering about that. If it chooses the AVC version then it would error out as that's a Pro feature and I'm on Express, but it should pick up the HEVC version. Any ideas on how I get it to select?
  • spider916
    spider916 Posts: 6 Just Starting Out*

    Right, I did a bit more digging and had a play.

    @NormanPCN nailed it with the two video formats

    I made a HEVC only copy (with Handbrake) and it loads and works fine. I suppose I'll just have to learn how to transcode without chopping out the quality (probably not a bad thing to know how to do anyway).


    For HEVC extensions, and anyone else who comes across this thread

    It seems there are at least two versions in the MS store. I did buy the pay for version but also had a "from the device manufacturer version" https://www.microsoft.com/store/productId/9N4WGH0Z6VHQ

    I've played around with both of them today and it doesn't seem to matter which one is installed so if you already have a/the "from the device manufacturer version" you shouldn't need to buy the other.

    @NormanPCN , @Stargazer54 , thank you both for your help🙂

  • NormanPCN
    NormanPCN Posts: 4,373 Expert
    edited February 26

    @spider916 " I suppose I'll just have to learn how to transcode without chopping out the quality "

    If you are transcoding with Handbrake you are probably best off transcoding to AVC. Hitfilm has better support for hardware AVC decode. HW decode is supported by the OS HEVC decoder but it may be a bit of overhead for Hitfilm to interface to the OS.

    As for maintaining the source quality then of course that depends on what the actual source quality is and this can be subjective as well. The x264 (AVC) and x265 (HEVC) encoders in Handbrake both support a CRF (constant rate factor) encoding mode which is what you should use. With AVC and common sources a CRF of 20 should work pretty well. I cover some fast decode AVC settings in my old AVC decode thread.

    Can't say for HEVC. I've not done specific test but it is probably close and maybe a touch lower (meaning higher number).

    --

    Of course source video is always "perfect", and you can remux to strip out the unwanted video track keeping the HEVC track intact and unaltered. For GUI a tool like VirtualDub 2 can do this. One would use the source track copy mode in VirtualDub 2. If you are up for command line, I can probably make up an ffmpeg command line to do such a task.

  • spider916
    spider916 Posts: 6 Just Starting Out*

    Ooohh.. I like where you're going. Am open to other tools and yes please if its an easy one for you.

  • Triem23
    Triem23 Posts: 20,292 Power User

    @spider916 oh, with @NormanPCN on the case there's no one better on this forum to guide you through this or program an ffmpeg script for you (it'll take him a minute). You'll have this sorted out in no time.

  • NormanPCN
    NormanPCN Posts: 4,373 Expert

    @Triem23 Probably more than a minute. I need a video file with two video tracks to test an ffmpeg script. I don't know how to create a video file with two video tracks. Gotta figure that one out.

  • NormanPCN
    NormanPCN Posts: 4,373 Expert
    edited February 26

    More than a minute but I think I am there. Attached is a zip with a Windows command line script file.

    You can get compiled ffmpeg binaries for Windows at

    The release essentials zip/7z should be enough.

    For reference here is the code in the script.

    @echo off
    
    
    path=C:\Users\Norman\Documents\Video Projects\EncodeScript\ffmpeg\bin;%path%
    
    
    :top
    ffmpeg.exe -i %1 -map 0:v:0 -map 0:a:0  -c:v copy -c:a copy -chunk_size 64K "%~dpn1_mux%~x1"
    REM pause
    if errorlevel 1 goto error
    
    
    shift
    if NOT %1$==$ goto top
    REM pause
    goto :EOF
    
    
    :error
    echo !!! error encoding !!!
    pause
    


    You need to edit the path statement for the correct path where you installed/unzipped ffmpeg executables.

    What the script does. I takes the first video track and first audio track of the source and maps that to the output. The OP source file had one audio track and the first video track was the "best" one. (highest rez). The command does not re-encode the streams it just copies (remux) them as is. (c:v copy c:a copy) The output file is in the same folder and has the same name as the source. The name gets a "_mux" suffix. The original file is untouched.

    The script accepts an arbitrary number of input files and will do each one in succession. The easiest way to use this is to simply drag/drop a video file onto the script itself.

    I have a number of ffmpeg script and I never use them from the command line. I always just drag/drop.

    --

    Next post VirtualDub

    --

    For the curious here is how I created a video file with two video tracks and one audio.

    @echo off
    
    path=C:\Users\Norman\Documents\Video Projects\EncodeScript\ffmpeg\bin;%path%
    
    :top
    ffmpeg.exe -i %1 -i %2 -map 0:v:0 -map 1:v:0 -map 0:a:0 -c:v libx264 -preset:v fast -profile:v high -crf 23 -c:a aac -b:a 192k TwoVideoTracks.mp4
    if errorlevel 1 goto error
    
    REM pause
    goto :EOF
    
    :error
    echo !!! error encoding !!!
    pause
    

    The command has two input files. I map the video and audio from the first(0) and the video only from the second(1). For my test case the two video inputs are arbitrary.

  • NormanPCN
    NormanPCN Posts: 4,373 Expert

    VirtualDub 2 does not allow for video track selection. I just takes the first one, or the one it thinks is "best". This is okay for the OP, the best one is the first one. Best as in the highest rez stream.

    So to do a remux in VirtualDub you would just select the source stream copy for the video track. The audio has a source stream copy mode but Vdub often messes this up so I would just do a full processing mode and output to 16-bit PCM uncompressed audio. Vdub often tries to default to 32-bit float output audio with AAC audio source so make sure to setup all audio settings. Outputting to a MOV file container (Save Video...) will allow PCM audio.

  • spider916
    spider916 Posts: 6 Just Starting Out*

    Hi @Triem23, I think I have to agree NormanPCN came up in a lot of my searches with good advice.


    Hi @NormanPCN,

    Thanks for sending the link through for FFMPEG, I thought it was a function in VirtualDub2 (Doh!)

    Edited the path and tried it out (BTW nice scripting).

    It's super quick to run and it works but produces some interesting results

    On the file I referenced at the top of the post, it drops the framerate from 30 to 25 fps, it also switches from constant to variable frame rates

    I tried a second one recorded at 60fps and it remained the the same frame rate but the bit rate dropped slightly. I'm presuming the change in frame rate is the result of the second video track being dropped as its still super quick to create so can't be inadvertently recoding (matter of seconds for a 5 min video)

    Will PM you a link to the video files.

    I haven't tried Virtual Dub yet

  • NormanPCN
    NormanPCN Posts: 4,373 Expert

    Okay, that's curious results. I'll DL and look at your specific files and see what's up. Honestly, I've not done much ffmpeg remuxing, remuxing in general, so I may have something wrong/missing. If the operation is effectively instant then the video is not changing. Something may be dropped.

  • NormanPCN
    NormanPCN Posts: 4,373 Expert
    edited February 27

    @spider916 I am afraid you are going to have to transcode. I cannot get ffmpeg to remux your files without individual frame duration issues. Ironically(?) before Hitfilm tried to handle VFR this would not be a problem because the output is "constant", but just using a pattern. In this case a 1 frame, 4 frame pattern. The Hitfilm VFR handler is likely to mess things up. It's that bad.

    VirtualDub uses the ffmpeg core library code so I assume the same for that, and likely any open/free tool since they all use the ffmpeg core library code.

    At this point I am kinda out of ideas to try.

    --

    For the curious, this is what I found. Besides MediaInfo I used the Elecard video format analyzer (free) to decode the raw video file headers and track metadata.

    The source media has two video tracks and one audio track and a metadata track. The second video track is a lower rez version of the video stream. The same audio track goes with both video tracks. I have no idea what the metadata is about.

    My first attempt I used positive logic. I mapped in only the tracks I wanted from the source to the output. This is version the OP tried.

    Using the OP supplied media, I noticed there was a metadata track. So I switched to negative logic. I mapped everything from the source and then said exclude the second video track from that list. The meta was now in my resulting output but the frame durations were still off.

    Then I noticed this media is using a curious timebase. So I found the command to change the timescale and but this did not help. The track timescale changed to that of the source but then I noticed the MOOV atom also has a timescale and in ffmpeg this timescale seems fixed at 1000 (this is an MP4 file but MOV and MP4 are identical formats). (it turns out the ffmpeg timescale was already the same at the track level)

    Speculating: It seems this metadata track is affecting the operation of ffmpeg and this meta may be using the MOOV atom timescale and ffmpeg cannot set this value. That value is fixed at 1000. ffmpeg can have any video track timescale which lets it seamlessly support any screwball framerate you can dream up. I don't know what the metadata is about. It cannot be frames. It only has 302 samples and the video tracks have 9000. The video tracks are self contained. They have all the meta I an used to seeing. The video is just fine/functional without the meta.

  • spider916
    spider916 Posts: 6 Just Starting Out*

    @NormanPCN , No worries, I'm streets ahead of where I started (no pun intended), you given me some good tools to work with and great advice.

    Also speculation but... The camera is a car dash cam, a Uniden iGO85 to be precise. As well as the video it stores a plate number for the car, GPS coordinates and the time. The time is also pulled from the satellites so the best I can set is time zone and if daylight savings is set or not. It also has provision for a rear camera which I haven't fitted yet. 302 samples over 5 min equates to once a second so if I had to guess, I'd say is the extra metadata will be the GPS data (a project for later on).


    I think I can get most of what I want out it now and if nothing else, I've learnt that next time I should do buy a GoPro like everyone else did. 😉