Skip to content

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

Open
Alessandro201 wants to merge 9 commits into
Demmenie:mainfrom
Alessandro201:main
Open

Fixed symlink bug which made FFmpeg unable to load the video#7
Alessandro201 wants to merge 9 commits into
Demmenie:mainfrom
Alessandro201:main

Conversation

@Alessandro201

Copy link
Copy Markdown

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