
So above two solutions have not been fruitful and currently, I am downloading the whole file and trimming it locally, which is definitely a bad UX. ffmpeg-android does not support network requests module (at least the way we complied).as startTime increases, the size of downloaded bytes are closer to the actual size of the mp3.How to crop a mp3 from x to x+n using ffmpeg?įFMPEG_SS - This works flawlessly with remote URLs as input, but there are two downsides, But the output is not accurate (± 1.5 secs * c) where c is proportional to startTime RANGE_REQUEST - I have replicated the exact same algorithm/formula in Kotlin using the exact sample file provided. Then download ONLY the 15 second part and add it to the video's audio stream.User can select any 15 seconds (ExoPlayer-streaming) of an mp3 (considering 192Kbps/44.1KHz of 3mins = up to 7MB).All transcoding merging part will be done by FFmpeg-android so that's not the concern right now. My use case is roughly equal to, adding a 15-second mp3 file to a ~1 min video.

Rotation = m.extractMetadata(MediaMetadataRetriever.METADATA_KEY_VIDEO_ROTATION) įfmpeg -noautorotate -i input.mp4 -filter:v "rotation*PI/180" output.mp4 MediaMetadataRetriever m = new MediaMetadataRetriever()

Val command = arrayOf("ffmpeg","-i", inFile.absolutePath ,"-y","-filter:v", "crop=100:100:0:0", outFile.absolutePath)įfmpeg -noautorotate -i input.mp4 output.mp4 Val outFile = File(getExternalFilesDir(null)?.absolutePath, "result.mp4") Val outFile = getExternalFilesDir(null)?.absolutePath, "result.mp4" Val inFile = File(getExternalFilesDir(null)?.absolutePath ,"videoToBeEdit.mp4")
