Open sarvesh opened 6 years ago
The setInput(in).setFormat("mp3")
line is forcing the input to be read as MP3. Move the setFormat after the addOutput.
Also you must likely don't need the setAudioCodec("aac") line, that would be seeing a different audio codec (and not using MP3).
I made the changes as suggested. But now ffProbe is failing with the below exception
And the sample code
FFmpeg ffmpeg = new FFmpeg("C:\\Users\\snallami\\Downloads\\ffmpeg-20180824-d0b48a9-win64-static\\bin\\ffmpeg.exe");
FFprobe ffprobe = new FFprobe("C:\\Users\\snallami\\Downloads\\ffmpeg-20180824-d0b48a9-win64-static\\bin\\ffprobe.exe");
FFmpegProbeResult in = ffprobe.probe("C:\\atmospace_jungle.wav"); //The audio file size 912KB. So i want the generated mp3 file should be half the size. Therefore the size is defined as size=500000(500KB)
long size = 500000L;
FFmpegBuilder builder = new FFmpegBuilder().setInput(in).addOutput("audio.mp3").setFormat("mp3").setTargetSize(size)
.setAudioChannels(1)
.setAudioSampleRate(48000)
.setAudioBitRate(32768)
.setStrict(FFmpegBuilder.Strict.EXPERIMENTAL)
.done();
FFmpegExecutor executor = new FFmpegExecutor(ffmpeg, ffprobe);
executor.createJob(builder).run();
Hi All, Thanks for the great snippet. I really liked it. This is exactly what am looking for. But however am facing the issues with conversion from .wav to .mp3 Please find below the code snippet am using to convert
To Reproduce
Expected behavior A clear and concise description of what you expected to happen.
Version (if applicable):
Additional context Add any other context about the problem here.