-
Notifications
You must be signed in to change notification settings - Fork 80
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
ffmpeg stuck when using Channels to extract image close to the end of a video #233
Comments
Check the log: it says:
In the code snippet there is no Also by the following line:
I can say that you use Please double check the code in question. If that doesn't help, please, provide minimal project (zip, only source files) which reproduces the issue. |
Sorry, I tested with ChannelOutput, OutputStream and output to File. I accidently pasted the wrong Log for OutputStream. But the problem appear with all 3 output types. You can reproduce it. Input file: https://file-examples-com.github.io/uploads/2020/03/file_example_WEBM_480_900KB.webm Code using only Channels. For position 30000 ffmpeg freezes. Position 29500 works fine.
|
Please provide full code sample to reproduce the issue if you do need help. Notice that Earth stops spinning in provided video exactly at 30th second and hangs for the rest of video. |
Below is the full example. The problem is, ffmpeg gets stuck forever where it should throw an Exception and return control to the calling thread. This should not happen even if you enter a position value that is bigger then the duration of the video. |
Thank you, check #235 PR, I found that FTP implementation sometimes doesn't respond with a code expected by ffmpeg. I'm not sure yet why it fails not every time. Thank you for the issue! |
The fix is in develop branch. You could build and use it. I will release ASAP. |
Thanks. I am not in a rush since I don't need the functionality at the moment. I was just thoroughly testing your project and submitted a few issues. Great project btw. :) |
Is the release name '0' normal? |
No
…On Tue, 19 Oct 2021 at 09:45, shoeoffhead ***@***.***> wrote:
Is the release name '0' normal?
https://github.com/kokorin/Jaffree/releases
—
You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub
<#233 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAIJ47EPD7LZRXE2FSFTKATUHUHX5ANCNFSM5FYRW3WQ>
.
|
I don't know if I should open a different Issue since the problem is Channel based. Here is a link to a working example (including video input) showing the problem: https://drive.google.com/file/d/1HLxhxyA7DDiegQUjrVUVD-s1bQgDhukj/view?usp=sharing Writing images with Channels doesn't work for certain container formats. MKV works but TS and TP does not. Writing images without channels works perfectly for TS and TP. You have to edit the filename from input.mkv to input.ts in the .java file to see the problem with Channels. |
@shoeoffhead I have no access to the file you shared. Please upload it here. |
The file is too big to upload. But I fixed the download problem. This should work: https://drive.google.com/file/d/1HLxhxyA7DDiegQUjrVUVD-s1bQgDhukj/view?usp=sharing |
@shoeoffhead It looks like problem is related to ChannelInput and TS file. FFmpeg can't seek TS (no syncpoints?), and has to read input file from the beginning looking for required start position. |
Fixed, check latest release |
Works :) |
@shoeoffhead it's very interesting to me how do you use Jaffree? Especially how do you use ChannelInput/Output? |
This problem is when using Channels.
I used this video file as input: https://file-examples-com.github.io/uploads/2020/03/file_example_WEBM_480_900KB.webm
The video has a length of 30540 milliseconds.
If I extract an image at 30.000 milliseconds on the console it works: /mnt/Data/software/ffmpeg-4.4-amd64-static/ffmpeg -loglevel level+info -ss 30.000 -i /mnt/Data/downloads/webm/file_example_WEBM_480_900KB.webm -y -frames:v 1 -q:v 1 -f image2 /mnt/Data/downloads/data.jpeg
When I try to repeat this in Jaffree, ffmpeg gets stuck and is never interrupted (see log below). I guess Channels are not the harddisk so there are small differences. No problem. Writing out at position 29500 works. However it is somewhat of a problem, that ffmpeg gets stuck and doesn't throw an Exception. On the console ffmpeg never "freezes" even if you get close or over the video length. It just returns with an error: [warning] Output file is empty, nothing was encoded (check -ss / -t / -frames parameters if used)
try (SeekableByteChannel inputChannel = Files.newByteChannel(pathToSrc, StandardOpenOption.READ); SeekableByteChannel outputChannel = Files.newByteChannel(pathToDst, StandardOpenOption.CREATE, StandardOpenOption.WRITE, StandardOpenOption.READ, StandardOpenOption.TRUNCATE_EXISTING) ) { FFmpeg.atPath() .addInput(ChannelInput.fromChannel(inputChannel).setPosition(30000)) .setOverwriteOutput(true) .addArguments("-frames:v", "1") .addArguments("-q:v", "1") .addOutput(ChannelOutput.toChannel(filename, outputChannel).setFormat("image2")) .execute(); }
The text was updated successfully, but these errors were encountered: