feedback request: frame accurate seeking lib

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

feedback request: frame accurate seeking lib

Louis Brandy
Hey guys,

I've created a frame accurate seeking library based on the standard  
ffmpeg libraries that I've convinced my company to LGPL and release.  
It's meant to support video processing applications that frequently  
require random access in a codec/format independent way. I've tried to  
preserve the full breadth of the formats and codecs that  
av_seek_frame() works with. I've tested it pretty extensively with our  
internal video set and with http://samples.mplayerhq.hu. I've uploaded  
a *very* basic version to sourceforge. You can see the SVN here:

http://ffmpeg-fas.svn.sourceforge.net/viewvc/ffmpeg-fas/

NOTE: This version still contains quite a bit of code that was meant  
for our internal use and so some of the design choices may seem  
awkward or totally unnecessary and will require a good deal of  
cleaning up. I'm releasing it in this state because I want to gauge if  
there is any interest in a library like this before refining it into a  
more.. shall we say.. usable state.

It provides a very simple interface for video processing applications  
to decode video, including seeking. It works by building a seek table  
through normal decoding of a video that can be saved and loaded later.  
This table provides the necessary information for frame-accurate  
seeking.

Some useful files:
dump_frames.c - shows how the simplified decoding interface works  
(without seeking)
seek_test.c - shows the test I've been using to test frame-accurate  
seeking and serves as a seek example
generate_seek_table.c - shows the current way I create seek tables  
using libavformat and libavcodec

I'd love to hear any questions/comments/concerns on this set of  
functionality and its usefulness. Also any improvements to the  
methodology would be greatly appreciated.

Regards,
Louis Brandy
_______________________________________________
libav-user mailing list
[hidden email]
https://lists.mplayerhq.hu/mailman/listinfo/libav-user
Reply | Threaded
Open this post in threaded view
|

Re: feedback request: frame accurate seeking lib

wl2776
Administrator
Wow! Such a thing is VERY much required for one of my projects!

I will give it a try when time will permit.
Will it compile in MSVC?

For now, from looking through sources, I have two minor suggestions: decouple libav initialization and FAS initialization and use libav's logging facility.

Louis Brandy wrote
It works by building a seek table through normal decoding of a video that can be saved and loaded later.  
This table provides the necessary information for frame-accurate seeking.
I don't completely understand...
Does it need to read through the whole video file in order to seek to the certain frame?
If yes, then it would be good to implement some mutexes and thread safety, than run an index table generation in backgound and call it periodically, as a user points to frames of his interest.
Reply | Threaded
Open this post in threaded view
|

Re: feedback request: frame accurate seeking lib

Louis Brandy
On Jul 30, 2008, at 11:10 AM, Vladimir Eremeev wrote:
>
> I will give it a try when time will permit.
> Will it compile in MSVC?

I didn't try but I don't think it would be difficult to do.

> For now, from looking through sources, I have two minor suggestions:
> decouple libav initialization and FAS initialization and use libav's  
> logging
> facility.

Yea. There are alot of elements like this that would improve the  
interface. If you don't mind, can you send me an email (maybe off-
list?) detailing your use-case? As constructed, it's far too  
specialized for my original needs (it was meant as an all-in-one  
wrapper for ffmpeg).

> I don't completely understand...
> Does it need to read through the whole video file in order to seek  
> to the
> certain frame?

Assuming you don't have a pre-built seek table from some previous run,  
yes. If you seek beyond the end of the current table, it'll need to  
serially read the file from that endpoint to the frame needed. It'll  
build the seek table for all the elements in between so that you pay  
this cost only once. And, if your use-case has the necessary  
infrastructure, you can save that table so you never have to rebuild  
it for that movie.

Threading the table generation is certainly an option but probably  
premature at this stage.

Regards,
Louis Brandy

_______________________________________________
libav-user mailing list
[hidden email]
https://lists.mplayerhq.hu/mailman/listinfo/libav-user
Reply | Threaded
Open this post in threaded view
|

Re: feedback request: frame accurate seeking lib

wl2776
Administrator
Louis Brandy wrote
If you don't mind, can you send me an email (maybe off-list?) detailing your use-case?
I am developing a builtin basic video editor (with video playing capabilities, of course), inside an ActiveX component/.

Currently I have developed something, basing on the pedagogic video player, described by Stefen Dranger (SDL and FFmpeg tutorial, linked from FFmpeg's documentation page).

The editing functionality is described already in the list: http://www.nabble.com/Again%2C-about-cutting-video-fragments-and-saving-them-to-MPEG2-file.-tt18650093.html , however, possible formats are not limited to MPEG-2.

Therefore I am thinking about coupling of this code together with Dranger's tutorial07.c

Louis Brandy wrote
> Does it need to read through the whole video file in order to seek  
> to the certain frame?

Assuming you don't have a pre-built seek table from some previous run,  
yes. If you seek beyond the end of the current table, it'll need to  
serially read the file from that endpoint to the frame needed. It'll  
build the seek table for all the elements in between so that you pay  
this cost only once. And, if your use-case has the necessary  
infrastructure, you can save that table so you never have to rebuild  
it for that movie.
In my case a user should be able to immediately jump to the certain location