First of all thanks for the FOBS project - it's been very useful.
What I'm currently trying to do is play a video and loop it in a special way - when the playback reaches the end of the video, it then plays in reverse until it reaches the start of the file, at which point it plays back normally in the forward direction again, and so on....
While trying to play video backwards, I've been working with the C++ wrapper and I've run into problems using the setFrame() and prevFrame() functions. It appears that seeking using setFrame() generally returns the frame immediately prior to the frame you are seeking to. As the prevFrame() function employs the setFrame() function, this causes any backwards playing of the video to skip every second frame.
The problem stems from the function compareTimeStamps(position, newPosition) in setFrameFast() which produces unreliable results.
In my attempt to fix this I came across a floating issue in frameIndexFromTimeStamp(TimeStamp t) where some floating point calculations return a wrong frameIndex due to the conversion from double to long.
I appear to have been able to fix this using a bit of a hack, but I was wondering if anyone else had discovered this and possibly written a fix? I'm not an expert in FFmpeg so I'd be interested in seeing other solutions.
I'm on 32 bit x86 Linux using the latest snapshot of FFmpeg (0.4.9 something) and fobs 0.4.1
Thanks!
Pierre
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
thanks for the post. Could you please extend a little bit on the inconsistencies you've found in the compareTimeStamps method as well as the problems and potential fix you have created for the frameIndexFromTimeStamp one? These methods seem to work fine for standard playback, but it's true I haven't tried them in all posible situations, so your fixes could potentially benefit other users.
Cheers,
Jose San Pedro
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
First of all thanks for the FOBS project - it's been very useful.
What I'm currently trying to do is play a video and loop it in a special way - when the playback reaches the end of the video, it then plays in reverse until it reaches the start of the file, at which point it plays back normally in the forward direction again, and so on....
While trying to play video backwards, I've been working with the C++ wrapper and I've run into problems using the setFrame() and prevFrame() functions. It appears that seeking using setFrame() generally returns the frame immediately prior to the frame you are seeking to. As the prevFrame() function employs the setFrame() function, this causes any backwards playing of the video to skip every second frame.
The problem stems from the function compareTimeStamps(position, newPosition) in setFrameFast() which produces unreliable results.
In my attempt to fix this I came across a floating issue in frameIndexFromTimeStamp(TimeStamp t) where some floating point calculations return a wrong frameIndex due to the conversion from double to long.
I appear to have been able to fix this using a bit of a hack, but I was wondering if anyone else had discovered this and possibly written a fix? I'm not an expert in FFmpeg so I'd be interested in seeing other solutions.
I'm on 32 bit x86 Linux using the latest snapshot of FFmpeg (0.4.9 something) and fobs 0.4.1
Thanks!
Pierre
Hi Pierre,
thanks for the post. Could you please extend a little bit on the inconsistencies you've found in the compareTimeStamps method as well as the problems and potential fix you have created for the frameIndexFromTimeStamp one? These methods seem to work fine for standard playback, but it's true I haven't tried them in all posible situations, so your fixes could potentially benefit other users.
Cheers,
Jose San Pedro