-
Notifications
You must be signed in to change notification settings - Fork 7.1k
modified code of io.read_video to interpret start_pts and end_pts in seconds #1313
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
Conversation
Hi, Thanks for the PR! I do think we should use seconds as a global mesure, instead of the pts from each stream. This PR seems to keep backwards-compatibility with the previous code, and also fixes the issues that have been discussed in #1248 I believe, is that right? also, cc @bjuncek and @stephenyan1231 |
Yes this PR solves the issues discussed in #1248. As far as I know to keep this change backward compaitible an attribute can be added to the io.read_video method for selecting the time unit, and if we set it default to 'pts' then code will be backward compaitible. cc @bjuncek and @stephenyan1231 |
This seems much cleaner than #1248, the only question/concern I have is the fact that we are still storing the pts in a stream-specific way, which means that it is not consistent along the pipeline (iiuc, Thoughts? |
It can be handled by changing return statement of io.read_video_timestamps from cc @bjuncek and @stephenyan1231 |
I think we should find the best of both worlds. It is good that we have started the implementation with PyAV first, because it was simple and enabled us to iterate faster on a few things. If it wasn't for backwards-compatibility reasons, I'd prefer an approach that uses absolute metrics everywhere, for example seconds. Can we find a way of keeping BC given this change? |
To keep it BC the function definitions of functions using pts can be changed i.e. cc @bjuncek and @stephenyan1231 |
I think I agree with your proposal. I also think we should add the same option to Can you implement those changes? |
Yes, I will implement it and will generate a new PR for it. cc @bjuncek and @stephenyan1231 |
Hi, I have made the required changes and created a new PR #1331 . cc @bjuncek and @stephenyan1231 |
Hi, @fmassa is there any update on this PR. |
Hi @cskanani Test failures seem to be related to this PR
Also, FYI we are working on with @stephenyan1231 to make the video reading part be entirely on C++, so this part of the codebase will be deprecated soon. |
Ok. Then I am not working further on this PR. |
Hi, Actually, for now the PR that I mentioned before will live together with the current implementation based on PyAV, and will be in experimental state. So the changes that you made here are actually very relevant and will be merged in torchvision. |
Hi, Please check this PR #1331 I have made all the required changes, there are no merge conflicts and it is also passing all the test cases. cc @bjuncek and @stephenyan1231 |
Looks good to me - can we close this PR then and continue onwards there? |
Yes, please. |
The start_pts and end_pts attributes of io.read_video method were not having any time unit. It was not clear what start_pts and end_pts values signifies (this values depends on stream.time_base time unit).
Modified the code of io.read_video so now user can provide start_pts and end_pts values in seconds, the stream.time_base is then used to convert the values of start_pts and end_pts for av.