Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VideoPlayer set_stream_position() doesn't work (seeking is not implemented) #14430

Closed
DimaKiva opened this issue Dec 8, 2017 · 23 comments
Closed

Comments

@DimaKiva
Copy link

DimaKiva commented Dec 8, 2017

Operating system or device, Godot version, GPU Model and driver (if graphics related):
Ubuntu 16.04, Godot 3.0 beta 1

Steps to reproduce:
set_stream_position(20.0)

@DimaKiva DimaKiva changed the title VideoPlauer set_stream_position not work VideoPlayer set_stream_position not work Dec 8, 2017
@akien-mga
Copy link
Member

What kind of VideoStream are you playing? This bug report doesn't provide enough information, please try to be more specific.

@akien-mga
Copy link
Member

@DimaKiva
Copy link
Author

DimaKiva commented Dec 9, 2017

@hungrymonkey
Copy link
Contributor

i am just looking around to see how to add seek to ogg.

looks pretty complicated

http://blog.pearce.org.nz/2009/05/video-seeking-improvements.html

i am debating whether or not to try to fix it since i kinda want to understand how ogg works

@blurymind
Copy link

@hungrymonkey would it be easier to implement for webm?

@hungrymonkey
Copy link
Contributor

@blurymind probably somewhat the same difficulty.

you have to seek to find keyframes. The code doesnt really separate grabbing frames and finding the keyframe.

@Galileo53
Copy link

I would like to give this problem a push.
It would be really great if the seek function could be implemented.
Godot 3.1 ?

@zszen
Copy link

zszen commented Sep 25, 2019

godot 3.1.1 same bug

@hungrymonkey
Copy link
Contributor

I do not think libsimplewebm supports seeking.

@hungrymonkey
Copy link
Contributor

hungrymonkey commented Oct 4, 2019

@akien-mga I attempted to implement ogg theora seek support but I do not understand why the video just waits for the full seek as if the player wants to catch up although I submitted zero frames.
https://github.com/hungrymonkey/godot/tree/seek_theora
Can somebody tell me why?
Nevermind, I found it. Play() resets the time

hungrymonkey pushed a commit to hungrymonkey/godot that referenced this issue Oct 4, 2019
First Ogg Theora Seek Attempt

Ogg Tidbits
Ogg lacks a seek table.
Timestamp exists on the ogg page with the closing packet stream.
Ogg_page_packets can discern which page has a timestamp.
Keyframes exist in pages with ogg_pages_packets(&og) == 1

Proposal
Split the file into BUFFERSIZE segments for binary searching and backtracking.

Algorithm
Binary Search Ogg Page Timestamps
Backtrack to Keyframe
Catch up to Seek

Section 1:
This section is implemented as nested loops. The inner loops finds an unprocessed buffer segment and retrieves the first ogg_page even if it spans across buffer segments.

The outer loop compares the ogg_page into an iterative binary search. Since ogg_page_packets can discern the granulepos or time stamp, no ogg_packet is inspected.

Section 2:
The section is implemented as a buffer sync step to combine all ogg_pages into one ogg_packet.

Section 3:
Submit the frames into the theora decoder and advance the video forward until the buffer catches up to the seek time.

Modified
Implemented Seek
Added BUFFERSIZE and remove the hard coded 4096

Known Bugs
Seek cannot find subsequent ogg_pages in the buffer segment. When a buffer section has two ogg_pages and the keyframe is encoded in the latter ogg_page. Seek will not find it.

VideoTheoraStreak is littered with time resets. Currently, seek only works during play mode.

Seek 0 does not work

Links
https://www.theora.org/doc/libtheora-1.0/group__decfuncs.html
https://xiph.org/oggz/doc/group__basics.html

Issue godotengine#14430
hungrymonkey pushed a commit to hungrymonkey/godot that referenced this issue Oct 4, 2019
First Ogg Theora Seek Attempt

Ogg Tidbits
Ogg lacks a seek table.
Timestamp exists on the ogg page with the closing packet stream.
Ogg_page_packets can discern which page has a timestamp.
Keyframes exist in pages with ogg_pages_packets(&og) == 1

Proposal
Split the file into BUFFERSIZE segments for binary searching and backtracking.

Algorithm
Binary Search Ogg Page Timestamps
Backtrack to Keyframe
Catch up to Seek

Section 1:
This section is implemented as nested loops. The inner loops finds an unprocessed buffer segment and retrieves the first ogg_page even if it spans across buffer segments.

The outer loop compares the ogg_page into an iterative binary search. Since ogg_page_packets can discern the granulepos or time stamp, no ogg_packet is inspected.

Section 2:
The section is implemented as a buffer sync step to combine all ogg_pages into one ogg_packet.

Section 3:
Submit the frames into the theora decoder and advance the video forward until the buffer catches up to the seek time.

Modified
Implemented Seek
Added BUFFERSIZE and remove the hard coded 4096

Known Bugs
Seek cannot find subsequent ogg_pages in the buffer segment. When a buffer section has two ogg_pages and the keyframe is encoded in the latter ogg_page. Seek will not find it.

VideoTheoraStreak is littered with time resets. Currently, seek only works during play mode.

Seek 0 does not work

Links
https://www.theora.org/doc/libtheora-1.0/group__decfuncs.html
https://xiph.org/oggz/doc/group__basics.html

Issue godotengine#14430
@hungrymonkey
Copy link
Contributor

I never realize force pushing would lead to such spam. Opps.

@CrimsonZA
Copy link

set_stream_position method is still not functioning in Godot 3.2 beta 4

@hungrymonkey
Copy link
Contributor

@CrimsonZA Godot already have a ffmpeg decoder for all codecs
https://github.com/kidrigger/godot-videodecoder

@CrimsonZA
Copy link

seems like Godot isn't ready to play video on Android, at least not on an Oculus Go, definitely not for immersive vide using the built in vide player node or godot-videodecoder

@hungrymonkey
Copy link
Contributor

hungrymonkey commented Jan 6, 2020

@CrimsonZA You can try my seek theora branch which might end up in Godot 4.0. You have to compile in support for it. Tell me if I have any bugs.

@arsen-ch
Copy link

arsen-ch commented Feb 7, 2020

@CrimsonZA Godot already have a ffmpeg decoder for all codecs
https://github.com/kidrigger/godot-videodecoder

Does it support seek function?

@hungrymonkey
Copy link
Contributor

hungrymonkey commented Feb 13, 2020

@Tooniis
Copy link

Tooniis commented Aug 22, 2020

How about removing this property until the seek functions are implemented?

@Calinou
Copy link
Member

Calinou commented Aug 22, 2020

@Tooniis Removing properties is technically a breaking change (even if they were never working well in the first place), so we can't do it in the 3.2 branch. For properties, we can hide them from the editor (like for contact shadows), but we can't do that for methods.

@Calinou Calinou changed the title VideoPlayer set_stream_position not work VideoPlayer set_stream_position() doesn't work Apr 14, 2021
@yunylz
Copy link

yunylz commented May 25, 2021

Will this ever be implemented?

@hungrymonkey
Copy link
Contributor

https://github.com/kidrigger/godot-videodecoder/blob/master/src/gdnative_videodecoder.c#L1083

@heyimyunyl Upstream official position is to use kidrigger's gdnative plugin. I made an ogg-theora seek implementation but upstream broke a few things within their ogg theora so I cant commit it.

@Calinou Calinou changed the title VideoPlayer set_stream_position() doesn't work VideoPlayer set_stream_position() doesn't work (seeking is not implemented) Jun 15, 2021
@Calinou
Copy link
Member

Calinou commented Jul 3, 2021

Closing in favor of godotengine/godot-proposals#2945, as feature proposals are now tracked on the Godot proposals repository.

@golddotasksquestions
Copy link

For those interested, there is a PR for webm seek() support: #57744

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

No branches or pull requests