-
Notifications
You must be signed in to change notification settings - Fork 84
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
Checking ffmpeg availability and version #94
Comments
No, atPath() just falls back to PATH env variable. You see an error
indicating absence of ffmpeg.
сб, 8 авг. 2020 г., 16:44 Vicne <[email protected]>:
… Progress with Jaffree goes very well :-) and the first version with video
capture should be available soon. I'm now trying to make my software more
robust by testing ffmpeg availability at startup.
Instead of browsing the path variable or calling "which ffmpeg"
(platform-dependant), plus executable bit etc., I thought it was simpler to
just try and execute ffmpeg, and analyse the result to determine if it was
available and executable.
The simplest way I can think of is:
FFmpeg.atPath().addArgument("-version").execute();
Plus, parsing the result would allow checking the version is sufficiently
recent.
However, executing the above line throws a RuntimeException which says:
"Process execution has ended with null result"
Do I absolutely need to pass fake input and output params to satisfy
Jaffree or is there a way to just invoke ffmpeg without any actual work to
do ?
(Of course, I could launch my own java.util.Process, but that kind of
defeats the idea of a layer between the developer and ffmpeg :-) )
KR. Vicne
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#94>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAIJ47BJNKYAKXQURIS76YLR7VJB7ANCNFSM4PYVIILQ>
.
|
Indeed,
While if ffmpeg is not found on the path, it causes a
In other words, no matter if ffmpeg is found or not, Jaffree throws a RuntimeException. Here is a sample test;
I also tried making a transcode from a dummy input to NullOutput, but the "testsrc" dummy input filter does not seem to be available, so here is what I ended up with:
I think it's a bit overkill (and ugly) just to check if ffmpeg is available. Can you think of another way ? |
Now I see. You are right, there is no possibility to read ffmpeg version
currently. Probably Jaffree should not throw an exception if ffmpeg
provided no encoding result.
вс, 9 авг. 2020 г., 02:04 Vicne <[email protected]>:
… Indeed, atPath() falls back to PATH, but then executing a simple ffmpeg
-version (with no input and no output involved) causes a
INFO: Process has finished with status: 0
Exception in thread "main" java.lang.RuntimeException: Process execution has ended with null result
at com.github.kokorin.jaffree.process.ProcessHandler.interactWithProcess(ProcessHandler.java:151)
at com.github.kokorin.jaffree.process.ProcessHandler.execute(ProcessHandler.java:94)
at com.github.kokorin.jaffree.ffmpeg.FFmpeg.execute(FFmpeg.java:219)
at jaffree.JaffreeTest.main(JaffreeTest.java:7)
While if ffmpeg is not found on the path, it causes a
INFO: Starting process: ffmpeg
Exception in thread "main" java.lang.RuntimeException: Failed to start process.
at com.github.kokorin.jaffree.process.ProcessHandler.execute(ProcessHandler.java:96)
at com.github.kokorin.jaffree.ffmpeg.FFmpeg.execute(FFmpeg.java:219)
at jaffree.JaffreeTest.main(JaffreeTest.java:7)
In other words, no matter if ffmpeg is found or not, Jaffree throws a
RuntimeException.
Here is a sample test;
import com.github.kokorin.jaffree.ffmpeg.FFmpeg;
public class JaffreeTest {
public static void main(String[] args) {
FFmpeg.atPath().addArgument("-version").execute();
}
}
I also tried making a transcode from a dummy input to NullOutput, but the
"testsrc" dummy input filter does not seem to be available, wo here is what
I ended up with:
public class JaffreeTest {
public static void main(String[] args) {
FFmpeg.atPath().addArguments("-f", "lavfi").addArguments("-i", "testsrc=duration=1:size=300x200:rate=10").addOutput(new NullOutput()).execute();
}
}
I think it's a bit overkill (and ugly) just to check if ffmpeg is
available. Do you think of another way ?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#94 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAIJ47H3FUN54OLDU4WWV7LR7XKXFANCNFSM4PYVIILQ>
.
|
In the end, I worked around the issue with a simple "Process" call, so no emergency for me, but I think it would make sense, yes. Or maybe throw a subclass of RuntimeException, like a FFmpegNotFoundException or something, so that it can be caught specifically. |
Progress with Jaffree goes very well :-) and the first version with video capture should be available soon. I'm now trying to make my software more robust by testing ffmpeg availability at startup.
Instead of browsing the path variable or calling "which ffmpeg" (platform-dependant), plus executable bit etc., I thought it was simpler to just try and execute ffmpeg, and analyse the result to determine if it was available and executable.
The simplest way I can think of is:
Plus, parsing the result would allow checking the version is sufficiently recent.
However, executing the above line throws a
RuntimeException
which says:"Process execution has ended with null result"
Do I absolutely need to pass fake input and output params to satisfy Jaffree or is there a way to just invoke ffmpeg without any actual work to do ?
(Of course, I could launch my own java.util.Process, but that kind of defeats the idea of a layer between the developer and ffmpeg :-) )
KR. Vicne
The text was updated successfully, but these errors were encountered: