voxel51 / fiftyone

The open-source tool for building high-quality datasets and computer vision models
https://fiftyone.ai
Apache License 2.0
8.08k stars 537 forks source link

[BUG] cvat - concat videos failed #4627

Closed ChicoQi closed 4 weeks ago

ChicoQi commented 1 month ago

Instructions

Thank you for submitting an issue. Please refer to our issue policy for information on what types of issues we address.

  1. Please fill in this template to ensure a timely and thorough response
  2. Remove the section instructions but leave the section header
  3. Place an "x" between the brackets next to an option if it applies. For example:
    • [x] Selected option
  4. Please delete everything above this line before submitting the issue

Describe the problem

fouv.concat_videos in cvat.py failed.

Code to reproduce issue

Provide a reproducible test case that is the bare minimum necessary to generate the problem. Please avoid sharing code that relies on your local data or datasets. Include a short video or screenshot if the bug is in the App.

# commands and/or screenshots here
ExecutableRuntimeError: 
Command 
'
ffmpeg -loglevel error 
-f concat -safe 0 
-i 
/tmp/tmptj1wfvu4/input_list.txt 
-c copy 
/tmp/cvat_import_chico1/cvat.mp4
' failed with error:
b"[concat @ 0x59ce2e5d1cc0] Impossible to open 
'
/tmp/tmp6owc8wwbp4'\n/tmp/tmptj1wfvu4/input_list.txt: No such file or directory\n"

System information

Other info/logs

Include any logs or source code that would be helpful to diagnose the problem. If including tracebacks, please include the full traceback. Large logs and files should be attached. Please do not use screenshots for sharing text. Code snippets should be used instead when providing tracebacks, logs, etc.

Willingness to contribute

The FiftyOne Community encourages bug fix contributions. Would you or another member of your organization be willing to contribute a fix for this bug to the FiftyOne codebase?

ChicoQi commented 1 month ago

My input_list.txt has lots of ..mp4 but ffmpeg seems can't deal with double dot rather than one dot like .mp4.

I manually ran ffmpeg -loglevel error -f concat -safe 0 -i /tmp/tmpw0zyftkh/input_list.txt -c copy /tmp/cvat_import_chico2/cvat.mp4 and the same error occurred.

$ head /tmp/tmpw0zyftkh/input_list.txt 
file '/tmp/tmp44yd5t3h/0..mp4'
file '/tmp/tmp44yd5t3h/1..mp4'
file '/tmp/tmp44yd5t3h/2..mp4'
file '/tmp/tmp44yd5t3h/3..mp4'
file '/tmp/tmp44yd5t3h/4..mp4'
file '/tmp/tmp44yd5t3h/5..mp4'
file '/tmp/tmp44yd5t3h/6..mp4'
file '/tmp/tmp44yd5t3h/7..mp4'
file '/tmp/tmp44yd5t3h/8..mp4'
file '/tmp/tmp44yd5t3h/9..mp4'

After digging a little bit, this line might be the root cause, chunk_path = os.path.join(tmp_dir, "%d.%s" % (chunk_id, ext)) at https://github.com/voxel51/fiftyone/blob/develop/fiftyone/utils/cvat.py#L376

Finally, "%d.%s" is changed to "%d%s" and then it worked.

brimoor commented 4 weeks ago

@ChicoQi thanks for catching this! Will be fixed by https://github.com/voxel51/fiftyone/pull/4674 and released as part of fiftyone==0.25, slated for release on Monday August 19