Repository: Vchitect/VBench
Issue: How to solve the problem "av.error.FileNotFoundError: [Errno 2] No such file or directory”
Root cause: Environment Incompatibility

Here is my code:

from vbench2_beta_long.utils import split_video_into_scenes
video_path = "video_files/inputs/_b2ZthqQG24.mp4" # 2分15秒视频
output_dir = "video_files/outputs/_b2ZthqQG24/"
threshold = 20 # 2秒切割
split_video_into_scenes(video_path, output_dir, threshold)[](url)

Outputs is as following:
(renzhifei) (base) [qa-caif-cicd@SH-IDCA1404-10-140-54-48 VBench]$ /home/qa-caif-cicd/anaconda3/envs/renzhifei/bin/python /home/qa-caif-cicd/renzhifei/VBench/split_video.py
2024-07-03 15:15:49,146 - pyscenedetect - INFO - Downscale factor set to 5, effective resolution: 256 x 144
  Detected: 0 | Progress:   0%|                                        | 0/3384 [00:00<?, ?frames/s]2024-07-03 15:15:49,149 - pyscenedetect - INFO - Detecting scenes...
  Detected: 12 | Progress: 100%|███████████████████████████████████████████████| 3384/3384 [00:06<00:00, 540.68frames/s]
Traceback (most recent call last):
  File "/home/qa-caif-cicd/renzhifei/VBench/split_video.py", line 6, in <module>
    split_video_into_scenes(video_path, output_dir, threshold)
  File "/home/qa-caif-cicd/renzhifei/VBench/vbench2_beta_long/utils.py", line 89, in split_video_into_scenes
    save_video_by_scene_list(video_path, video_name, scene_list, output_dir=output_dir)
  File "/home/qa-caif-cicd/renzhifei/VBench/vbench2_beta_long/utils.py", line 120, in save_video_by_scene_list
    write_video(output_filename, current_scene_frames, fps=fps)
  File "/home/qa-caif-cicd/anaconda3/envs/renzhifei/lib/python3.8/site-packages/torchvision/io/video.py", line 135, in write_video
    container.mux(packet)
  File "av/container/output.pyx", line 207, in av.container.output.OutputContainer.mux
  File "av/container/output.pyx", line 213, in av.container.output.OutputContainer.mux_one
  File "av/container/output.pyx", line 168, in av.container.output.OutputContainer.start_encoding
  File "av/error.pyx", line 326, in av.error.err_check
av.error.FileNotFoundError: [Errno 2] No such file or directory

video can be download on s3 : s3://xyz-process-2/video/ar/video/v001/_b2ZthqQG24.mp4

 information of the video:
"format": "MP4",
"codec": "h264", 
"resolution": "720x1280", 
"frame_rate": "25/1", 
"duration": "135.360000"


