Opened 19 months ago

Last modified 19 months ago

#14911 assigned enhancement

Add H.265 video encoding to the movie encode command

Reported by: Tom Goddard Owned by: Tom Goddard
Priority: moderate Milestone:
Component: Input/Output Version:
Keywords: Cc: Elaine Meng
Blocked By: Blocking:
Notify when closed: Platform: all
Project: ChimeraX

Description

The movie encode command currently use H.264 video codec by default. The more modern H.265 codec is supposed to give up to 50% more compression with the same quality, so it would be nice to offer this. We might even make it the default if it is widely supported by players.

Change History (2)

comment:1 by Tom Goddard, 19 months ago

Cc: Elaine Meng added

Our Mac ARM ChimeraX ffmpeg has H.265 support so it was easy for me to try it by changing the "libx264" option in the movie/formats.py file to "libx265". The result for the a test movie made with commands

windowsize 960 540
open 7qsk
movie record ; turn y 2 180 ; wait 180 ; movie encode ~/Desktop/movie11.mp4 verbose true quality good

was a file that was 18 Mbytes while the H.264 movie was 12 Mbytes. I'm guess the compression level doesn't have the same meaning so the H.265 was probably much higher visual quality. So if we added H.265 we would probably want to recalibrate the ChimeraX quality level option for it so H.265 gives smaller files size than H.264 with similar quality.

Another issue was the recorded movie would not play in Mac QuickTime in macOS 14.4.1 (latest as of April 2024). An online post indicated that ffmpeg encoded H.265 needs a special tag option (ffmpeg option '-tag:v hvc1') for QuickTime.

https://discussions.apple.com/thread/253813055?sortBy=best

I added that tag and QuickTime played the movie.

I did not test how compatible the output movie is with other players on Windows and Linux.

Also I did not investigate whether our ffmpeg in Windows, Linux, and Intel Mac ChimeraX have H.265 support. I think our Mac ARM ffmpeg is newer than on those other platforms.

Also I read that H.265 is encumbered by 4 different patents complicating its legal use. So it will be important to investigate how widely adopted it is by movie players before we make the default in ChimeraX.

comment:2 by Tom Goddard, 19 months ago

In Windows ChimeraX ffmpeg does support libx265.

Note: See TracTickets for help on using tickets.