Bug in Videotexturing in BGE #41004

Closed
opened 2014-07-09 17:08:26 +02:00 by Jean-Marc Vezien · 19 comments

System Information
Windows:64bit details here: system-info.txt

Blender Version
version 2.70 (sub 0),

Short description of error
Bugs in VideoTexturing a plane via FFMPEG
Exact steps for others to reproduce the error

The attached test blend file (video_texture_bge_debug.blend) video_texture_bge_debug.blend with a cube and a plane, exhibits two possible bugs in BGE related to videotexturing. See python script Movie.py.

Bug 1: Videotexturing of a plane with VideoFFMpeg call seems to work with file inputs ou webcam, but fails to display anything
with a rtsp stream as input. Note: An RTSP stream server can be generated with VLC:

vlc -vvv your_file.avi --sout "#rtp{dst=dest_adress,port=1234,sdp=rtsp://your_ip_adress:8080/test.sdp}"

In the script code attached to the plane in the example, the plane is textured by default with a file which name is inputed in the game logic properties
of the plane (sample: Video_jmv_right.avi and Video_jmv_left.avi, not included - you can put any decent avi files instead). Works fine.
Just below in the code (commented) are the corresponding rtsp calls, which DO NOT work on my machine.

My hunch is a problem in FFMPEG default settings with RTSP in Blender, which requires some buffering time (say 500 ms). For example VLC handles RTSP quite well in the "open stream" Ctrl-N option of the VLC GUI, with a default 1000ms buffering.

Bug 2: In stereo mode, the provided example should texture the plane with two different videos, one for each eye. I provided a pre-draw routine which is applied
(See outputs on console), but does not result in the appropriate rendering in stereo.
Obviously one needs a stereo capable hardware to test this. I have Nvidia Quadro cards.

Not sure this is a bug, maybe I do this wrong, I need suggestions on this.

