Skip to content
This repository was archived by the owner on Feb 6, 2026. It is now read-only.
This repository was archived by the owner on Feb 6, 2026. It is now read-only.

Can't build .usm file #4

Description

@SunRay27

Hi! I am trying to build VP9 .usm file according to examples provided in documentation, but get different errors in the process.

OS: Windows 10
Python version: 3.13
PyCriCodecsEx version: 0.5 from pip
ffmpeg version: 2025-12-18

.usm file google drive
Encryption key: <2897314143465725881>
Video: VP9, encrypted
Audio: HCA, encrypted

Code used: code from documentation examples with insignificant changes.

Case 1:

Documentation states that .ivf container should be prepared with libvpx codec, but VP9 codec is libvpx-vp9

Case 2:

Unpacking VP9 .usm file to .mp4 and then building .usm back with it (c:v and c:a set to 'copy') fails with the following error:

  File "...\myscript.py", line 113, in pack
    f.write(builder.build())
            ~~~~~~~~~~~~~^^
  File "...\PyCriCodecsEx\usm.py", line 584, in build
    SFV_list = self.video_stream.generate_SFV(self)
  File "...\PyCriCodecsEx\usm.py", line 240, in generate_SFV
    v_framerate = int(self.framerate)
                      ^^^^^^^^^^^^^^
  File "...\Python\Python313\Lib\functools.py", line 1039, in __get__
    val = self.func(instance)
  File "...\PyCriCodecsEx\usm.py", line 203, in framerate
    return 1 / min((dt for _, _, _, dt in self.frames()))
               ~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "...\PyCriCodecsEx\usm.py", line 203, in <genexpr>
    return 1 / min((dt for _, _, _, dt in self.frames()))
                                          ~~~~~~~~~~~^^
  File "...\PyCriCodecsEx\usm.py", line 237, in frames
    yield raw_frame, frame, frame["flags"][0] == "K", float(frame["duration_time"])
                                                            ~~~~~^^^^^^^^^^^^^^^^^
KeyError: 'duration_time'

Looks like some of extracted VP9 stream packets miss "duration_time" after extracting data with ffprobe

Case 3:

Case 2 but we re-encode source VP9 stream with libvpx-vp9 before .usm building. We don't get "duration_time" error, but this error instead:

  File "...\myscript.py", line 113, in pack
    f.write(builder.build())
            ~~~~~~~~~~~~~^^
  File "...\PyCriCodecsEx\usm.py", line 584, in build
    SFV_list = self.video_stream.generate_SFV(self)
  File "...\PyCriCodecsEx\usm.py", line 268, in generate_SFV
    data = builder.VideoMask(data)
  File "...\PyCriCodecsEx\usm.py", line 116, in VideoMask
    data_view[i] ^= mask_view[mask_index]
    ~~~~~~~~~^^^
TypeError: cannot modify read-only memory

Case 4:

Unfortuantely I don't remember exact configuration for this error, but building was failing on

File "...\PyCriCodecsEx\usm.py", line 106, in VideoMask
data_view = memoryview(memObj).cast("Q")
                                     ~~~~~~~~~^^^

when I was tinkering with unpack / build configurations

Case 5:

Video players don't play audio of extracted .mp4 files unless audio stream is re-encoded from wav to another format (acc worked for me). Tried both 'copy' and re-encoding to different pcm formats to no avail. (Probably an issue with ffmpeg itself?)
Tried different video players - same result.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions