VSE: Reduce playback stalls when new video clips start playing #118503
No reviewers
Labels
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset System
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
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
Viewport & EEVEE
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Asset Browser Project
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
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
Module
Viewport & EEVEE
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Severity
High
Severity
Low
Severity
Normal
Severity
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
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#118503
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "aras_p/blender:speedup_isffmpeg"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
When starting to play back a movie strip, there was a "oh, let's figure out if this is a video file?" check, immediately followed by "let's initialize the machinery to decode a video file". The first one is kinda redundant, since if it will happen to not be a video file, the latter
check will nicely fail.
Addressed that by removing (seemingly unused at all?) functionality from
ImBufAnim
, now it is only used for video file playback. Details:ImBufAnim
is only ever used to play back "video files", so remove all the other modes of operation from it ("image sequence").ImBufAnim::curtype
be not needed, it only needs to store state of whether it's initialized already.imb_get_anim_type
(which does very costlyisffmpeg
) when starting to play ImBufAnim.ImBufAnim
that were just flat out unused.In Gold previs playback between 1:41-1:55, on Windows/Ryzen5950X:
imb_get_anim_type
: 234ms -> zero! Since that is no longer used.It seems that this patch will interfere with the code which tries to tell video from audio
.ogg
files inED_path_extension_type()
.There are few things which I am not sure why we need to have/do:
ANIM_SEQUENCE
type ofImBufAnim
? Do we ever useImBufAnim
to access image sequences? I thought we use ImBuf for it, not the anim API.Good catch wrt
.ogg
. Whoops!So, I guess:
IMB_isanim
) usage, keep existing code with full-fledged detection.anim_getnew
), there's no need to do full-blown detection since that is immediately followed by "try to actually initialize the decoder".I have no idea what
ANIM_SEQUENCE
is, the code was already there. I can try to figure that out.I think we can keep
IMB_isanim()
as-is. Or, rather, for achieving the goal of lower latency on strip cuts I do not think optimizationIMB_isanim()
is the most ultimate way, but it might still worth optimizing it for other usecases.For the latency on cuts I think the most interesting would be to "just" get rid of
ImBufAnim::curtype
. This will imply that theImbAnim
is only used for video files, which I think is a fair point. I do not know why we'd want an extra abstraction level for image sequences. TheImage
data-block does not rely on it, and quite sure the Image strip does not either. It could be some historical rudiment.Doing so will remove even more code around
ImbAnimType
,imb_get_anim_type
(make it purely booleanIMB_isanim
), and will also avoid an extraavformat_open_input
call upon animation start.Unfortunately, it turns out the
FFmpegIndexBuilderContext
andIndexBuildContext
are potentially of sync, and this change definitely makes them to go out of sync.This is because of C-style sub-classing and casts to base class: the head of
FFmpegIndexBuilderContext
is expected to matchIndexBuildContext
, as there are reinterpret casts between them.I think we need to make this to be real C++ sub-classing, and maybe sprincle some smart pointers in the
index_ffmpeg_create_context
. And eventually move all functions as virtual methods.For now it will suffice to simply define empty
IndexBuildContext
, and makeFFmpegIndexBuilderContext
subclass of it (and replaceMME_cnew
withMEM_new
, andMEM_freeN
withMEM_delete
for the context)@blender-bot build