Incorrect Framerate for videos imported from OBS (2.79+) #53857

Closed
opened 2018-01-22 21:53:09 +01:00 by Rusty Widget · 26 comments

System Information
Windows 7, 8GB RAM, GeForce 1060 with 6GB VRAM

Blender Version
Broken: All versions above 2.79, including 2.79 and 2.8 test builds
Worked: 2.78 and any previous version I've used for video editing, as far back as 2.5.

Short description of error
Videos which are correctly interpreted as being 30fps in 2.78 are being loaded in as 1000fps in 2.79. Somehow, the video playback is still fine, but the number of frames is incorrect and zoom in the vse panel is limited. A 2 minute video has over 120,000 frames. Altering the framerate in the rendering panel only alters the duration of the audio. mp4 files files produced by ffmpeg/blender seem to be fine, but mp4/mkv containers produced by OBS induce the issue.

Exact steps for others to reproduce the error
Launch blender or reload startup file. Open VSE. Add attached video file to VSE by any method. Check the render properties panel. Blender has set framerate to "Custom (1000.0)" with some other unfamiliar variables defined below. Repeat process in 2.78 and notice that the correct framerate (30) is automatically detected, meaning this is a recent change in how blender handles frame rate detection.

Attached is a video that demonstrates the issue for testing purposes.

2018-01-22 15-30-49.mkv

**System Information** Windows 7, 8GB RAM, GeForce 1060 with 6GB VRAM **Blender Version** Broken: All versions above 2.79, including 2.79 and 2.8 test builds Worked: 2.78 and any previous version I've used for video editing, as far back as 2.5. **Short description of error** Videos which are correctly interpreted as being 30fps in 2.78 are being loaded in as 1000fps in 2.79. Somehow, the video playback is still fine, but the number of frames is incorrect and zoom in the vse panel is limited. A 2 minute video has over 120,000 frames. Altering the framerate in the rendering panel only alters the duration of the audio. mp4 files files produced by ffmpeg/blender seem to be fine, but mp4/mkv containers produced by OBS induce the issue. **Exact steps for others to reproduce the error** Launch blender or reload startup file. Open VSE. Add attached video file to VSE by any method. Check the render properties panel. Blender has set framerate to "Custom (1000.0)" with some other unfamiliar variables defined below. Repeat process in 2.78 and notice that the correct framerate (30) is automatically detected, meaning this is a recent change in how blender handles frame rate detection. Attached is a video that demonstrates the issue for testing purposes. [2018-01-22 15-30-49.mkv](https://archive.blender.org/developer/F1943614/2018-01-22_15-30-49.mkv)
Author

Added subscriber: @r_widget

Added subscriber: @r_widget

#54148 was marked as duplicate of this issue

#54148 was marked as duplicate of this issue
Member

Added subscriber: @LazyDodo

Added subscriber: @LazyDodo
Member

i'm pretty sure this one is already fixed, please try a build from http://builder.blender.org to validate the issue indeed is already solved.

i'm pretty sure this one is already fixed, please try a build from http://builder.blender.org to validate the issue indeed is already solved.
Author

I just downloaded blender-2.79-42a5624-win64 and blender-2.80-4d3d002-win64 a few hours ago, and the bug occurs in both, so I would say it is not fixed.

I just downloaded blender-2.79-42a5624-win64 and blender-2.80-4d3d002-win64 a few hours ago, and the bug occurs in both, so I would say it is not fixed.
Member

The issue existed on the export side, not the import side, the mkv attached is actually set to 1000 fps

Input #0, matroska,webm, from '2018-01-22 15-30-49.mkv':
  Metadata:
    ENCODER         : Lavf57.84.100
  Duration: 00:00:03.03, start: 0.000000, bitrate: 913 kb/s
    Stream #0:0: Video: h264 (Main), yuv420p(tv, bt470bg/unknown/unknown), 1920x1080 [SAR 1:1 DAR 16:9], 1k fps, 30 tbr, 1k tbn, 60 tbc (default)
    Metadata:
      DURATION        : 00:00:03.033000000
    Stream #0:1: Audio: aac (LC), 44100 Hz, stereo, fltp (default)
    Metadata:
      title           : Track1
      DURATION        : 00:00:02.926000000
