Enhancement: Improve playback performance of intra x264 #34750

Closed
opened 2013-03-23 21:53:31 +01:00 by Björn Sonnenschein · 11 comments

%%%Linux Mint 64, recent build from the bildbot.

When there are two x264 Clips in the timeline which overlap each other and you start playback, the first clip is played smoothly, but as soon as the second clip starts, the playback stutters. I guess this is a searching Issue that can't be solved in blender.

However, if the clips are coded as intraframe (gop 1), because all frames are I frames, playback should always be smooth (my pc is not bad).

Maybe it would make sense to play only the I frames of All-I clips wothout trying to resolve any non-existing gop structure?%%%

%%%Linux Mint 64, recent build from the bildbot. When there are two x264 Clips in the timeline which overlap each other and you start playback, the first clip is played smoothly, but as soon as the second clip starts, the playback stutters. I guess this is a searching Issue that can't be solved in blender. However, if the clips are coded as intraframe (gop 1), because all frames are I frames, playback should always be smooth (my pc is not bad). Maybe it would make sense to play only the I frames of All-I clips wothout trying to resolve any non-existing gop structure?%%%

Changed status to: 'Open'

Changed status to: 'Open'

%%%Please attach example files or upload some video snippets + blendfile to a share hoster so we can check this easily. %%%

%%%Please attach example files or upload some video snippets + blendfile to a share hoster so we can check this easily. %%%

%%%Okay, here is a short clip: http://www.mediafire.com/?t0irtax1gb9888r
The clip is in the timeline of the attached .blend with relative path (same directory of the .blend).

I have noticed that the amount of stuttering is related to the video's bitrate. With higher bitrate the playback of the second clip in the timeline slows down and because of this i have uploaded a file with hight bitrate. Read speed of my pc is not the bottleneck. Kdenlive a similiar timeline smoothly, too.%%%

%%%Okay, here is a short clip: http://www.mediafire.com/?t0irtax1gb9888r The clip is in the timeline of the attached .blend with relative path (same directory of the .blend). I have noticed that the amount of stuttering is related to the video's bitrate. With higher bitrate the playback of the second clip in the timeline slows down and because of this i have uploaded a file with hight bitrate. Read speed of my pc is not the bottleneck. Kdenlive a similiar timeline smoothly, too.%%%

%%%No seek of non-existing frames happening in this case -- early out using single strip happening here. You could double-check this by generating timecodes for the strips.

And i guess actual issue is causes by playback sync. If i set it to No-Sync playback is always smooth on my laptop. Btw, i could not reproduce your issue -- playback is always bad if using AV-Sync option and it's always smooth when not using sync.

Also, is it a regression for you or this is something which never worked?%%%

%%%No seek of non-existing frames happening in this case -- early out using single strip happening here. You could double-check this by generating timecodes for the strips. And i guess actual issue is causes by playback sync. If i set it to No-Sync playback is always smooth on my laptop. Btw, i could not reproduce your issue -- playback is always bad if using AV-Sync option and it's always smooth when not using sync. Also, is it a regression for you or this is something which never worked?%%%

%%%8 bit dnxhd was used as an intermediate codec until now, so I haven't tried x264 before.

I see, with no sync it is smooth, except at the beginning of each clip. You have a short frame freeze everytime when a new clip starts and it's first frames are not buffered yet (so refresh sequencer should be used before playing to reproduce this), you may also see that the timeline cursor hooks up for a little moment on the beginning of a strip.
And It seems that, for me, playback with av sync is smooth for a clip if the cursor is placed somewhere on it before playback starts.

%%%

%%%8 bit dnxhd was used as an intermediate codec until now, so I haven't tried x264 before. I see, with no sync it is smooth, except at the beginning of each clip. You have a short frame freeze everytime when a new clip starts and it's first frames are not buffered yet (so refresh sequencer should be used before playing to reproduce this), you may also see that the timeline cursor hooks up for a little moment on the beginning of a strip. And It seems that, for me, playback with av sync is smooth for a clip if the cursor is placed somewhere on it before playback starts. %%%

