All Projects → umair13adil → Kotlinffmpeg

umair13adil / Kotlinffmpeg

Licence: gpl-3.0
Examples of using FFMpeg library on Android with Kotlin

Programming Languages

kotlin
9241 projects

Projects that are alternatives of or similar to Kotlinffmpeg

Jvedio
Windows desktop application to manage local video;Support baidu AI, youdao translation;Support FFMPEG video processing;Support multi-database management and statistics;Support skin switching
Stars: ✭ 545 (+294.93%)
Mutual labels:  ffmpeg, gif
Android Video Trimmer
Android-Video-Trimmer项目实现了对长短视频进行片段的裁剪选择。使用MediaMetadataRetriever获取视频帧,采用ffmpeg进行视频裁剪,和视频压缩。
Stars: ✭ 824 (+497.1%)
Mutual labels:  ffmpeg, ffmpeg-android
Ffmpeg Android
FFMpeg/FFprobe compiled for Android
Stars: ✭ 592 (+328.99%)
Mutual labels:  ffmpeg, ffmpeg-android
Gifgen
Simple high quality GIF encoding
Stars: ✭ 397 (+187.68%)
Mutual labels:  ffmpeg, gif
Node Sorry
生成表情gif
Stars: ✭ 90 (-34.78%)
Mutual labels:  ffmpeg, gif
Ffmpeg Video Editor Android
Sample android project using ffmpeg for cutting and compressing video,reversing video,extracting image frames from video,extracting audio from video,add fade in fade out effect,create fast and slow motion video
Stars: ✭ 414 (+200%)
Mutual labels:  ffmpeg, ffmpeg-android
Gifify
😻 Convert any video file to an optimized animated GIF.
Stars: ✭ 5,792 (+4097.1%)
Mutual labels:  ffmpeg, gif
MovieBarCodeGenerator
User friendly tool to create your own movie barcodes
Stars: ✭ 57 (-58.7%)
Mutual labels:  movie, ffmpeg
Namava Downloader
Download movies from `namava.ir` website. | لینک جایگزین جهت احتیاط: https://gitlab.com/NabiKAZ/namava-downloader
Stars: ✭ 89 (-35.51%)
Mutual labels:  ffmpeg, movie
Ffmpegandroidlibrary
One line integration for FFMPEG Library in Android
Stars: ✭ 88 (-36.23%)
Mutual labels:  ffmpeg, ffmpeg-android
Ffmpegcommand
FFmpegCommand适用于Android的FFmpeg命令库,实现了对音视频相关的处理,能够快速的处理音视频,大概功能包括:音视频剪切,音视频转码,音视频解码原始数据,音视频编码,视频转图片或gif,视频添加水印,多画面拼接,音频混音,视频亮度和对比度,音频淡入和淡出效果等
Stars: ✭ 394 (+185.51%)
Mutual labels:  ffmpeg, gif
Gifserver
A server for transcoding gif to video on the fly
Stars: ✭ 100 (-27.54%)
Mutual labels:  ffmpeg, gif
Ffmpeg Android Java
FFmpeg Android java is a java library that simplifies your task of using ffmpeg in Android project which I've compiled using FFmpeg-Android
Stars: ✭ 3,098 (+2144.93%)
Mutual labels:  ffmpeg, ffmpeg-android
Ffmpegandroid
最新版ffmpeg3.3-android,并通过CMake方式移植到Android中,并实现编解码,转码,推拉流,滤镜等各种功能
Stars: ✭ 526 (+281.16%)
Mutual labels:  ffmpeg, ffmpeg-android
Rxffmpeg
🔥💥RxFFmpeg 是基于 ( FFmpeg 4.0 + X264 + mp3lame + fdk-aac + opencore-amr + openssl ) 编译的适用于 Android 平台的音视频编辑、视频剪辑的快速处理框架,包含以下功能:视频拼接,转码,压缩,裁剪,片头片尾,分离音视频,变速,添加静态贴纸和gif动态贴纸,添加字幕,添加滤镜,添加背景音乐,加速减速视频,倒放音视频,音频裁剪,变声,混音,图片合成视频,视频解码图片,抖音首页,视频播放器及支持 OpenSSL https 等主流特色功能
Stars: ✭ 3,358 (+2333.33%)
Mutual labels:  ffmpeg, ffmpeg-android
Quick Media
media(audio/image/qrcode/markdown/html/svg) support web service (多媒体编辑服务, 酷炫二维码, 音频, 图片, svg, markdown, html渲染服务支持)
Stars: ✭ 612 (+343.48%)
Mutual labels:  ffmpeg, gif
kepler orrery
Make a Kepler orrery gif or movie of all the Kepler multi-planet systems
Stars: ✭ 91 (-34.06%)
Mutual labels:  movie, gif
NaraeAudioRecorder
AudioRecorder for Android powered by Kotlin
Stars: ✭ 82 (-40.58%)
Mutual labels:  ffmpeg, ffmpeg-android
Bzijkplayer
基于cmake构建的ijkPlayer
Stars: ✭ 23 (-83.33%)
Mutual labels:  ffmpeg, ffmpeg-android
Vdx
🎞 An intuitive CLI for processing video, powered by FFmpeg
Stars: ✭ 1,356 (+882.61%)
Mutual labels:  ffmpeg, gif

