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

Vis problem : Skipping frame 2 ...49 #15

Open
ichraf opened this issue Mar 21, 2017 · 7 comments
Open

Vis problem : Skipping frame 2 ...49 #15

ichraf opened this issue Mar 21, 2017 · 7 comments

Comments

@ichraf
Copy link

ichraf commented Mar 21, 2017

Dear Vadim
Thank you for sharing your code. I had some problems with make vis. Finally i linked vis.ccp with openCV 3.2 and changed the Makefile INSTALLED_DEPS = -I/usr/local/include -L/usr/local/lib. . make vis worked.
When I run "mkdir -p examples/vis_dump && ./mpegflow examples/mpi_sintel_final_alley_1.avi | ./vis examples/mpi_sintel_final_alley_1.avi examples/vis_dump", the vis doesn't work fine. Actually, It skips all the frames from 2 to 49 but without any errors.
If i used mpegflow with --raw option, it starts skipping from the 3rd frame.

I added a line in the main function of vis.cpp to display flow.second from the function read.flow
inside the loop for
fprintf(stderr,"flow second = %d.\n", int(flow.second));
It always returns -1
I want to say that i received warnings when compiling mpegflow and vis regarding the types, example:
"mpegflow.cpp:293:128: warning: format ‘%lld’ expects argument of type ‘long long int’, but argument 2 has type ‘int64_t {aka long int}’ [-Wformat=]
lld frame_index=%d pict_type=%c output_type=raw shape=%zux4\n", pts, frameIndex, pictType, motionVectors.size()); "

So the problem comes from the https://github.com/vadimkantorov/mpegflow/blob/master/vis.cpp#L72
I tried many types lld ld to match vis and mpegflow but nothing happens
Thank you for your consideration

@vadimkantorov
Copy link
Owner

Thanks for the investigation. I've fixed this bug. Could you check if it works now for you?

@ichraf
Copy link
Author

ichraf commented Mar 21, 2017

Thank you for responding and fixing the bug. Actually i made it working this afternoon by adding the option --occupancy in both mpegflow and vis, otherwise it doesn't work.
I also edited the mpegflow.cpp to skip appending dummies to the prev vector by commenting the if test:
https://github.com/vadimkantorov/mpegflow/blob/master/mpegflow.cpp#L310

I will restrart from the begining and test with many videos and let you know. Thanks.

@ichraf
Copy link
Author

ichraf commented Mar 23, 2017

Thank you, Vadim. you fixed most of the issues. In my case, I still need to link to /urs/local/lib.
Make sure to correct this line https://github.com/vadimkantorov/mpegflow/blob/master/examples/vis_mpeg_flow.sh#L7
The example that you put is working with and without occupancy.
If I want to work with my videos I still need to edit the mpegflow.cpp to skip appending dummies to the prev vector.
For the first sequence, I had some Invalid UE Golomb code but I get my motion vectors without skipping. Otherwise, with the dummies, I still have the skipping aaall the frames due to "std:bab_alloc" error.

With another video sequence with high resolution, even skipping dummies doesn't solve it, my algorithm still skips some frames not all of them.

@divine-github-profile-name

With another video sequence with high resolution, even skipping dummies doesn't solve it, my algorithm still skips some frames not all of them.

The same happens to me. With dummies it doesn't work, but without them skips too many frames.

@vadimkantorov
Copy link
Owner

You can check the Group of Pictures (GOP) structure of your file by sth like ffprobe -show_frames input.mp4 | grep pict_type. If there's not many pict_type=P, mpegflow can't do much anyway (dummies were introduced in the first place only to remedy for small number of missing frames). Otherwise, suggestions / patches on better treating missing frames are very welcome!

@wanfengkai
Copy link

In my case, commenting dummy helps a lot with bad alloc issue. But when I use mp4 instead of avi format video it can't give right motion vector on each frame. It seems that all the vector value in P frame is 0 and only vectors in B frame is non-zero.
Is it possible to merge the vector in B frame to P frame so that the mpegflow will work?

@vadimkantorov
Copy link
Owner

In theory, it doesn't skip specifically B-frames, it just tries to extract the motion vector info if it's filled in by ffmpeg: https://github.com/vadimkantorov/mpegflow/blob/master/mpegflow.cpp#L155

Will be happy to take a patch that fixes dummies and the mem leak.

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

No branches or pull requests

4 participants