The issue existed on the export side, not the import side, the mkv attached is actually set to 1000 fps ``` Input #0, matroska,webm, from '2018-01-22 15-30-49.mkv': Metadata: ENCODER : Lavf57.84.100 Duration: 00:00:03.03, start: 0.000000, bitrate: 913 kb/s Stream #0:0: Video: h264 (Main), yuv420p(tv, bt470bg/unknown/unknown), 1920x1080 [SAR 1:1 DAR 16:9], 1k fps, 30 tbr, 1k tbn, 60 tbc (default) Metadata: DURATION : 00:00:03.033000000 Stream #0:1: Audio: aac (LC), 44100 Hz, stereo, fltp (default) Metadata: title : Track1 DURATION : 00:00:02.926000000 ````
Author

But the same file loads fine in 2.78 and all previous versions of blender, and although it's odd to see that OBS is exporting a video with 1k fps, tbr defines the frame rate that the demuxer should use.

But the same file loads fine in 2.78 and all previous versions of blender, and although it's odd to see that OBS is exporting a video with 1k fps, tbr defines the frame rate that the demuxer should use.

Added subscriber: @ChristopherAnderssarian

Added subscriber: @ChristopherAnderssarian

This comment was removed by @ChristopherAnderssarian

*This comment was removed by @ChristopherAnderssarian*
Member

Added subscriber: @lichtwerk

Added subscriber: @lichtwerk
Member

tbr defines the frame rate that the demuxer should use

where is this information from?

> tbr defines the frame rate that the demuxer should use where is this information from?
Member

Added subscribers: @Sergey, @troy_s

Added subscribers: @Sergey, @troy_s
Member

maybe @troy_s or @Sergey know better [about the fps vs. tbr]?

maybe @troy_s or @Sergey know better [about the fps vs. tbr]?

Shows reported results in blender-2.79-66521b3

Shows reported results in blender-2.79-66521b3

Added subscriber: @cyaoeu

Added subscriber: @cyaoeu

The video playback is only fine because by default Blender sets the scene fps to the video fps. If you disable use video fps when adding the file (down left) you get an extremely slow video.

There is indeed something wrong with Blender's autodetection of fps. Using tbr instead of fps could be useful if the fps value is wrong (like the "1000 fps" OBS videos which play normally in any video player).

Also from what I could see the code uses r_frame_rate for detecting the fps, but the video I loaded in Blender showed 1000 fps even though ffprobe showed 60/1 fps for the video which made me even more confused. The avg_frame_rate did show 1000/1 though.
ffprobe.png

The video playback is only fine because by default Blender sets the scene fps to the video fps. If you disable use video fps when adding the file (down left) you get an extremely slow video. There is indeed something wrong with Blender's autodetection of fps. Using tbr instead of fps could be useful if the fps value is wrong (like the "1000 fps" OBS videos which play normally in any video player). Also from what I could see the code uses r_frame_rate for detecting the fps, but the video I loaded in Blender showed 1000 fps even though ffprobe showed 60/1 fps for the video which made me even more confused. The avg_frame_rate did show 1000/1 though. ![ffprobe.png](https://archive.blender.org/developer/F2180900/ffprobe.png)

Maybe some matroska (.mkv) weirdness? https://matroska.org/technical/specs/notes.html

Maybe some matroska (.mkv) weirdness? https://matroska.org/technical/specs/notes.html

Added subscribers: @Mapper720-4, @mont29

Added subscribers: @Mapper720-4, @mont29
Sergey Sharybin was assigned by Bastien Montagne 2018-02-26 10:08:00 +01:00

This looks more like an FFMPEG issue tbh…

This looks more like an FFMPEG issue tbh…

tbr is indeed what one is supposed to be using here, at least as per FFmpeg documentation. The issue is: libav removed it (probably, because it was "guessed" value). tbn is what exists in both libav and FFmpeg, but seems it is not trustful value. Since FFmpeg is what all distors are coming back to, and what is was supposed to be used will try to get code back to use tbr when using FFmpeg.

`tbr` is indeed what one is supposed to be using here, at least as per FFmpeg documentation. The issue is: `libav` removed it (probably, because it was "guessed" value). `tbn` is what exists in both libav and FFmpeg, but seems it is not trustful value. Since FFmpeg is what all distors are coming back to, and what is was supposed to be used will try to get code back to use `tbr` when using FFmpeg.

This issue was referenced by 370a2d6917

This issue was referenced by 370a2d6917ebd8df5177fe4854a447e3839dddaa

Changed status from 'Open' to: 'Resolved'

Changed status from 'Open' to: 'Resolved'

Added subscriber: @Twitching_astronaut

Added subscriber: @Twitching_astronaut

having this issue still in 2.83.9

Blender appears to trim the last 2 seconds of MKV clips exported from OBS

having this issue still in 2.83.9 Blender appears to trim the last 2 seconds of MKV clips exported from OBS

Added subscriber: @iss

Added subscriber: @iss

@Twitching_astronaut This should be fixed in 2.83.9. Please create new report with all required info and example files to reproduce.

@Twitching_astronaut This should be fixed in 2.83.9. Please create new report with all required info and example files to reproduce.
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
10 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#53857
No description provided.