Skip to content

Cannot open AVI file generated by Python's cv2 (but opened fine in VLC) #2696

@stsypanov

Description

@stsypanov

The fewer issues I have to read, the more new features I will have time to implement, so I ask that you please try these things first

Steps to reproduce

I'm generating AVI files programmatically using Python library cv2 as:

import cv2
import time
import numpy as np

width = 256
height = 192
scale = 3

newWidth = width * scale
newHeight = height * scale

cap = cv2.VideoCapture(0)
current_time_str = time.strftime("%Y%m%d--%H%M%S")
fourcc = cv2.VideoWriter_fourcc(*'XVID')
out = cv2.VideoWriter(f"thermal_output-{current_time_str}.avi", fourcc, 25, (newWidth, newHeight))
# .....
cap.release()
out.release()

Here's the file metadata:

{
  index: 0,
  codec_name: 'mpeg4',
  codec_long_name: 'MPEG-4 part 2',
  profile: 'Simple Profile',
  codec_type: 'video',
  codec_tag_string: 'XVID',
  codec_tag: '0x44495658',
  width: 768,
  height: 576,
  coded_width: 768,
  coded_height: 576,
  has_b_frames: 0,
  sample_aspect_ratio: '1:1',
  display_aspect_ratio: '4:3',
  pix_fmt: 'yuv420p',
  level: 1,
  chroma_location: 'left',
  refs: 1,
  quarter_sample: 'false',
  divx_packed: 'false',
  r_frame_rate: '30/1',
  avg_frame_rate: '30/1',
  time_base: '1/30',
  start_pts: 0,
  start_time: '0.000000',
  duration_ts: 0,
  duration: '0.000000',
  extradata_size: 47,
  disposition: {
    default: 0,
    dub: 0,
    original: 0,
    comment: 0,
    lyrics: 0,
    karaoke: 0,
    forced: 0,
    hearing_impaired: 0,
    visual_impaired: 0,
    clean_effects: 0,
    attached_pic: 0,
    timed_thumbnails: 0,
    non_diegetic: 0,
    captions: 0,
    descriptions: 0,
    metadata: 0,
    dependent: 0,
    still_image: 0,
    multilayer: 0,
  },
}

I can extract the video track into mkv, but not to open the file with the latest version of LosslessCut:

Image Image

Here's the file:

Expected behavior

File can be opened and edited

Actual behavior

Error appears

Provide an error report

