ArrowLuo / CLIP4Clip

An official implementation for "CLIP4Clip: An Empirical Study of CLIP for End to End Video Clip Retrieval"
https://arxiv.org/abs/2104.08860
MIT License
879 stars 123 forks source link

Unsupported video formats after compressing #30

Closed ofir1080 closed 3 years ago

ofir1080 commented 3 years ago

Hi, Great work. Thank you very much for sharing the code. A small issue I encountered when trying to train C4C on DiDeMo dataset. As recommended, I ran your ffmpeg script and tried to train the model on it. However, the new generated compressed videos of formats 3gp, 3g2 and mpg are missing the moov atom and therefore their frames cannot be extracted (and the video cannot be played). As a result, the fps is 0 the we get division by zero exception at dataloader_activitynet_retrieval.py line 207.

Does the ffmpeg command needs some modification?

ArrowLuo commented 3 years ago

Hi, @ofir1080, you may cp them from the original folder to the destination folder with a replacement type. E.g., cp A/*.3gp B/ . I did it manually on different datasets if the compressed video is with size 0. The given compress script needs to improve to cover this issue.

ofir1080 commented 3 years ago

Got it, thanks!

tiesanguaixia commented 1 year ago

Got it, thanks!

Hi, I glance over the above reply by @ArrowLuo but I did not get it, could you please tell me how to deal with the bug like:

File "/home/ubuntu/Documents/src/datasets/rawvideo_util.py", line 76, in get_video_data
    image_input = self.video_to_tensor(video_path, self.transform, sample_fp=self.framerate, start_time=start_time, end_time=end_time)
  File "/home/ubuntu/Documents/src/datasets/rawvideo_util.py", line 36, in video_to_tensor
    total_duration = (frameCount + fps - 1) // fps
ZeroDivisionError: integer division or modulo by zero

I encountered this when I train on the MSVD dataset.

tiesanguaixia commented 1 year ago

Hi, @ofir1080, you may cp them from the original folder to the destination folder with a replacement type. E.g., cp A/*.3gp B/ . I did it manually on different datasets if the compressed video is with size 0. The given compress script needs to improve to cover this issue.

Hi, thank you for your great work! I did not get it, could you please tell me how to deal with the bug like:

File "/home/ubuntu/Documents/src/datasets/rawvideo_util.py", line 76, in get_video_data
    image_input = self.video_to_tensor(video_path, self.transform, sample_fp=self.framerate, start_time=start_time, end_time=end_time)
  File "/home/ubuntu/Documents/src/datasets/rawvideo_util.py", line 36, in video_to_tensor
    total_duration = (frameCount + fps - 1) // fps
ZeroDivisionError: integer division or modulo by zero

I encountered this when I train on the MSVD dataset.