Comments (7)
from jaffree.
@tarikkilic when constructing filter you have to specify filter name, but you specify concat
as argument.
Try to use setName
method:
Filter.fromInputLink(String.valueOf(outIndex-2)).
addInputLink(String.valueOf(outIndex-1)).
setName("concat").
addOutputLink(String.valueOf(outIndex++))
Also note the difference bnetween FilterChain and Filter:
[0:v]trim=start=0:end=5,setpts=PTS-STARTPTS[0];
is a filter chain which contains 2 filters: trim
and setpts. So you have to do something like the following:
filterChain
.addFilter(
Filter.fromInputLink(StreamSpecifier.withInputIndexAndType(0,StreamType.VIDEO)).
setName("trim").
addArgument("start",start.toString()).
addArgument("end",end.toString())
)
.addFilter(
Filter.withName("setpts").
addArgument("PTS-STARTPTS").
addOutputLink(String.valueOf(outIndex++))
);
from jaffree.
Thank you very much. This problem solved. And last question : Jaffre constructed command like this:
but throw exception:
I copied command from first screenshoot and paste terminal, ffmpeg works but throw exception in java program. I didn't understand.
from jaffree.
To get detailed message you need to enable trace logs for Jaffree. Paste logs here if you need more help.
from jaffree.
Is that what you meant? and my ffmpeg code:
FFmpegResult result = FFmpeg.atPath(ffmpegBin) .addInput(UrlInput.fromPath(input)) .setOverwriteOutput(true) .addArgument("-filter_complex") .addArgument("\'") .addArgument(command) .addArgument("\'") .addArgument("-map") .addArgument("[" + out + "]") .addOutput(UrlOutput.toPath(output)) .execute();
2019-08-27 17:56:51,402 INFO com.github.kokorin.jaffree.process.ProcessHandler [Thread-4] Command constructed:
/root/bin/ffmpeg -i /var/www/contents/rawVideo/30_Rambo.mp4 -y -filter_complex ' [0:v]trim=start=0.0:end=45.0,setpts=PTS-STARTPTS[0];[0:v]trim=start=55.0:end=15.0,setpts=PTS-STARTPTS[1];[0][1]concat[2];[0:v]trim=start=40.0:end=2.0,setpts=PTS-STARTPTS[3];[2][3]concat[4] ' -map [4] /var/www/contents/trimmedVideo/trimmed_30_Rambo.mp4
2019-08-27 17:56:51,402 INFO com.github.kokorin.jaffree.process.ProcessHandler [Thread-4] Starting process: /root/bin/ffmpeg
2019-08-27 17:56:51,403 DEBUG com.github.kokorin.jaffree.process.ProcessHandler [Thread-4] Waiting for Process output
2019-08-27 17:56:51,403 TRACE com.github.kokorin.jaffree.process.ProcessHandler [Thread-4] Process has no output yet, will sleep
2019-08-27 17:56:51,504 DEBUG com.github.kokorin.jaffree.process.ProcessHandler [Thread-4] Starting IO interaction with process
2019-08-27 17:56:51,504 INFO com.github.kokorin.jaffree.process.ProcessHandler [Thread-4] Waiting for process to finish
2019-08-27 17:56:51,505 DEBUG com.github.kokorin.jaffree.process.ProcessHandler [Thread-4] Waiting for Executor to stop
2019-08-27 17:56:51,505 TRACE com.github.kokorin.jaffree.process.ProcessHandler [Thread-4] Executor hasn't yet stopped, will sleep
2019-08-27 17:56:51,505 DEBUG com.github.kokorin.jaffree.process.Executor [StdErr] StdErr thread has started
2019-08-27 17:56:51,505 DEBUG com.github.kokorin.jaffree.process.Executor [StdOut] StdOut thread has started
2019-08-27 17:56:51,505 DEBUG com.github.kokorin.jaffree.process.Executor [StdOut] StdOut thread has finished
2019-08-27 17:56:51,505 DEBUG com.github.kokorin.jaffree.ffmpeg.FFmpegResultReader [StdErr] ffmpeg version N-94303-g7cb4f8c Copyright (c) 2000-2019 the FFmpeg developers
2019-08-27 17:56:51,506 DEBUG com.github.kokorin.jaffree.ffmpeg.FFmpegResultReader [StdErr] built with gcc 4.8.5 (GCC) 20150623 (Red Hat 4.8.5-36)
2019-08-27 17:56:51,506 DEBUG com.github.kokorin.jaffree.ffmpeg.FFmpegResultReader [StdErr] configuration: --prefix=/root/ffmpeg_build --pkg-config-flags=--static --extra-cflags=-I/root/ffmpeg_build/include --extra-ldflags=-L/root/ffmpeg_build/lib --extra-libs=-lpthread --extra-libs=-lm --bindir=/root/bin --enable-libvmaf --enable-version3 --enable-gpl --enable-libfdk_aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libvpx --enable-libx264 --enable-libx265 --enable-nonfree
2019-08-27 17:56:51,506 DEBUG com.github.kokorin.jaffree.ffmpeg.FFmpegResultReader [StdErr] libavutil 56. 30.100 / 56. 30.100
2019-08-27 17:56:51,506 DEBUG com.github.kokorin.jaffree.ffmpeg.FFmpegResultReader [StdErr] libavcodec 58. 53.101 / 58. 53.101
2019-08-27 17:56:51,507 DEBUG com.github.kokorin.jaffree.ffmpeg.FFmpegResultReader [StdErr] libavformat 58. 28.102 / 58. 28.102
2019-08-27 17:56:51,507 DEBUG com.github.kokorin.jaffree.ffmpeg.FFmpegResultReader [StdErr] libavdevice 58. 7.100 / 58. 7.100
2019-08-27 17:56:51,507 DEBUG com.github.kokorin.jaffree.ffmpeg.FFmpegResultReader [StdErr] libavfilter 7. 56.101 / 7. 56.101
2019-08-27 17:56:51,507 DEBUG com.github.kokorin.jaffree.ffmpeg.FFmpegResultReader [StdErr] libswscale 5. 4.101 / 5. 4.101
2019-08-27 17:56:51,507 DEBUG com.github.kokorin.jaffree.ffmpeg.FFmpegResultReader [StdErr] libswresample 3. 4.100 / 3. 4.100
2019-08-27 17:56:51,508 DEBUG com.github.kokorin.jaffree.ffmpeg.FFmpegResultReader [StdErr] libpostproc 55. 4.100 / 55. 4.100
2019-08-27 17:56:51,508 DEBUG com.github.kokorin.jaffree.ffmpeg.FFmpegResultReader [StdErr] Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/var/www/contents/rawVideo/30_Rambo.mp4':
2019-08-27 17:56:51,508 DEBUG com.github.kokorin.jaffree.ffmpeg.FFmpegResultReader [StdErr] Metadata:
2019-08-27 17:56:51,508 DEBUG com.github.kokorin.jaffree.ffmpeg.FFmpegResultReader [StdErr] major_brand : isom
2019-08-27 17:56:51,508 DEBUG com.github.kokorin.jaffree.ffmpeg.FFmpegResultReader [StdErr] minor_version : 512
2019-08-27 17:56:51,508 DEBUG com.github.kokorin.jaffree.ffmpeg.FFmpegResultReader [StdErr] compatible_brands: isomiso2avc1mp41
2019-08-27 17:56:51,508 DEBUG com.github.kokorin.jaffree.ffmpeg.FFmpegResultReader [StdErr] title : Rambo: Last Blood - Theatrical Trailer
2019-08-27 17:56:51,508 DEBUG com.github.kokorin.jaffree.ffmpeg.FFmpegResultReader [StdErr] artist : Lionsgate
2019-08-27 17:56:51,509 DEBUG com.github.kokorin.jaffree.ffmpeg.FFmpegResultReader [StdErr] date : 2019
2019-08-27 17:56:51,509 DEBUG com.github.kokorin.jaffree.ffmpeg.FFmpegResultReader [StdErr] encoder : Lavf58.28.102
2019-08-27 17:56:51,509 DEBUG com.github.kokorin.jaffree.ffmpeg.FFmpegResultReader [StdErr] genre : Trailer
2019-08-27 17:56:51,509 DEBUG com.github.kokorin.jaffree.ffmpeg.FFmpegResultReader [StdErr] Duration: 00:00:30.03, start: 0.000000, bitrate: 12767 kb/s
2019-08-27 17:56:51,509 DEBUG com.github.kokorin.jaffree.ffmpeg.FFmpegResultReader [StdErr] Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1920x802 [SAR 1:1 DAR 960:401], 12633 kb/s, 23.98 fps, 23.98 tbr, 24k tbn, 47.95 tbc (default)
2019-08-27 17:56:51,509 DEBUG com.github.kokorin.jaffree.ffmpeg.FFmpegResultReader [StdErr] Metadata:
2019-08-27 17:56:51,509 DEBUG com.github.kokorin.jaffree.ffmpeg.FFmpegResultReader [StdErr] handler_name : VideoHandler
2019-08-27 17:56:51,509 DEBUG com.github.kokorin.jaffree.ffmpeg.FFmpegResultReader [StdErr] Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 128 kb/s (default)
2019-08-27 17:56:51,509 DEBUG com.github.kokorin.jaffree.ffmpeg.FFmpegResultReader [StdErr] Metadata:
2019-08-27 17:56:51,509 DEBUG com.github.kokorin.jaffree.ffmpeg.FFmpegResultReader [StdErr] handler_name : SoundHandler
2019-08-27 17:56:51,510 DEBUG com.github.kokorin.jaffree.ffmpeg.FFmpegResultReader [StdErr] [AVFilterGraph @ 0x3e6da00] No such filter: ''
2019-08-27 17:56:51,510 DEBUG com.github.kokorin.jaffree.ffmpeg.FFmpegResultReader [StdErr] Error initializing complex filters.
2019-08-27 17:56:51,510 DEBUG com.github.kokorin.jaffree.ffmpeg.FFmpegResultReader [StdErr] Invalid argument
2019-08-27 17:56:51,516 DEBUG com.github.kokorin.jaffree.process.Executor [StdErr] Exception: StdErr, collecting for later report
java.lang.RuntimeException: Invalid argument
at com.github.kokorin.jaffree.ffmpeg.FFmpegResultReader.read(FFmpegResultReader.java:91)
at com.github.kokorin.jaffree.ffmpeg.FFmpegResultReader.read(FFmpegResultReader.java:32)
at com.github.kokorin.jaffree.process.ProcessHandler$2.run(ProcessHandler.java:171)
at com.github.kokorin.jaffree.process.Executor$1.run(Executor.java:66)
at java.lang.Thread.run(Thread.java:748)
2019-08-27 17:56:51,516 DEBUG com.github.kokorin.jaffree.process.Executor [StdErr] StdErr thread has finished
2019-08-27 17:56:51,517 WARN com.github.kokorin.jaffree.process.ProcessHandler [Thread-4] Waiting for process has been interrupted
java.lang.InterruptedException: sleep interrupted
at java.lang.Thread.sleep(Native Method)
at com.github.kokorin.jaffree.process.ProcessHandler.waitForExecutorToStop(ProcessHandler.java:281)
at com.github.kokorin.jaffree.process.ProcessHandler.interactWithProcess(ProcessHandler.java:114)
at com.github.kokorin.jaffree.process.ProcessHandler.execute(ProcessHandler.java:85)
at com.github.kokorin.jaffree.ffmpeg.FFmpeg.execute(FFmpeg.java:161)
at com.atlas.videolab.ffmpeg.FfmpegFilter.trimVideo(FfmpegFilter.java:100)
at com.atlas.videolab.flowprocess.Orchestration.lambda$flowProcess$0(Orchestration.java:99)
at java.lang.Thread.run(Thread.java:748)
2019-08-27 17:56:51,517 DEBUG com.github.kokorin.jaffree.process.Executor [Thread-4] Stopping execution
2019-08-27 17:56:51,517 WARN com.github.kokorin.jaffree.process.Executor [Thread-4] Interrupting ALIVE thread: StdErr
2019-08-27 17:56:51,517 WARN com.github.kokorin.jaffree.process.Executor [Thread-4] Interrupting ALIVE thread: StdOut
from jaffree.
Yes, the error message is the following:
[AVFilterGraph @ 0x3e6da00] No such filter: ''
Error initializing complex filters.
Invalid argument
With Java process executor you don't need to escape or quot arguments. Probably you can't escape or quot. So just remove .addArgument("\'")
from jaffree.
Problem Solved! Thanks a lot. But If I write ffmpeg in command-line, I must put quotationmarks to filter. But with Java process executor, I don't put quotation marks and works ffmpeg. I'm confused. Issue can be closed. Again thanks.
from jaffree.
Related Issues (20)
- use the example: Cut and scale media file, but it doesn't work HOT 8
- How do you get the error message returned by FFmpeg? HOT 4
- Global option doesn't work HOT 2
- Streaming last for only 3 to 6 seconds HOT 17
- Process quit silently in windows server 2019 HOT 3
- FFMpeg process takes 10sec to start the stream HOT 4
- Add HLS re-streaming example of live stream HOT 1
- Converting H264 Bytestream to ISMV HOT 1
- Cannot get formed FFMPEG cli command as string HOT 2
- How to use Jaffree with Spring Boot for streaming a RTSP ? HOT 7
- Draw BufferedImage(ARGB) on video frames? HOT 7
- how to concat video.
- DemuxerInput.java not found HOT 1
- Connection refused error With OutputStream and WebSocket HOT 2
- ProcessHandler will terminate execution prematurely if a FrameConsumer is too slow HOT 12
- MacOS builds fail on FFmpegTest.testSizeLimit() HOT 2
- Process execution has ended with non-zero status: -1073741819 HOT 1
- How to perform screen recorder using this library? HOT 6
- Expose the `pid` to be able to kill the process manually. HOT 13
- TCP negotiation failed HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jaffree.