%%%No buffering happens at all (unless you're using prefetching). It's just opening FFmpeg context and initializing initial frame buffers which takes time.

Would try to look into issue with av-sync but that's not actually my area.%%%

%%%No buffering happens at all (unless you're using prefetching). It's just opening FFmpeg context and initializing initial frame buffers which takes time. Would try to look into issue with av-sync but that's not actually my area.%%%

%%%Joerg, afraid i'll hand this report to you.

From what i understand, it's not actually correct logic in AUD_OpenALDevice::AUD_OpenALhandle::getPosition(). Namely that lines inside if(!m_isBuffered) condition. Seems this would be correct if no ahead reading happens and all unprocessed buffers are queued to OpenAL. However, it doesn't seem to be so -- there're much more buffers read than queued to OpenAL, which makes position being really jumpy.

Not sure why SDL fails as well, but this function seems really suspicious for me.%%%

%%%Joerg, afraid i'll hand this report to you. From what i understand, it's not actually correct logic in AUD_OpenALDevice::AUD_OpenALhandle::getPosition(). Namely that lines inside if(!m_isBuffered) condition. Seems this would be correct if no ahead reading happens and all unprocessed buffers are queued to OpenAL. However, it doesn't seem to be so -- there're much more buffers read than queued to OpenAL, which makes position being really jumpy. Not sure why SDL fails as well, but this function seems really suspicious for me.%%%
Member

%%%I talked to the developer of OpenAL soft when I wrote that code and it's as accurate as it can. As long as the playback is smooth it should be off by 1 frame max.

Apart from that sound cannot be the bottleneck, as there is no sound is this movie file... I've tried the sync modes on my laptop here. No sync plays "smoothly" but with lower FPS and frame drop and AV sync both jump, but that's because the video decoding is too slow obviously and this is expected behaviour. In what way is it "bad" for you Sergey?

I cannot help with the video decoding stuff, maybe Peter can?! Maybe the video decoding code seeks too much when AV sync is on, if you know where the code is, try printing the frame numbers in the video every time a frame is requested and where it seeks.%%%

%%%I talked to the developer of OpenAL soft when I wrote that code and it's as accurate as it can. As long as the playback is smooth it should be off by 1 frame max. Apart from that sound cannot be the bottleneck, as there is no sound is this movie file... I've tried the sync modes on my laptop here. No sync plays "smoothly" but with lower FPS and frame drop and AV sync both jump, but that's because the video decoding is too slow obviously and this is expected behaviour. In what way is it "bad" for you Sergey? I cannot help with the video decoding stuff, maybe Peter can?! Maybe the video decoding code seeks too much when AV sync is on, if you know where the code is, try printing the frame numbers in the video every time a frame is requested and where it seeks.%%%
Member

%%%please keep in mind, that blender since version 2.5 doesn't do prefetching or multi-threaded rendering (there is no easy solution, because of the animation system rewrite).

In Blender 2.49 this was also more or less a hack.

We need to write a serious prefetch and thread-management system which interoperates well with the new animation system.
I have some ideas, how that should look like, but haven't found the time to write it down.

Smooth playback is essentially pure luck with the current code base, sorry.%%%

%%%please keep in mind, that blender since version 2.5 doesn't do prefetching or multi-threaded rendering (there is no easy solution, because of the animation system rewrite). In Blender 2.49 this was also more or less a hack. We need to write a serious prefetch and thread-management system which interoperates well with the new animation system. I have some ideas, how that should look like, but haven't found the time to write it down. Smooth playback is essentially pure luck with the current code base, sorry.%%%

%%%Closing and marking as ToDo item. %%%

%%%Closing and marking as ToDo item. %%%

Changed status from 'Open' to: 'Archived'

Changed status from 'Open' to: 'Archived'
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
5 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#34750
No description provided.