HEVC in .avi – why not?

So after playing around with the lentoid HEVC encoder and finding it results in watermarked pictures it looks like the HM 11.0 reference codec is still the way to go to make test videos right now, but we’re still very limited in how we can play those files back if we want to create a video with sound.  We have a good directshow decoder available – the Lentoid HEVC decoder – but it’s not generally exposed to files we create because regular mp4/mkv splitters can’t interpret the video streams.

To recap, as of right now we can mux and hevc video and audio track into the .mp4 file format but we can only play these files back with the GPAC Osmo4 player.  This isn’t a decoder limitation, it’s because we don’t have a readily available .mp4 splitter to read the video stream from the container.  Osmo4 uses its own .mp4 splitter that supports this, but it’s not available to other media players.

We can mux into the matroska container but again we have no way to play back the video stream with most players because no available matroska splitters understand HEVC video in matroska.  The Divx Plus Player with the HEVC plugins can read these files because it uses its own custom matroska splitter, but it comes with a lot of bloatware.

With the Lentoid HEVC Encoder we can mux HEVC video into the .flv container – video and audio only.  This is a good solution and it is compatible with any hevc videos you create using the Hm10.1 or Hm11.0 reference encoders but with the limitation that it always assumes the Reference Encoder files are 25 frames per second – I don’t know of a way to tinker with the frame rate of .flv files so as far as I know you’re stuck with that.

A solution is to instead mux our HM11.0 Reference Encoder streams into the .avi container which will expose the fourcc to the lentoid directshow decoder and then set the correct framerate in VirtualDubMod.

In order to do so you’ll need to run GraphStudioNext – an update to GraphStudio that I had recommended in the previous post.  It works pretty much the same but has active development.  Get the 32-bit version, the lentoid codecs will not be available with the 64-bit version.

Go to your .hevc file and rename it to “whatever.hm10″ – if you recall the Lentoid HEVC decoder originally only supported the fourcc hm10 and it seems the Lentoid HEVC Source filter still has this limitation.

In GraphStudioNext add the filters Lentoid HEVC Source with your file, AVI Mux, and FileWriter with”your_output.avi”.  Connect them as seems obvious.

Lentoidavi

This will give you an .avi file with your HEVC stream.  Why does this work when .avi most certainly has no idea what an HEVC stream is?  Heck if I know!  But it will play in any directshow media player with access to the Lentoid HEVC Decoder so you can now enjoy your video in MPC-HC and the like.

But we’re not done yet – when you play the file you’ll quickly notice that there is a problem.  It’s stuck at 25 frames per second.  For whatever reason all muxing tools – mp4box, mkvtoolnix, Monogram flv muxer, and AVI mux – seem to assume that any hevc video is always 25 fps.  But that’s not a problem in this case – go back to trusty VirtualDubMod and load up your video.  Only DirectStreamCopy is available for video processing, but we still have access to the .avi framerate property.  Set it to the proper value and re-save the file.

virtualdubhm10virtualdubframeratevirtualdubframerate2

With that done, we now have a proper framerate HEVC .avi.  You can mux in an .mp3 sound file to go with it and it will play back with the lentoid decoder with no fuss.

kaibahevc

Here’s an example file if you’re interested, a 1920×1080 snippet from the first episode of Kaiba, no sound.  QP18 using encoder_lowdelay_main.cfg. (as this is a 24 second clip with no sound it is of course used entirely for educational purposes – though I recommend the anime)

HEVC in .avi – the past meets the future.

8 thoughts on “HEVC in .avi – why not?

  1. Your example file played (almost) perfectly for me using the Lentoid HEVC decoder on MPC-HC. The only issue I had was with seeking, did you only have two intra-frames?
    Shame about the lack of sound and 10bit colour though, but it’s a start.

    • With the Kaiba clip yes, intra-period was set to 300 over 600 frames. I could easily have muxed the sound in as well, but as it was really a demonstration of putting hevc into the .avi container I didn’t bother since it is a copyrighted work.

    • Your .avi file plays fine for me but the .mkv file plays only audio in MPC-HC. Could you list what versions of the software you’re using are? Specifically, are you decoding with the lentoid hevc decoder or did you compile libav smarter fork?

      • It seems you’re using the obsolete Haali Media Splitter 🙂 — OR, equally possible, the internal MKV splitter of an older build of MPC-HC. Over here, both AV Splitter and LAV Splitter work as they should. I think Haali did hardcode some artificial limitations into his Matroska demuxer — months ago, and unintentionally, I found out it didn’t recognize a MKV file with RealVideo 10 wrapped in VfW-mode, for example.

        • Ah, you’re right. I had disabled the LAV splitter while testing the experimental mkvmerge released by DivXLabs and never re-enabled it. The file plays back fine with it enabled – good find! I guess now that we can playback h.265 in .mkv there’s no more obstacles to stop us from using it!

Comments are closed.