akiver / cs-demo-manager

Companion application for your Counter-Strike demos.
https://cs-demo-manager.com
MIT License
1.42k stars 195 forks source link

🔺 FFMPEG Returned an error #849

Closed TomasBen closed 4 months ago

TomasBen commented 4 months ago

Describe the bug

Whenever I try to generate a video, I get the following message:

ffmpeg version n5.1.4-81-gc8bd7f9209-20240517 Copyright (c) 2000-2023 the FFmpeg developers built with gcc 13.2.0 (crosstool-NG 1.26.0.65_ecc5e41) configuration: --prefix=/ffbuild/prefix --pkg-config-flags=--static --pkg-config=pkg-config --cross-prefix=x86_64-w64-mingw32- --arch=x86_64 --target-os=mingw32 --enable-gpl --enable-version3 --disable-debug --disable-w32threads --enable-pthreads --enable-iconv --enable-libxml2 --enable-zlib --enable-libfreetype --enable-libfribidi --enable-gmp --enable-fontconfig --enable-libvorbis --enable-opencl --disable-libpulse --enable-libvmaf --disable-libxcb --disable-xlib --enable-amf --enable-libaom --enable-libaribb24 --enable-avisynth --disable-chromaprint --enable-libdav1d --enable-libdavs2 --disable-libfdk-aac --enable-ffnvcodec --enable-cuda-llvm --enable-frei0r --enable-libgme --enable-libkvazaar --enable-libass --enable-libbluray --disable-libjxl --enable-libmp3lame --enable-libopus --enable-librist --enable-libssh --enable-libtheora --enable-libvpx --enable-libwebp --enable-lv2 --disable-openal --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopenmpt --enable-librav1e --enable-librubberband --enable-schannel --enable-sdl2 --enable-libsoxr --enable-libsrt --enable-libsvtav1 --enable-libtwolame --enable-libuavs3d --disable-libdrm --disable-vaapi --enable-libvidstab --enable-vulkan --enable-libshaderc --disable-libplacebo --enable-libx264 --enable-libx265 --enable-libxavs2 --enable-libxvid --enable-libzimg --enable-libzvbi --extra-cflags=-DLIBTWOLAME_STATIC --extra-cxxflags= --extra-libs=-lgomp --extra-ldflags=-pthread --extra-ldexeflags= --cc=x86_64-w64-mingw32-gcc --cxx=x86_64-w64-mingw32-g++ --ar=x86_64-w64-mingw32-gcc-ar --ranlib=x86_64-w64-mingw32-gcc-ranlib --nm=x86_64-w64-mingw32-gcc-nm --extra-version=20240517

libavutil 57. 28.100 / 57. 28.100 libavcodec 59. 37.100 / 59. 37.100 libavformat 59. 27.100 / 59. 27.100 libavdevice 59. 7.100 / 59. 7.100

libavfilter 8. 44.100 / 8. 44.100 libswscale 6. 7.100 / 6. 7.100 libswresample 4. 7.100 / 4. 7.100 libpostproc 56. 6.100 / 56. 6.100

[image2 @ 00000228fd6d6900] Could find no file with path 'I:\SteamLibrary\steamapps\common\Counter-Strike Global Offensive\game\csgo\replays\1-sequence\1-sequence%04d.tga' and index in the range 0-4

I:\SteamLibrary\steamapps\common\Counter-Strike Global Offensive\game\csgo\replays\1-sequence\1-sequence%04d.tga: No such file or directory

Demo links

No response

Steps to reproduce

  1. Use new or already downloaded demo file
  2. Generate sequence
  3. Generate video
  4. Wait for CS2 to stop playing the demo and the error will pop up shortly after

Expected behavior

I would expect for the app to say something like "processing demo" and then show the output folder but instead it just throws said error shortly after CS2 stopped running.

How often does this bug happen?

Every time

Log file

csdm.log

Environment information

Version: 3.5.3 OS: win32 x64 10.0.22631 Electron: 30.0.3 Chrome: 124.0.6367.119 Last database migrations: v2 - 2024-05-18T02:05:42.328Z v1 - 2024-03-17T12:46:50.462Z

Additional context

HLAE and FFMPEG are up to date. Tried with 3 different files and they all throw the same error. Already tried reinstalling HLAE from the github repo, same error, but didnt try rolling back to a older version. The only thing that's changed since last time I used the app is HLAE, which is the only thing that I had to update. Sorry if this is duplicated, I didnt see any related open discussions or issues.

RomanoHodysh commented 4 months ago

Same issue for me. Everything is up to date but it just finishes generation of video with error. Does not matter what demo I try

D3XX3R commented 4 months ago

Can confirm this issue.

leonid-cpp commented 4 months ago

For those who want a real quick workaround.

What happens? TGA files in the raw source directory have 8 digits, but the csdm expects 4.

How does the workaround work? It creates a wrapper that replaces any %04d.tga it encounters in the ffmpeg arguments with %08d.tga.

Step-by-step instructions:

  1. Install Python:

    • Download and install Python from the official website.
    • During installation, make sure to check the option to add Python to the system PATH.
  2. Install PyInstaller:

    • Open a command prompt or terminal (e.g. cmd.exe) and run:
      pip install pyinstaller
  3. Locate FFmpeg:

    • In the csdm's video tab, click the 'browse' button in the ffmpeg section.
  4. Create the FFmpeg wrapper script:

    • In the same directory as ffmpeg.exe, create a new file named ffmpeg.py.
    • Open ffmpeg.py in a text editor and paste the following code:
      
      import sys
      import subprocess

def modify_arguments(args): modified_args = [] for arg in args: if '%04d.tga' in arg: arg = arg.replace('%04d.tga', '%08d.tga') modified_args.append(arg) return modified_args

if name == 'main': original_args = sys.argv[1:] modified_args = modify_arguments(original_args) subprocess.run(['ffmpeg_orig.exe'] + modified_args)

   - Save and close ffmpeg.py.

5. **Rename the original FFmpeg executable:**
   - In the same directory, rename ffmpeg.exe to ffmpeg_orig.exe.

6. **Create the executable wrapper:**
   - Open a command prompt in the directory containing ffmpeg.py and ffmpeg_orig.exe.
   - Run the following command:

pyinstaller --onefile ffmpeg.py


   - This will create a new ffmpeg.exe in the dist subdirectory.

7. **Move the new FFmpeg executable:**
   - Go to the dist directory and move the new ffmpeg.exe to the same directory as ffmpeg_orig.exe.

That's it!