Skip to content

Use a more modern video format #70

@jasper-tms

Description

@jasper-tms

video.py creates videos in mp4v format. This is an old format with some big downsides:

  • It has some compatibility issues - drag-and-dropping mp4v videos into web apps doesn't work, and mac quicktime can't open them, to name two that I know of.
  • The compression sucks - mp4v videos are around 8x as large as avc1 videos in the quick test I did with a real dataset. The video quality looks the same despite the much smaller filesize.

It look like OpenCV does not know how to write videos in avc1 also known as H.264 format (the most common format these days, I believe). We should consider migrating to a different package to write videos so that we can use avc1 format to improve compatibility and reduce file sizes.

There are a plethora of options for python packages to use for writing videos.

  • I wrote one: npimage.VideoWriter just uses a subprocess call to ffmpeg to stream data to a file of whatever format ffmpeg can write.
  • Looks like Tommy has a video writer tool too.
  • If people would prefer to stick to a more popular and more battle-tested package like imageio, that might make sense.

Honestly any of these will get the job done just fine. I have locally updated df3d to use npimage and it works, for example, so I could just push that – but I just hesitate to introduce a dependency on a small personally maintaned package unless others thing it's fine.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions