zakgof / velvet-video

Java library for encoding / decoding / muxing / demuxing video and audio in various formats
Other
47 stars 9 forks source link

don't apply audio filter on mp3 file #32

Open gsolana81 opened 3 years ago

gsolana81 commented 3 years ago

don't work audio filter. example apply fade in and fade out

File src = new File("path");
`IVelvetVideoLib lib = VelvetVideoLib.getInstance();
IAudioDecoderStream audioStream = lib.demuxer(src).audioStreams().get(0);
AudioFormat format = audioStream.properties().format();

File output = new File(src.getParent(),filename);
IMuxerBuilder muxerBuilder = lib.muxer("mp3");

IAudioEncoderBuilder audioEncoderBuilder = lib.audioEncoder("libmp3lame", format).enableExperimental()
.filter("afade=t=in:st=0:d=15,afade=t=out:st=63:d=15");

IMuxer muxer = muxerBuilder.audioEncoder(audioEncoderBuilder).build(output);

IAudioEncoderStream audioEncoder = muxer.audioEncoder(0);

for (IAudioFrame audioFrame : audioStream) {
audioEncoder.encode(audioFrame.samples());
}`