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

Fixed symlink bug which made FFmpeg unable to load the video #7

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Alessandro201
Copy link

When creating a symlink of the source video by passing the option do_not_copy=True to VideoHash(), the link is created using the source video as-is for the target, even if it's relative to the current directory. A target in a link, however, needs to be either absolute or relative to the link otherwise it won't be valid and, in this case, FFmpeg will not be able to load the video giving an error.

Example previously:

import os
print(os.getcwd()) # /home/user
vh = VideoHash(path="src_video.mp4", do_not_copy=True)

os.system(f"ls -l {vh.video_hash}")
# /tmp/[...]/video/video.mp4 -> src_video.mp4
# link is not valid -> FFmpeg returns error because it's unable to load the video

Example now:

import os
print(os.getcwd()) # /home/user
vh = VideoHash(path="src_video.mp4", do_not_copy=True)

os.system(f"ls -l {vh.video_hash}")
# /tmp/[...]/video/video.mp4 -> /home/user/src_video.mp4
# link is valid -> FFmpeg works correctly

This PR fixes both this issue, and an issue in which the program crashes if FFmpeg is not able
to load a video and compute its duration, now an exception is thrown.

The majority of the diffs are due to black, which was run as mentioned in the contributing guidelines. The core of this PR is the commit b29af5a.

`do_not_copy=True` to VideoHash(), the link is created with the source
video as-is, even if it's relative to the current directory. A target in
a link however needs to be either absolute or relative to the source.

Thix commit fixes the issue, and an issue in which the program crashes if ffmpeg is not able
to load a video and compute it's duration, now an exception is thrown.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant