Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] ScreenToGif.2.39 X64 Portable Build - ScreenToGif.EncodeWithFfmpeg Path Error #1238

Open
MaverickLoneshark opened this issue Oct 1, 2023 · 11 comments
Assignees
Labels
🔷 Bug 🐛 Type • An undesired situation happens. ⬜ Pending Status • This issue stills needs to be analyzed.

Comments

@MaverickLoneshark
Copy link

MaverickLoneshark commented Oct 1, 2023

Description
Saving project as Mp4 with default encoder fails due to intermediary 'no such file or directory' issues (missing correct path to temp).

To Reproduce
Steps to reproduce the behavior:

  1. Download the latest X64 portable build of ScreenToGif
  2. Open Recorder
  3. Record a screen capture
  4. Close Recorder
  5. Open Editor
  6. Attempt to save as MP4
  7. Select the ffmpeg.exe location if prompted to locate
  8. Use default settings for MP4 and attempt to save
  9. Encoding will fail

Expected behavior
ScreenToGif should produce a valid MP4 video.

Screenshots
image

image

   at ScreenToGif.Util.EncodingManager.EncodeWithFfmpeg(ExportPreset preset, List`1 listFrames, Int32 id, CancellationTokenSource tokenSource, String processing) in C:\Users\[redacted]\source\ScreenToGif\ScreenToGif\Util\EncodingManager.cs:line 1774
   at ScreenToGif.Util.EncodingManager.Encode(ExportProject project, ExportPreset preset, Int32 id, CancellationTokenSource tokenSource) in C:\Users\[redacted]\source\ScreenToGif\ScreenToGif\Util\EncodingManager.cs:line 1038

Command:

-hwaccel auto -safe 0 -f concat -i "file:temp\ScreenToGif\Recording\2023-09-30 23-48-03\Encode 2023-10-01 07-06-00-89\concat.txt" -c:v libx264 -preset fast -pix_fmt yuv420p -vf "scale=trunc(iw/2)*2:trunc(ih/2)*2" -f mp4 -vsync passthrough -y "gifs\you_died.mp4"


Result:


ffmpeg version N-112250-g6f7bf64dbc-20231001 Copyright (c) 2000-2023 the FFmpeg developers
  built with gcc 13.2.0 (crosstool-NG 1.25.0.232_c175b21)
  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-lzma --enable-fontconfig --enable-libharfbuzz --enable-libvorbis --enable-opencl --disable-libpulse --enable-libvmaf --disable-libxcb --disable-xlib --enable-amf --enable-libaom --enable-libaribb24 --enable-avisynth --enable-chromaprint --enable-libdav1d --enable-libdavs2 --disable-libfdk-aac --enable-ffnvcodec --enable-cuda-llvm --enable-frei0r --enable-libgme --enable-libkvazaar --enable-libass --enable-libbluray --enable-libjxl --enable-libmp3lame --enable-libopus --enable-librist --enable-libssh --enable-libtheora --enable-libvpx --enable-libwebp --enable-lv2 --enable-libvpl --enable-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 --enable-vaapi --enable-libvidstab --enable-vulkan --enable-libshaderc --enable-libplacebo --enable-libx264 --enable-libx265 --enable-libxavs2 --enable-libxvid --enable-libzimg --enable-libzvbi --extra-cflags=-DLIBTWOLAME_STATIC --extra-cxxflags= --extra-ldflags=-pthread --extra-ldexeflags= --extra-libs=-lgomp --extra-version=20231001
  libavutil      58. 27.100 / 58. 27.100
  libavcodec     60. 27.100 / 60. 27.100
  libavformat    60. 13.100 / 60. 13.100
  libavdevice    60.  2.101 / 60.  2.101
  libavfilter     9. 11.100 /  9. 11.100
  libswscale      7.  4.100 /  7.  4.100
  libswresample   4. 11.100 /  4. 11.100
  libpostproc    57.  2.100 / 57.  2.100
-vsync is deprecated. Use -fps_mode
[concat @ 00000228ddb53840] Impossible to open 'file:temp\ScreenToGif\Recording\2023-09-30 23-48-03\Encode 2023-10-01 07-06-00-89\temp\ScreenToGif\Recording\2023-09-30 23-48-03\Encode 2023-10-01 07-06-00-89\0.png'
[in#0 @ 00000228ddb532c0] Error opening input: No such file or directory
Error opening input file file:temp\ScreenToGif\Recording\2023-09-30 23-48-03\Encode 2023-10-01 07-06-00-89\concat.txt.
Error opening input files: No such file or directory

Desktop:

  • OS: Windows 10
  • Version 22H2

Additional context
Can successfully encode other formats without any known problems, so this issue seems specific to feeding ffmpeg correct path parameters

@MaverickLoneshark MaverickLoneshark added ⬜ Pending Status • This issue stills needs to be analyzed. 🔷 Bug 🐛 Type • An undesired situation happens. labels Oct 1, 2023
@pawlos
Copy link
Contributor

pawlos commented Oct 6, 2023

I could not repro this on my version (latest release 2.39 and build from source), but this line of ffmpeg output looks interesting

[concat @ 00000228ddb53840] Impossible to open 'file:temp\ScreenToGif\Recording\2023-09-30 23-48-03\Encode 2023-10-01 07-06-00-89\temp\ScreenToGif\Recording\2023-09-30 23-48-03\Encode 2023-10-01 07-06-00-89\0.png'

For some reason it looks like the path is duplicated. Also, when I test this, I have a full path to a file and here it's only a relative one.

@MaverickLoneshark
Copy link
Author

MaverickLoneshark commented Oct 7, 2023

Neither full path nor relative path seem to work for me.

I could not repro this on my version (latest release 2.39 and build from source)

   at ScreenToGif.Util.EncodingManager.EncodeWithFfmpeg(ExportPreset preset, List`1 listFrames, Int32 id, CancellationTokenSource tokenSource, String processing) in C:\Users\[redacted]\source\ScreenToGif\ScreenToGif\Util\EncodingManager.cs:line 1774
   at ScreenToGif.Util.EncodingManager.Encode(ExportProject project, ExportPreset preset, Int32 id, CancellationTokenSource tokenSource) in C:\Users\[redacted]\source\ScreenToGif\ScreenToGif\Util\EncodingManager.cs:line 1038

