gaomingqi / Track-Anything

Track-Anything is a flexible and interactive tool for video object tracking and segmentation, based on Segment Anything, XMem, and E2FGVI.
MIT License
6.4k stars 471 forks source link

Change output codec/bitrate? #68

Open megascans opened 1 year ago

megascans commented 1 year ago

Using the changes from https://github.com/gaomingqi/Track-Anything/issues/26 to export a video of the mask through a luma matte

https://github.com/gaomingqi/Track-Anything/blob/b26b7fec95dbd9a51f3f897826f7bb3b12bee614/tracker/base_tracker.py#L99-L102

with:

painted_image = mask_painter(painted_image, (final_mask==0).astype('uint8'), mask_color=0, mask_alpha=1, contour_width=0)
painted_image = mask_painter(painted_image, (final_mask>0).astype('uint8'), mask_color=1, mask_alpha=1, contour_width=0)

The output though is a low bitrate h264 mp4 which has a lot of compression artifacts. Is there a way to change the codec to something like ProRes or increase the bitrate.

Changing the codec to something like prores_ks doesn't work for me https://github.com/gaomingqi/Track-Anything/blob/b26b7fec95dbd9a51f3f897826f7bb3b12bee614/app.py#L348

ttaa9 commented 4 months ago

Did you ever find a solution for this?

megascans commented 4 months ago

Did you ever find a solution for this?

Nope, but I'd imagine this is outdated now, no?