Kotlin FFMpeg Tools Android Arsenal

Examples of using FFMpeg library on Android with Kotlin

For Video, Audio and Image/GIF operations.

App is pre loaded with audio, video, images, font resources which are useful for experimenting with FFmpeg library. You can add your resources as well, but keep extensions and make sure naming conventions are same as used in this project to avoid any I/OExceptions.

Each example will preview result in a dialog. Files are saved in local storage directory and can be directly accessed from there.

Image1 Image2

FFMpeg Examples (Video):

  1. Split a video in equal segments

    VideoSplitter.with(context!!)
                     .setFile(video) //Video File
                     .setOutputPath("PATH_TO_OUTPUT_VIDEO")
                     .setSegmentTime("00:00:15") //Split into 15 seconds segment
                     .setOutputFileName("splittedVideo")
                     .setCallback([email protected])
                     .split()
    
  2. Trim a video with specified timestamps

     VideoTrimmer.with(context!!)
                     .setFile(video) //Video File
                     .setStartTime("00:00:15") // Start from 15 seconds
                     .setEndTime("00:00:25") //End on 25 seconds
                     .setOutputPath("PATH_TO_OUTPUT_VIDEO")
                     .setOutputFileName("trimmed_" + System.currentTimeMillis() + ".mp4")
                     .setCallback([email protected])
                     .trim()
    
  3. Make a MP4 movie with provided images & audio in mp3

      MovieMaker.with(context!!)
                             .setAudio(audio2) //Audio File
                             .setOutputPath("PATH_TO_OUTPUT_VIDEO")
                             .setOutputFileName("movie_" + System.currentTimeMillis() + ".mp4")
                             .setCallback([email protected])
                             .convert()
    
  4. Resize a video in specified dimensions

     VideoResizer.with(context!!)
                             .setFile(video2) //Video File
                             .setSize("320:480") //320 X 480
                             .setOutputPath("PATH_TO_OUTPUT_VIDEO")
                             .setOutputFileName("resized_" + System.currentTimeMillis() + ".mp4")
                             .setCallback([email protected])
                             .resize()
    
  5. Add Text overlay on video with specified text attributes

     TextOnVideo.with(context!!)
                             .setFile(video2) //Video File
                             .setOutputPath("PATH_TO_OUTPUT_VIDEO")
                             .setOutputFileName("textOnVideo_" + System.currentTimeMillis() + ".mp4")
                             .setFont(font) //Font .ttf of text
                             .setText("Text Displayed on Video!!") //Text to be displayed
                             .setColor("#50b90e") //Color of Text
                             .setSize("34") //Size of text
                             .addBorder(true) //This will add background with border on text
                             .setPosition(TextOnVideo.POSITION_CENTER_BOTTOM) //Can be selected
                             .setCallback([email protected])
                             .draw()
    
  6. Merge an audio over video file

     AudioVideoMerger.with(context!!)
                             .setAudioFile(audio) //Audio File
                             .setVideoFile(video2) //Video File
                             .setOutputPath("PATH_TO_OUTPUT_VIDEO")
                             .setOutputFileName("merged_" + System.currentTimeMillis() + ".mp4")
                             .setCallback([email protected])
                             .merge()
    
  7. Merge/Concatenate multiple video files into single video file

     val videoList = arrayListOf<File>(videoSmall1, video, video2)
     
     VideoMerger.with(context!!)
                             .setVideoFiles(videoList) //Video Files list
                             .setOutputPath("PATH_TO_OUTPUT_VIDEO")
                             .setOutputFileName("merged_" + System.currentTimeMillis() + ".mp4")
                             .setCallback([email protected])
                             .merge()
    

