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

Is there any way to replace video stream in a vrs file? #135

Closed
chenjoya opened this issue Sep 7, 2023 · 6 comments
Closed

Is there any way to replace video stream in a vrs file? #135

chenjoya opened this issue Sep 7, 2023 · 6 comments
Labels
enhancement New feature or request

Comments

@chenjoya
Copy link

chenjoya commented Sep 7, 2023

Hi, thank you for the amazing work. We want to mosaic the people's face in the video stream of a vrs, but we can only find the way to extract image from a vrs file rather than write to it.

Could you provide some guidelines to achieve it? Many thanks.

@chenjoya chenjoya added the enhancement New feature or request label Sep 7, 2023
@georges-berenger
Copy link
Contributor

Have you tried class RecordFilterCopier in https://github.com/facebookresearch/vrs/blob/main/vrs/utils/FilterCopyHelpers.h ? It should allow you to do what you need.

@georges-berenger
Copy link
Contributor

Put your custom image filter code in a class derived from the RecordFilterCopier class, that you pass to vrs::utils::filterCopy via a custom MakeStreamFilterFunction that injects the right filter for each stream (or calls makeCopier for the streams that shouldn't be modified).

@chenjoya
Copy link
Author

Thank you so much. I have solved my problems. In fact I am working with Meta's Ego4D team and we need this to blur face in VRS file. I provide my implementation here: https://github.com/chenjoya/vrsfacem/blob/master/vrs/vrs/utils/cli/MakeFaceMosaicCopier.cpp
Do you have some guidances?

@georges-berenger
Copy link
Contributor

good to hear you're unblocked.
The code looks good.
Suggestion:
shouldCopyVerbatim() is a lot more complicated than need be:
makeFaceMosaicCopier could use RecordFileReader::mightContainImages and RecordFileReader::mightContainAudio to either return a FaceMosaic if mightContainImages is true, otherwise a makeZeroFilterCopier if mightContainAudio is true, otherwise, a Copier. Then you can delete most of the code in shouldCopyVerbatim and filterAudio entirely.

@chenjoya
Copy link
Author

Nice. VRS is really talented. I learned a lot.

Thank you so much!

@georges-berenger
Copy link
Contributor

You're welcome!

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

No branches or pull requests

2 participants