**System Information** Windows:64bit details here: [system-info.txt](https://archive.blender.org/developer/F97191/system-info.txt) **Blender Version** version 2.70 (sub 0), **Short description of error** Bugs in VideoTexturing a plane via FFMPEG **Exact steps for others to reproduce the error** The attached test blend file (video_texture_bge_debug.blend) [video_texture_bge_debug.blend](https://archive.blender.org/developer/F97190/video_texture_bge_debug.blend) with a cube and a plane, exhibits two possible bugs in BGE related to videotexturing. See python script Movie.py. Bug 1: Videotexturing of a plane with VideoFFMpeg call seems to work with file inputs ou webcam, but fails to display anything with a rtsp stream as input. Note: An RTSP stream server can be generated with VLC: vlc -vvv your_file.avi --sout "#rtp{dst=dest_adress,port=1234,sdp=rtsp://your_ip_adress:8080/test.sdp}" In the script code attached to the plane in the example, the plane is textured by default with a file which name is inputed in the game logic properties of the plane (sample: Video_jmv_right.avi and Video_jmv_left.avi, not included - you can put any decent avi files instead). Works fine. Just below in the code (commented) are the corresponding rtsp calls, which DO NOT work on my machine. My hunch is a problem in FFMPEG default settings with RTSP in Blender, which requires some buffering time (say 500 ms). For example VLC handles RTSP quite well in the "open stream" Ctrl-N option of the VLC GUI, with a default 1000ms buffering. Bug 2: In stereo mode, the provided example should texture the plane with two different videos, one for each eye. I provided a pre-draw routine which is applied (See outputs on console), but does not result in the appropriate rendering in stereo. Obviously one needs a stereo capable hardware to test this. I have Nvidia Quadro cards. Not sure this is a bug, maybe I do this wrong, I need suggestions on this.

Changed status to: 'Open'

Changed status to: 'Open'

Added subscriber: @occamjmv

Added subscriber: @occamjmv

I reported two bugs in one , as they are tightly related (video texturing). A split in two trackers is possible.

I reported two bugs in one , as they are tightly related (video texturing). A split in two trackers is possible.
Member

Added subscribers: @kupoman, @dfelinto, @brita

Added subscribers: @kupoman, @dfelinto, @brita
Member

I don't feel a need to split this in two bugs for now.
@dfelinto can you take a look at the bug 2 stereo part?

As to bug 1.. @occamjmv you can display a video, but not a rtsp stream?
I am not sure this is supported. It probably was never tested, but if it is a matter of using ffmpeg with the correct settings maybe it is doable? I don't know nearly enough about this.. @kupoman any idea of whom to talk to?

I don't feel a need to split this in two bugs for now. @dfelinto can you take a look at the bug 2 stereo part? As to bug 1.. @occamjmv you can display a video, but not a rtsp stream? I am not sure this is supported. It probably was never tested, but if it is a matter of using ffmpeg with the correct settings maybe it is doable? I don't know nearly enough about this.. @kupoman any idea of whom to talk to?

I'm investigating that, the rtsp seems simply the lack of building ffmpeg for blender with that support " --enable-network --enable-protocol=tcp --enable-demuxer=rtsp --enable-decoder=h264". I'm getting the ffmpeg sources to see if that fixes it

I'm investigating that, the rtsp seems simply the lack of building ffmpeg for blender with that support " --enable-network --enable-protocol=tcp --enable-demuxer=rtsp --enable-decoder=h264". I'm getting the ffmpeg sources to see if that fixes it

Re: rtsp
@occamjmv testing with the new OSX libraries fixed the initial issue, but now Blender freezes when the script calls for refresh(True).

Could you possibly build ffmpeg in your OS (windows, though it may be easier if you have a linux station and build there first) to see if it works?

Re: rtsp @occamjmv testing with the new OSX libraries fixed the initial issue, but now Blender freezes when the script calls for **refresh**(True). Could you possibly build ffmpeg in your OS (windows, though it may be easier if you have a linux station and build there first) to see if it works?

Added subscriber: @BenoitBolsee

Added subscriber: @BenoitBolsee

@BenoitBolsee could you take look at this (the rtsp part)? or at least pointing to some directions to try a fix. I think the problem is on VideoFFmpeg.cpp:1004

*find the correct frame, in case of streaming and no cache, it means just* return the next frame. This is not quite correct, may need more work
	while (av_read_frame(m_formatCtx, &packet) >= 0)

It's where it is hanging for me at least. (you need a recompiled ffmpeg libraries with the updated flags but Sergey said he was to update the libs for Windows soon).

@BenoitBolsee could you take look at this (the rtsp part)? or at least pointing to some directions to try a fix. I think the problem is on VideoFFmpeg.cpp:1004 *find the correct frame, in case of streaming and no cache, it means just* return the next frame. This is not quite correct, may need more work ``` while (av_read_frame(m_formatCtx, &packet) >= 0) ``` It's where it is hanging for me at least. (you need a recompiled ffmpeg libraries with the updated flags but Sergey said he was to update the libs for Windows soon).

re: stereo
@occamjmv what is the output you get from this file? Since I don't have a quadbuffer card I only always get the 'BACK' buffer, is the buffer swapping prints working as expected? I would expect this to be an issue of pre_draw() not being called once per stereo eye, and not an issue in videotexture

re: stereo @occamjmv what is the output you get from this file? Since I don't have a quadbuffer card I only always get the 'BACK' buffer, is the buffer swapping prints working as expected? I would expect this to be an issue of pre_draw() not being called once per stereo eye, and not an issue in videotexture
Member

Don't remember if I tested rstp streaming, probably not (I tested http streaming though). In the case of rtsp streaming it is possible that this function call is missing:
av_read_play(m_formatCtx)
It seems necessary to kick off the streaming. The most logical place is to call it in VideoFFmpeg::play(), only is m_isStreaming is true of course.
The corresponding av_read_pause() should be used in VideoFFmpeg::pause()

To be checked: opening a rstp input should cause the m_isStreaming flag to be set (line 554)

Don't remember if I tested rstp streaming, probably not (I tested http streaming though). In the case of rtsp streaming it is possible that this function call is missing: av_read_play(m_formatCtx) It seems necessary to kick off the streaming. The most logical place is to call it in VideoFFmpeg::play(), only is m_isStreaming is true of course. The corresponding av_read_pause() should be used in VideoFFmpeg::pause() To be checked: opening a rstp input should cause the m_isStreaming flag to be set (line 554)

@BenoitBolsee Thanks. Only forcing m_isStreaming works already (P89), but the play/pause changes don't seem to interfere (P90). Which one should I push 89 or 90?

@BenoitBolsee Thanks. Only forcing m_isStreaming works already ([P89](https://archive.blender.org/developer/P89.txt)), but the play/pause changes don't seem to interfere ([P90](https://archive.blender.org/developer/P90.txt)). Which one should I push 89 or 90?
Member

Added subscriber: @dalai-1

Added subscriber: @dalai-1
Member

@dalai-1 looking at ffmpeg code, av_read_play is implemented for the rtsp decoder (and only for it), so P90 is the correct one.

@dalai-1 looking at ffmpeg code, av_read_play is implemented for the rtsp decoder (and only for it), so [P90](https://archive.blender.org/developer/P90.txt) is the correct one.

Thanks @BenoitBolsee, committed on 6f846da2 (windows and linux need to build libraries with this settings still, I'm debating on the bf-committers mailing list to see if the official libs adopt that, otherwise they need to be custom build when rtsp is needed).

I'll wait @occamjmv reply to investigate the other issue further. It's hard to debug this without having their Quadbuffer setup at hand.

Thanks @BenoitBolsee, committed on 6f846da2 (windows and linux need to build libraries with this settings still, I'm debating on the bf-committers mailing list to see if the official libs adopt that, otherwise they need to be custom build when rtsp is needed). I'll wait @occamjmv reply to investigate the other issue further. It's hard to debug this without having their Quadbuffer setup at hand.

Removed subscriber: @dalai-1

Removed subscriber: @dalai-1
Member

waiting for @occamjmv to provide more info using the quadbuffer setup

waiting for @occamjmv to provide more info using the quadbuffer setup

Changed status from 'Open' to: 'Archived'

Changed status from 'Open' to: 'Archived'
Bastien Montagne self-assigned this 2014-07-29 15:10:35 +02:00

No news since over a week…

No news since over a week…
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#41004
No description provided.