FFMpeg Examples (Audio):

  1. Trim a audio with specified timestamps

     AudioTrimmer.with(context!!)
                             .setFile(audio2) //Audio File
                             .setStartTime("00:00:05") //Start at 5 seconds
                             .setEndTime("00:00:10") //End at 10 seconds
                             .setOutputPath("PATH_TO_OUTPUT_AUDIO")
                             .setOutputFileName("trimmed_" + System.currentTimeMillis() + ".mp3")
                             .setCallback([email protected])
                             .trim()
    
  2. Extract audio file from video file

     AudioExtractor.with(context!!)
                             .setFile(video2) //Video File
                             .setOutputPath("PATH_TO_OUTPUT_AUDIO")
                             .setOutputFileName("audio_" + System.currentTimeMillis() + ".mp3")
                             .setCallback([email protected])
                             .extract()
    
  3. Merge/Overlay two Audio files

     AudioMerger.with(context!!)
                            .setFile1(audio2)
                            .setFile2(audio3)
                            .setOutputPath(Utils.outputPath + "audio")
                            .setOutputFileName("merged_" + System.currentTimeMillis() + ".mp3")
                            .setCallback([email protected])
                            .merge()
    

FFMpeg Examples (Image):

  1. Convert video to GIF

     VideoToGIF.with(context!!)
                             .setFile(video) //Video File
                             .setOutputPath("PATH_TO_OUTPUT_IMAGE")
                             .setOutputFileName("myGif_" + System.currentTimeMillis() + ".gif")
                             .setDuration("5") //Gif duration
                             .setScale("500") //Size of GIF
                             .setFPS("10") //Frame rate of GIF
                             .setCallback([email protected])
                             .create()
    
  2. Convert video to images every 'n' time

     VideoToImages.with(context!!)
                             .setFile(video2) //Video File
                             .setOutputPath("PATH_TO_OUTPUT_IMAGE")
                             .setOutputFileName("images")
                             .setInterval("0.25") // Extract image every quarter of second (0.25)
                             .setCallback([email protected])
                             .extract()
    

CallBacks:

You can implement callbacks of all tools using: FFMpegCallback. Just implement this in your Activity or Fragment.

It supports following callbacks:

        override fun onProgress(progress: String) {
            Log.i(TAG, "Running: $progress")
        }
    
        override fun onSuccess(convertedFile: File, type: String) {
            Toast.makeText(this, "Done!", Toast.LENGTH_SHORT).show()
        }
    
        override fun onFailure(error: Exception) {
            error.printStackTrace()
        }
    
        override fun onFinish() {
            //TODO Do something here
        }
    
        override fun onNotAvailable(error: Exception) {
            Toast.makeText(this, "Error: ${error.message}", Toast.LENGTH_SHORT).show()
        }

Stop/Kill ongoing process:

        fun stopRunningProcess() {
                FFmpeg.getInstance(this).killRunningProcesses()
        }

Check if any process is running:

        fun isRunning(): Boolean {
                return FFmpeg.getInstance(this).isFFmpegCommandRunning
        }

Permissions:

Following permissions must be added to avoid IO exceptions:

<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

TODO:

  • Add preview for 'Extarct Images from Video'

Acknowledgments:

MIT License

Copyright (c) 2018 Muhammad Umair Adil

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].