So I'm pretty sure I shouldn't have those first lines in my error messages (after all, my username isn't [redacted])...
Have you tried installing on a different machine?

@NickeManarin
Copy link
Owner

So I'm pretty sure I shouldn't have those first lines in my error messages (after all, my username isn't nicke)... Have you tried installing on a different machine?

That's just the path saved along with debug symbols. It's from my setup.

@NickeManarin
Copy link
Owner

NickeManarin commented Oct 8, 2023

What's in your cache path? The default should be %temp% or to be safe %UserProfile%\AppData\Local\Temp.

If your environment variable %temp% is set to anything other than the default value, it may result what you are experiencing now.

@MaverickLoneshark
Copy link
Author

image

Interesting, it was using a relative temp folder.
I was able to properly encode a mpeg-4 after switching to %temp%.

Problem solved!
(though it would probably be best to hide your personal build configuration paths from the error output for security reasons...)

@MaverickLoneshark
Copy link
Author

MaverickLoneshark commented Oct 9, 2023

Accidentally closed instead of just commented, my bad.
Up to you to decide, after all.

By the way, is there any chance of working in a feature request for a dark mode skin for ScreenToGif?
The bright white contrast is kind of hard on my primarily dark theme accustomed eyes.

Thank you for your swift response!
(I was expecting to hear back from you after another two weeks or something)

@pawlos
Copy link
Contributor

pawlos commented Oct 9, 2023

Relative path does the trick of producing an error. Maybe the fix could be that if the relative path is entered, it could be resolved to a full one on Save? I can see some code that might does do that (AdjustPath calls) so maybe it's not covering all cases in this scenario (manually entered path)?

@MaverickLoneshark
Copy link
Author

MaverickLoneshark commented Oct 9, 2023

Well, that's certainly an idea, but couldn't the relative paths work by invoking the encoder from the ScreenToGif directory as the working directory or something?

Actually this might be a bit more convoluted than I first thought...
https://superuser.com/a/943258

@pawlos
Copy link
Contributor

pawlos commented Oct 9, 2023

Well, that's certainly an idea, but couldn't the relative paths work by invoking the encoder from the ScreenToGif directory as the working directory or something?

Actually this might be a bit more convoluted than I first thought... https://superuser.com/a/943258

I'll check that one. Thanks for the link.

@pawlos
Copy link
Contributor

pawlos commented Oct 15, 2023

yeah, setting the relative paths, even with the working directory is set doesn't seems to be helping ffmpeg :(

@shiqianwei0508
Copy link

image

Interesting, it was using a relative temp folder. I was able to properly encode a mpeg-4 after switching to %temp%.

Problem solved! (though it would probably be best to hide your personal build configuration paths from the error output for security reasons...)

thanks! You are genius !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🔷 Bug 🐛 Type • An undesired situation happens. ⬜ Pending Status • This issue stills needs to be analyzed.
Projects
None yet
Development

No branches or pull requests

4 participants