microsoft / microsoft/DCVC

Invalid path issue when trying to save decoded frames

Open Beginner friendly
#163 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
829
Forks
138
Avg merge
1d 2h
Merged PRs (30d)
1

Description

I have a some YUV videos I want to run tests on but the test_video script fails with the following error:

FileNotFoundError: [Errno 2] No such file or directory: 'out_bin\\clic_mini\2b2883e1147e879ed7c423e0beccf3edde46d98462c26c965f1286086aba7df5_1922x1080_30fps_yuv420p_299frames_56kbps.yuv_q0.mp4/out.yuv'

What I think is happening:

  • Line 466 in test_video.py: args['curr_rec_path'] = args['curr_bin_path'].replace('.bin', '.mp4')
  • Line 291 in test_video.py: output_yuv_path = args['curr_rec_path'].replace('.yuv', f'_{total_kbps}kbps.yuv')

This two lines cause the output path to look like: out_bin\\clic_mini\2b2883e1147e879ed7c423e0beccf3edde46d98462c26c965f1286086aba7df5_1922x1080_30fps_yuv420p_299frames_56kbps.yuv_q0.mp4

However, inside YUV420Writer:

class YUV420Writer():
    def __init__(self, dst_path, width, height):
        if not dst_path.endswith('.yuv'):
            dst_path = dst_path + '/out.yuv'
        self.dst_path = dst_path
        self.width = width
        self.height = height

        self.file = open(dst_path, 'wb')

Since output_yuv_path end with .mp4, dst_path will end up as: out_bin\clic_mini\2b2883e1147e879ed7c423e0beccf3edde46d98462c26c965f1286086aba7df5_1922x1080_30fps_yuv420p_299frames_56kbps.yuv_q0.mp4/out.yuv'.

This create a path that goes through a directory that does not exist - 2b2883e1147e879ed7c423e0beccf3edde46d98462c26c965f1286086aba7df5_1922x1080_30fps_yuv420p_299frames_56kbps.yuv_q0.mp4, and as a result the line self.file = open(dst_path, 'wb') fails.

I currently don't see any mistake in the way I invoked the script, so any help would be appreciated.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in test_video.py at lines 291 and 466, then inspect YUV420Writer's destination-path handling. Reproduce the failure with a YUV420 test video and verify that the output path is treated consistently, so saving decoded frames no longer appends out.yuv beneath an .mp4 path.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
computer-vision
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.