![img_v3_02ce_81dfaf1a-dab8-457c-920f-ea79fa6bf26g](https://github.com/Vchitect/VBench/assets/32838822/e193d76f-697a-4f25-aa0f-252958d007ae)



Hi @chaserRen , I run your code on the video generated by OpenAI's Sora, and everything runs well. 

In the Outputs Info, I notice that the bug occurs in `torchvision.io.write_video`. What's your version of `torchvision`, `pyav`? 

Please check your dependency's version.
Our dev environment is:

```bash []
Package                  Version
------------------------ ------------------
absl-py                  2.1.0
accelerate               0.30.0
addict                   2.4.0
antlr4-python3-runtime   4.9.3
attrs                    23.2.0
av                       12.0.0
bitsandbytes             0.42.0
black                    24.2.0
boto3                    1.34.62
botocore                 1.34.62
certifi                  2024.2.2
charset-normalizer       3.3.2
click                    8.1.7
cloudpickle              3.0.0
contourpy                1.2.0
cycler                   0.12.1
Cython                   3.0.9
decorator                4.4.2
decord                   0.6.0
detectron2               0.6
dreamsim                 0.1.3
easydict                 1.13
einops                   0.7.0
exceptiongroup           1.2.0
facexlib                 0.3.0
fairscale                0.4.13
ffmpeg                   1.4
filelock                 3.13.1
filterpy                 1.4.5
fonttools                4.49.0
fsspec                   2024.2.0
ftfy                     6.1.3
future                   1.0.0
fvcore                   0.1.5.post20221221
grpcio                   1.62.1
h11                      0.14.0
huggingface-hub          0.21.4
hydra-core               1.3.2
idna                     3.6
imageio                  2.34.0
imageio-ffmpeg           0.4.9
imgaug                   0.4.0
importlib_metadata       7.0.2
importlib_resources      6.3.0
iopath                   0.1.9
Jinja2                   3.1.3
jmespath                 1.0.1
joblib                   1.3.2
kiwisolver               1.4.5
lazy_loader              0.3
llvmlite                 0.42.0
lmdb                     1.4.1
lvis                     0.5.3
Markdown                 3.5.2
MarkupSafe               2.1.5
matplotlib               3.8.3
moviepy                  1.0.3
mypy-extensions          1.0.0
networkx                 3.2.1
numba                    0.59.0
numpy                    1.26.4
nvidia-cublas-cu11       11.10.3.66
nvidia-cuda-nvrtc-cu11   11.7.99
nvidia-cuda-runtime-cu11 11.7.99
nvidia-cudnn-cu11        8.5.0.96
omegaconf                2.3.0
open-clip-torch          2.24.0
openai-clip              1.0.1
opencv-python            4.9.0.80
outcome                  1.3.0.post0
packaging                24.0
pandas                   2.2.1
pathspec                 0.12.1
peft                     0.1.0
pillow                   10.2.0
pip                      23.3.1
platformdirs             4.2.0
portalocker              2.8.2
prettytable              3.10.0
proglog                  0.1.10
protobuf                 5.26.0
psutil                   5.9.8
pyav                     12.0.4
pycocoevalcap            1.2
pycocotools              2.0.7
pyecharts                2.0.5
pyiqa                    0.1.10
pyparsing                3.1.2
PySocks                  1.7.1
python-dateutil          2.9.0.post0
pytz                     2024.1
PyYAML                   6.0.1
regex                    2023.12.25
requests                 2.31.0
s3transfer               0.10.0
safetensors              0.4.2
scenedetect              0.6.3
scikit-image             0.22.0
scikit-learn             1.4.1.post1
scipy                    1.12.0
selenium                 4.19.0
sentencepiece            0.2.0
setuptools               68.2.2
shapely                  2.0.3
simplejson               3.19.2
six                      1.16.0
snapshot-selenium        0.0.2
sniffio                  1.3.1
sortedcontainers         2.4.0
tabulate                 0.9.0
tensorboard              2.16.2
tensorboard-data-server  0.7.2
termcolor                2.4.0
threadpoolctl            3.3.0
tifffile                 2024.2.12
timm                     0.9.16
tokenizers               0.13.3
tomli                    2.0.1
torch                    1.13.1
torchvision              0.14.1
tqdm                     4.66.2
transformers             4.33.2
trio                     0.25.0
trio-websocket           0.11.1
typing_extensions        4.10.0
tzdata                   2024.1
urllib3                  1.26.18
wcwidth                  0.2.13
Werkzeug                 3.0.1
wheel                    0.41.2
wsproto                  1.2.0
yacs                     0.1.8
yapf                     0.40.2
zipp                     3.18.0
```


> 你好@chaserRen，我在 OpenAI 的 Sora 生成的视频上运行了你的代码，一切运行良好。
> 
> 在输出信息中，我注意到错误发生在 中`torchvision.io.write_video`。您的 版本是什么`torchvision`？`pyav`
> 
> 请检查您的依赖项的版本。 我们的开发环境是：
> 
> ```shell
> Package                  Version
> ------------------------ ------------------
> absl-py                  2.1.0
> accelerate               0.30.0
> addict                   2.4.0
> antlr4-python3-runtime   4.9.3
> attrs                    23.2.0
> av                       12.0.0
> bitsandbytes             0.42.0
> black                    24.2.0
> boto3                    1.34.62
> botocore                 1.34.62
> certifi                  2024.2.2
> charset-normalizer       3.3.2
> click                    8.1.7
> cloudpickle              3.0.0
> contourpy                1.2.0
> cycler                   0.12.1
> Cython                   3.0.9
> decorator                4.4.2
> decord                   0.6.0
> detectron2               0.6
> dreamsim                 0.1.3
> easydict                 1.13
> einops                   0.7.0
> exceptiongroup           1.2.0
> facexlib                 0.3.0
> fairscale                0.4.13
> ffmpeg                   1.4
> filelock                 3.13.1
> filterpy                 1.4.5
> fonttools                4.49.0
> fsspec                   2024.2.0
> ftfy                     6.1.3
> future                   1.0.0
> fvcore                   0.1.5.post20221221
> grpcio                   1.62.1
> h11                      0.14.0
> huggingface-hub          0.21.4
> hydra-core               1.3.2
> idna                     3.6
> imageio                  2.34.0
> imageio-ffmpeg           0.4.9
> imgaug                   0.4.0
> importlib_metadata       7.0.2
> importlib_resources      6.3.0
> iopath                   0.1.9
> Jinja2                   3.1.3
> jmespath                 1.0.1
> joblib                   1.3.2
> kiwisolver               1.4.5
> lazy_loader              0.3
> llvmlite                 0.42.0
> lmdb                     1.4.1
> lvis                     0.5.3
> Markdown                 3.5.2
> MarkupSafe               2.1.5
> matplotlib               3.8.3
> moviepy                  1.0.3
> mypy-extensions          1.0.0
> networkx                 3.2.1
> numba                    0.59.0
> numpy                    1.26.4
> nvidia-cublas-cu11       11.10.3.66
> nvidia-cuda-nvrtc-cu11   11.7.99
> nvidia-cuda-runtime-cu11 11.7.99
> nvidia-cudnn-cu11        8.5.0.96
> omegaconf                2.3.0
> open-clip-torch          2.24.0
> openai-clip              1.0.1
> opencv-python            4.9.0.80
> outcome                  1.3.0.post0
> packaging                24.0
> pandas                   2.2.1
> pathspec                 0.12.1
> peft                     0.1.0
> pillow                   10.2.0
> pip                      23.3.1
> platformdirs             4.2.0
> portalocker              2.8.2
> prettytable              3.10.0
> proglog                  0.1.10
> protobuf                 5.26.0
> psutil                   5.9.8
> pyav                     12.0.4
> pycocoevalcap            1.2
> pycocotools              2.0.7
> pyecharts                2.0.5
> pyiqa                    0.1.10
> pyparsing                3.1.2
> PySocks                  1.7.1
> python-dateutil          2.9.0.post0
> pytz                     2024.1
> PyYAML                   6.0.1
> regex                    2023.12.25
> requests                 2.31.0
> s3transfer               0.10.0
> safetensors              0.4.2
> scenedetect              0.6.3
> scikit-image             0.22.0
> scikit-learn             1.4.1.post1
> scipy                    1.12.0
> selenium                 4.19.0
> sentencepiece            0.2.0
> setuptools               68.2.2
> shapely                  2.0.3
> simplejson               3.19.2
> six                      1.16.0
> snapshot-selenium        0.0.2
> sniffio                  1.3.1
> sortedcontainers         2.4.0
> tabulate                 0.9.0
> tensorboard              2.16.2
> tensorboard-data-server  0.7.2
> termcolor                2.4.0
> threadpoolctl            3.3.0
> tifffile                 2024.2.12
> timm                     0.9.16
> tokenizers               0.13.3
> tomli                    2.0.1
> torch                    1.13.1
> torchvision              0.14.1
> tqdm                     4.66.2
> transformers             4.33.2
> trio                     0.25.0
> trio-websocket           0.11.1
> typing_extensions        4.10.0
> tzdata                   2024.1
> urllib3                  1.26.18
> wcwidth                  0.2.13
> Werkzeug                 3.0.1
> wheel                    0.41.2
> wsproto                  1.2.0
> yacs                     0.1.8
> yapf                     0.40.2
> zipp                     3.18.0
> ```

Here is my packages:
> ```shell
> Package                  Version
> ------------------------ ---------------------------------
> 1. _libgcc_mutex             0.1                        main  
> 2. _openmp_mutex             5.1                       1_gnu  
> 3. absl-py                   2.1.0                    pypi_0    pypi
> 4. addict                    2.4.0                    pypi_0    pypi
> 5. antlr4-python3-runtime    4.9.3                    pypi_0    pypi
> 6. boto3                     1.34.139                 pypi_0    pypi
> 7. botocore                  1.34.139                 pypi_0    pypi
> 8. ca-certificates           2024.3.11            h06a4308_0  
> 9. certifi                   2024.7.4                 pypi_0    pypi
> 10. charset-normalizer        3.3.2                    pypi_0    pypi
> 11. click                     8.1.7                    pypi_0    pypi
> 12. contourpy                 1.2.1                    pypi_0    pypi
> 13. cycler                    0.12.1                   pypi_0    pypi
> 14. cython                    3.0.10                   pypi_0    pypi
> 15. decorator                 4.4.2                    pypi_0    pypi
> 16. decord                    0.6.0                    pypi_0    pypi
> 17. easydict                  1.13                     pypi_0    pypi
> 18. einops                    0.8.0                    pypi_0    pypi
> 19. facexlib                  0.3.0                    pypi_0    pypi
> 20. fairscale                 0.4.13                   pypi_0    pypi
> 21. ffmpeg                    1.4                      pypi_0    pypi
> 22. filelock                  3.15.4                   pypi_0    pypi
> 23. filterpy                  1.4.5                    pypi_0    pypi
> 24. fonttools                 4.53.0                   pypi_0    pypi
> 25. fsspec                    2024.6.1                 pypi_0    pypi
> 26. ftfy                      6.2.0                    pypi_0    pypi
> 27. future                    1.0.0                    pypi_0    pypi
> 28. fvcore                    0.1.5.post20221221          pypi_0    pypi
> 29. grpcio                    1.64.1                   pypi_0    pypi
> 30. huggingface-hub           0.23.4                   pypi_0    pypi
> 31. idna                      3.7                      pypi_0    pypi
> 32. imageio                   2.34.2                   pypi_0    pypi
> 33. imageio-ffmpeg            0.5.1                    pypi_0    pypi
> 34. imgaug                    0.4.0                    pypi_0    pypi
> 35. importlib-metadata        8.0.0                    pypi_0    pypi
> 36. importlib-resources       6.4.0                    pypi_0    pypi
> 37. iopath                    0.1.10                   pypi_0    pypi
> 38. jmespath                  1.0.1                    pypi_0    pypi
> 39. joblib                    1.4.2                    pypi_0    pypi
> 40. kiwisolver                1.4.5                    pypi_0    pypi
> 41. lazy-loader               0.4                      pypi_0    pypi
> 42. ld_impl_linux-64          2.38                 h1181459_1  
> 43. libffi                    3.4.4                h6a678d5_1  
> 44. libgcc-ng                 11.2.0               h1234567_1  
> 45. libgomp                   11.2.0               h1234567_1  
> 46. libstdcxx-ng              11.2.0               h1234567_1  
> 47. llvmlite                  0.43.0                   pypi_0    pypi
> 48. lmdb                      1.5.1                    pypi_0    pypi
> 49. lvis                      0.5.3                    pypi_0    pypi
> 50. markdown                  3.6                      pypi_0    pypi
> 51. markupsafe                2.1.5                    pypi_0    pypi
> 52. matplotlib                3.9.1                    pypi_0    pypi
> 53. moviepy                   1.0.3                    pypi_0    pypi
> 54. ncurses                   6.4                  h6a678d5_0  
> 55. networkx                  3.2.1                    pypi_0    pypi
> 56. numba                     0.60.0                   pypi_0    pypi
> 57. numpy                     2.0.0                    pypi_0    pypi
> 58. nvidia-cublas-cu11        11.10.3.66               pypi_0    pypi
> 59. nvidia-cuda-nvrtc-cu11    11.7.99                  pypi_0    pypi
> 60. nvidia-cuda-runtime-cu11  11.7.99                  pypi_0    pypi
> 61. nvidia-cudnn-cu11         8.5.0.96                 pypi_0    pypi
> 62. omegaconf                 2.3.0                    pypi_0    pypi
> 63. openai-clip               1.0.1                    pypi_0    pypi
> 64. opencv-python             4.10.0.84                pypi_0    pypi
> 65. openssl                   3.0.14               h5eee18b_0  
> 66. packaging                 24.1                     pypi_0    pypi
> 67. pandas                    2.2.2                    pypi_0    pypi
> 68. pillow                    10.4.0                   pypi_0    pypi
> 69. pip                       24.0             py39h06a4308_0  
> 70. platformdirs              4.2.2                    pypi_0    pypi
> 71. portalocker               2.10.0                   pypi_0    pypi
> 72. proglog                   0.1.10                   pypi_0    pypi
> 73. protobuf                  4.25.3                   pypi_0    pypi
> 74. pyav                      12.0.5                   pypi_0    pypi
> 75. pycocoevalcap             1.2                      pypi_0    pypi
> 76. pycocotools               2.0.8                    pypi_0    pypi
> 77. pyiqa                     0.1.10                   pypi_0    pypi
> 78. pyparsing                 3.1.2                    pypi_0    pypi
> 79. python                    3.9.19               h955ad1f_1  
> 80. python-dateutil           2.9.0.post0              pypi_0    pypi
> 81. pytz                      2024.1                   pypi_0    pypi
> 82. pyyaml                    6.0.1                    pypi_0    pypi
> 83. readline                  8.2                  h5eee18b_0  
> 84. regex                     2024.5.15                pypi_0    pypi
> 85. requests                  2.32.3                   pypi_0    pypi
> 86. s3transfer                0.10.2                   pypi_0    pypi
> 87. safetensors               0.4.3                    pypi_0    pypi
> 88. scenedetect               0.6.4                    pypi_0    pypi
> 89. scikit-image              0.24.0                   pypi_0    pypi
> 90. scikit-learn              1.5.1                    pypi_0    pypi
> 91. scipy                     1.13.1                   pypi_0    pypi
> 92. setuptools                69.5.1           py39h06a4308_0  
> 93. shapely                   2.0.4                    pypi_0    pypi
> 94. six                       1.16.0                   pypi_0    pypi
> 95. sqlite                    3.45.3               h5eee18b_0  
> 96. tabulate                  0.9.0                    pypi_0    pypi
> 97. tensorboard               2.17.0                   pypi_0    pypi
> 98. tensorboard-data-server   0.7.2                    pypi_0    pypi
> 99. termcolor                 2.4.0                    pypi_0    pypi
> 100. threadpoolctl             3.5.0                    pypi_0    pypi
> 101. tifffile                  2024.7.2                 pypi_0    pypi
> 102. timm                      1.0.7                    pypi_0    pypi
> 103. tk                        8.6.14               h39e8969_0  
> 104. tokenizers                0.13.3                   pypi_0    pypi
> 105. tomli                     2.0.1                    pypi_0    pypi
> 106. torch                     1.13.1                   pypi_0    pypi
> 107. torchvision               0.14.1                   pypi_0    pypi
> 108. tqdm                      4.66.4                   pypi_0    pypi
> 109. transformers              4.33.2                   pypi_0    pypi
> 110. typing-extensions         4.12.2                   pypi_0    pypi
> 111. tzdata                    2024.1                   pypi_0    pypi
> 112. urllib3                   1.26.19                  pypi_0    pypi
> 113. wcwidth                   0.2.13                   pypi_0    pypi
> 114. werkzeug                  3.0.3                    pypi_0    pypi
> 115. wheel                     0.43.0           py39h06a4308_0  
> 116. xz                        5.4.6                h5eee18b_1  
> 117. yacs                      0.1.8                    pypi_0    pypi
> 118. yapf                      0.40.2                   pypi_0    pypi
> 119. zipp                      3.19.2                   pypi_0    pypi
> 120. zlib                      1.2.13               h5eee18b_1  
> ```
I update torchvision, code goes on, but have a new problem code stops running here
![20240704-171605](https://github.com/Vchitect/VBench/assets/32838822/12a8bda3-3f54-46fd-a0ab-66b1a0598383)


Hi, I didn't see bugs reported in your terminal. Could you describe your problem in detail?

Hi, we're closing the issue since there is no follow-up question, but feel free to re-open it if you have any further questions!