2026-01-06T10:54:48.524Z info: LosslessCut version 3.67.2 { isDev: false }
2026-01-06T10:54:48.701Z info: Backed up config file to C:\Users\SeTsypanov\AppData\Roaming\LosslessCut\config.json.backup-v3.67.2-1-1767696888691
2026-01-06T10:54:48.703Z error: Failed to migrate old keyboard binding escape closeActiveScreen AssertionError [ERR_ASSERTION]: Unknown key: escape
    at C:\Users\SeTsypanov\Downloads\LosslessCut-win-x64\resources\app.asar\out\main\index.js:494:11
    at Array.map (<anonymous>)
    at C:\Users\SeTsypanov\Downloads\LosslessCut-win-x64\resources\app.asar\out\main\index.js:492:12
    at Array.map (<anonymous>)
    at init (C:\Users\SeTsypanov\Downloads\LosslessCut-win-x64\resources\app.asar\out\main\index.js:381:37)
    at async C:\Users\SeTsypanov\Downloads\LosslessCut-win-x64\resources\app.asar\out\main\index.js:8772:5 {
  generatedMessage: false,
  code: 'ERR_ASSERTION',
  actual: false,
  expected: true,
  operator: '==',
  diff: 'simple'
}
2026-01-06T10:54:48.713Z info: Migrated config to version 2
2026-01-06T10:54:48.733Z info: Initialized config store
2026-01-06T10:54:48.752Z info: Waiting for app to become ready
2026-01-06T10:54:48.753Z info: CLI arguments { _: [] }
2026-01-06T10:54:49.479Z info: Current version 3.67.2
2026-01-06T10:54:49.479Z info: Newest version 3.67.2
2026-01-06T10:54:50.590Z info: ffmpeg -hide_banner -f lavfi -i nullsrc=s=256x256:d=1 -f null -
2026-01-06T10:55:30.431Z info: ffprobe -of json -show_chapters -show_format -show_entries stream -i C:\Users\SeTsypanov\Desktop\thermal_output-20260105--085303.avi -hide_banner
2026-01-06T10:55:31.819Z info: readFormatData C:\Users\SeTsypanov\Desktop\thermal_output-20260105--085303.avi
2026-01-06T10:55:31.820Z info: ffprobe -of json -show_format -i C:\Users\SeTsypanov\Desktop\thermal_output-20260105--085303.avi -hide_banner
2026-01-06T10:56:03.834Z info: ffprobe -of json -show_chapters -show_format -show_entries stream -i C:\Users\SeTsypanov\Desktop\thermal_output-20260105--085303.avi -hide_banner
2026-01-06T10:56:04.126Z info: readFormatData C:\Users\SeTsypanov\Desktop\thermal_output-20260105--085303.avi
2026-01-06T10:56:04.126Z info: ffprobe -of json -show_format -i C:\Users\SeTsypanov\Desktop\thermal_output-20260105--085303.avi -hide_banner
2026-01-06T10:56:43.384Z info: ffmpeg -hide_banner -i C:\Users\SeTsypanov\Desktop\thermal_output-20260105--085303.avi -map 0:0 -c copy -f matroska -y C:\Users\SeTsypanov\Desktop\thermal_output-20260105--085303-stream-0-video-mpeg4.mkv
2026-01-06T12:25:47.864Z info: LosslessCut version 3.67.2 { isDev: false }
2026-01-06T12:25:48.063Z info: Initialized config store
2026-01-06T12:25:48.065Z info: Waiting for app to become ready
2026-01-06T12:25:48.069Z info: CLI arguments { _: [] }
2026-01-06T12:25:48.685Z info: Current version 3.67.2
2026-01-06T12:25:48.685Z info: Newest version 3.67.2
2026-01-06T12:25:48.993Z info: ffmpeg -hide_banner -f lavfi -i nullsrc=s=256x256:d=1 -f null -
2026-01-06T12:26:04.208Z info: ffprobe -of json -show_chapters -show_format -show_entries stream -i C:\Users\SeTsypanov\Desktop\thermal_output-20260105--085303.avi -hide_banner
2026-01-06T12:26:04.860Z info: readFormatData C:\Users\SeTsypanov\Desktop\thermal_output-20260105--085303.avi
2026-01-06T12:26:04.860Z info: ffprobe -of json -show_format -i C:\Users\SeTsypanov\Desktop\thermal_output-20260105--085303.avi -hide_banner
2026-01-06T12:28:03.130Z info: ffprobe -of json -show_chapters -show_format -show_entries stream -i C:\Users\SeTsypanov\Desktop\thermal_output-20260105--085303.avi -hide_banner
2026-01-06T12:28:03.350Z info: readFormatData C:\Users\SeTsypanov\Desktop\thermal_output-20260105--085303.avi
2026-01-06T12:28:03.350Z info: ffprobe -of json -show_format -i C:\Users\SeTsypanov\Desktop\thermal_output-20260105--085303.avi -hide_banner
2026-01-06T12:28:18.332Z info: ffprobe -of json -show_chapters -show_format -show_entries stream -i C:\Users\SeTsypanov\Desktop\thermal_output-20260105--085303.avi -hide_banner
2026-01-06T12:28:18.554Z info: readFormatData C:\Users\SeTsypanov\Desktop\thermal_output-20260105--085303.avi
2026-01-06T12:28:18.554Z info: ffprobe -of json -show_format -i C:\Users\SeTsypanov\Desktop\thermal_output-20260105--085303.avi -hide_banner

Share the file

No response

Share log from developer tools

No response

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