Skip to content

Extracting frames from videos #3156

Closed
Closed

Description

Is there an existing issue for this?

  • I have searched the existing issues

Operating System

WSL Ubuntu 24.04

DeepLabCut version

DLC 3.0.0rc9

What engine are you using?

pytorch

DeepLabCut mode

single animal

Device type

RTX 2080 Ti

Bug description 🐛

Hi there. I have just started to use DLC recently and I faced a issue when I want to extract the frames from the videos. The format of videos are H264 MP4 and I get this error in terminal:

INFO:console:Frame extraction failed. Video files must be corrupted.
INFO:console:failed to extract frames: worker is None

I get this error on my laptop and also on my PC.

Steps To Reproduce

No response

Relevant log output

Anything else?

No response

Code of Conduct

Activity

  1. deruyter92 commented on Dec 5, 2025

    @deruyter92
    Collaborator

    Hi @mojtaba-movement-analyst. Let me help you find the source of the problem. Could you answer the following questions?

    1. Besides the mentioned errors, can you see other outputs in the terminal?
    2. Have you tried opening the video in other software (e.g. a video player) and can you verify that it is not corrupted?
    3. Is your error specific to this particular video? Did you try frame extraction on other videos?

    You could try to convert the video to a different format and see if the error still persists, by running this command in your WSL terminal: ffmpeg -i <input_video.mp4> <converted_video.avi> (replacing the input and output fields with the appropriate paths).
    If the problem persists, would you mind sharing the video with us via a download link?

  2. mojtaba-movement-analyst commented on Dec 5, 2025

    @mojtaba-movement-analyst
    Author

    Hi @deruyter92. Thank you so much for your response. I converted the videos to mkv format and the problem solved. I don't know where the problem was but we could also extract the frames using older version of DLC.
    By the way I tried to use an avi format video to test it but the same error occurred. It happened on our department powerful PC and also on my laptop.
    Please let me know if I could share something to you in order to debug DLC.

  3. deruyter92 commented on Dec 8, 2025

    @deruyter92
    Collaborator

    @mojtaba-movement-analyst, good to hear that the conversion is a good workaround for now.

    Yes it would be interesting if I could try to reproduce the problem with your video, especially since you are mentioning inconsistent behavior for different versions of DeepLabCut. Could you share the problematic video with us? If you could post a download link in your reply, I will have a look at it! Thanks in advance!

  4. mojtaba-movement-analyst commented on Dec 17, 2025

    @mojtaba-movement-analyst
    Author

    @deruyter92 Sorry for sending the videos late. These two videos are just two from multiple ones. None of them can be used for frame extraction.
    I also have a question about undistorted images in 3D calibration. How they should look like? I could not find any example to see and compare to mine. Thank you in advance for your support.

  5. deruyter92 commented on Dec 18, 2025

    @deruyter92
    Collaborator

    Hi @mojtaba-movement-analyst, just to make sure: where can I find the videos? Maybe could you share a download link?

  6. mojtaba-movement-analyst commented on Dec 19, 2025

    @mojtaba-movement-analyst
    Author

    @deruyter92 Sorry I forgot to paste the link :)
    here you are:
    https://drive.google.com/drive/folders/1srrIarf4GgQjzD8ksnKh5cN5DHZta0gR?usp=drive_link

    P:S: We managed to use them as a .mp4 file for extracting frames on a Macbook Air!

  7. deruyter92 commented on Dec 22, 2025

    @deruyter92
    Collaborator

    Thanks! I have tested the integrity of you files using ffprobe, ffmpeg and manual inspection. I can find nothing wrong with these videos. Also, I could successfully extract the frames with DeepLabCut (version 3.0rc13) on my machines (Ubuntu and Windows).

    For me it is difficult to pinpoint why these videos were not successfully processed in your original attempt - especially since you don't mention seeing other error messages (e.g. 'Frame selection failed...' or 'Frame [...] not found'). I am glad that you found other ways to extract the frames, and hope that these workarounds are sufficient for you.

  8. added
    howtousedlc
    on Jan 9, 2026
  9. mikeumo commented on Jan 24, 2026

    @mikeumo

    I have exactly the same issue (same error message). It appeared in 3.0.0rc8 and in 3.0.0rc13

    INFO:console:Frame extraction failed. Video files must be corrupted.
    INFO:console:failed to extract frames: worker is None

    I have mp4 files and I cannot extract frames with "automatic" extraction and "kmeans" algorithm.
    here is ffprobe:

    Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'aaa.MP4':
    Metadata:
    major_brand : mp41
    minor_version : 538120216
    compatible_brands: mp41
    creation_time : 2025-07-28T21:50:14.000000Z
    firmware : HD8.01.02.50.00
    Duration: 00:10:28.06, start: 0.000000, bitrate: 45278 kb/s
    Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuvj420p(pc, bt709), 1920x1080 [SAR 1:1 DAR 16:9], 45002 kb/s, 59.94 fps, 59.94 tbr, 60k tbn, 119.88 tbc (default)
    Metadata:
    creation_time : 2025-07-28T21:50:14.000000Z
    handler_name : GoPro AVC
    vendor_id : [0][0][0][0]
    encoder : GoPro AVC encoder
    timecode : 01:57:05:06
    Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 189 kb/s (default)
    Metadata:
    creation_time : 2025-07-28T21:50:14.000000Z
    handler_name : GoPro AAC
    vendor_id : [0][0][0][0]
    timecode : 01:57:05:06
    Stream #0:2(eng): Data: none (tmcd / 0x64636D74) (default)
    Metadata:
    creation_time : 2025-07-28T21:50:14.000000Z
    handler_name : GoPro TCD
    timecode : 01:57:05:06
    Stream #0:3(eng): Data: bin_data (gpmd / 0x646D7067), 59 kb/s (default)
    Metadata:
    creation_time : 2025-07-28T21:50:14.000000Z
    handler_name : GoPro MET
    Stream #0:4(eng): Data: none (fdsc / 0x63736466), 13 kb/s (default)
    Metadata:
    creation_time : 2025-07-28T21:50:14.000000Z
    handler_name : GoPro SOS
    Unsupported codec with id 0 for input stream 2
    Unsupported codec with id 100359 for input stream 3
    Unsupported codec with id 0 for input stream 4

    It begs the question if the "Unsupported codec ..." is causing the problem

    However, after converting the video to various formats/codecs what made the difference in adding the same video again in the "add new videos" in "manage project" tab.

    this begs the question: why am I getting the errors about video format when, in fact, the problem is with file management?

    HTH.

  10. kldachun22 commented on Feb 27, 2026

    @kldachun22

    i meet a simillar problem in DLCrc9. You should choose copy videos when first created project.

  11. ShambreTaylor commented on Sep 16, 2026

    @ShambreTaylor

    I have the same problem. Originally, it worked, but not on later-added videos. So I created a new project, and neither the new nor the earlier videos worked.

    After upgrading had the same issue, commented in #3448

    mp4 videos, can be opened in vlc. Debug with example video:

    Runtime

    • python: 3.12.14 (main, Sep 2 2026, 23:27:36) [GCC 15.3.0]
    • platform: Linux-5.15.0-139-generic-x86_64-with-glibc2.31
    • executable: bin/python

    DeepLabCut core libraries

    • deeplabcut: 3.0.1
    • torch: 2.14.0+cpu
    • torchvision: 0.29.0+cpu
    • numpy: 1.26.4
    • pandas: 2.3.3
    • scipy: 1.17.1
    • h5py: not-installed
    • tables: 3.11.1
    • opencv-python: 4.11.0

    GUI libraries

    • PySide6: 6.9.3
    • shiboken6: 6.9.3
    • qtpy: 2.4.3
    • qdarkstyle: 3.1
    • napari: 0.8.0
    • napari-deeplabcut: 0.3.1.2

    External tools

    • ffmpeg: ffmpeg version 4.2.7-0ubuntu0.1 Copyright (c) 2000-2022 the FFmpeg developers
    • ffmpeg_path: bin/ffmpeg

    Recent logs

    10:24:56.245 | INFO     | deeplabcut.gui | Use all bodyparts
    10:25:06.365 | INFO     | deeplabcut.gui | Videos added to analyze:
    {PosixPath('/data/Deeplabcut/test-02-2026-09-16/videos/04-01.mp4')}
    Current video files:
    {PosixPath('/data/Deeplabcut/test-02-2026-09-16/videos/04-01.mp4')}
    10:25:08.224 | INFO     | deeplabcut.gui.console | Config file read successfully.
    10:25:08.225 | INFO     | deeplabcut.gui.console | Frame extraction failed. Video files must be corrupted.
    10:25:10.692 | INFO     | deeplabcut.gui.console | failed to extract frames: worker is None
    
  12. added
    bug
    and removed
    howtousedlc
    on Sep 16, 2026
  13. added theissue type on Sep 16, 2026
  14. C-Achard commented on Sep 16, 2026

    @C-Achard
    Member

    Hello @ShambreTaylor, thanks for the report, please see #3448.

    Keeping this open until 3.0.2 is released.

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

Metadata

Metadata

Assignees

Labels

bug

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions