paumarquez/mono2binaural-conv-tasnet

Saving first images

Closed this issue · 2 comments

Hi, Thanks for sharing the pre-processing code. It is really helpful. I have a question about the frame extraction code.
In line 35-36 of the script generate_frame.py script, black images are saved. why is it done so? I guess this part only runs if in the dataset there are some files that are less than 10 seconds. Are there any such files? If so instead of the first images the last images should be save liked that. Please correct me if I have grossly misunderstood something.

HI Kranti, as you pointed out, some mp4 videos were less than 10 seconds long, so I had to replicate some frames so that there was a frame for every 0.1 seconds of the 10 seconds audio clip.
Watching the videos it seemed like the first frame appeared after the sound had started so I decided to replicate the first frame (which is not black, sorry if the comment in the code is confusing) so that there was a frame during the full 10 seconds audio clip.
I'm glad you're finding the code useful. Don't hesitate to ask anything else if necessary.

Thanks, Pau for the quick reply. Now the initial frame saving got clarified. After running the code, I realized that the initial frames are not actually zero. However, I modified the code and used ffmpeg instead of cv2. I am attaching below the get_frames function here that I modified.

def get_frames(filename):
    to_folder = get_folder_name(filename)
    cmd = 'ffmpeg -i '+filename+' -start_number 0 -r 10 '+to_folder+'/%06d.png'
    os.system(cmd)