tanersener / mobile-ffmpeg

FFmpeg for Android, iOS and tvOS. Not maintained anymore. Superseded by FFmpegKit.
https://tanersener.github.io/mobile-ffmpeg
GNU General Public License v3.0
3.87k stars 790 forks source link

What encoders/decoders/muxers/demuxers/parsers do I need to enable in FFMpeg for converting an mp4 video to a gif? #469

Closed kostik15 closed 4 years ago

kostik15 commented 4 years ago

I am building FFmpeg with custom options to reduce the final size of apk file on android. I want just convert a mp4 file to a gif. Following is my options specified


 --disable-everything
 --enable-decoder=mpeg4,mpegvideo,aac,gif,h264
 --enable-parser=aac,mpeg4video,mpegaudio,mpegvideo,gif,h264
 --enable-demuxer=mpegvideo,aac,mov,gif,h264
 --enable-muxer=mp4,gif,mov,h264
 --enable-protocol=file
 --enable-encoder=mpeg4,mov,gif,h264
 --enable-filter=scale,fps,copy,palettegen,vflip,paletteuse,crop

What other options do i need to add to successfully run this command?

ffmpeg -y -i input.mp4 -vf "fps=15,scale=320:-1:flags=lanczos" -pix_fmt rgb24 output.gif

ot this command

ffmpeg -y -i input.mp4 output.gif

After I added module into Android Studio I run FFmpeg command. Iam getting this error:

2020-06-21 12:16:09.883 8871-9102/com.example.myapplication W/mobile-ffmpeg: [graph 0 input from stream 0:0 @ 0x7088243f40] sws_param option is deprecated and ignored
2020-06-21 12:16:09.885 8871-9102/com.example.myapplication W/mobile-ffmpeg: Incompatible pixel format 'rgb24' for codec 'gif', auto-selecting format 'rgb8'
2020-06-21 12:16:09.885 8871-9102/com.example.myapplication E/mobile-ffmpeg: Output pad "default" with type video of the filter instance "Parsed_scale_1" of scale not connected to any destination
2020-06-21 12:16:09.885 8871-9102/com.example.myapplication E/mobile-ffmpeg: Error reinitializing filters!
2020-06-21 12:16:09.885 8871-9102/com.example.myapplication E/mobile-ffmpeg: Failed to inject frame into filter network: Invalid argument
2020-06-21 12:16:09.886 8871-9102/com.example.myapplication E/mobile-ffmpeg: Error while processing the decoded data for stream #0:0

I also tried to include FULL library and it that case everything worked as expected.

Thanks for your help.

github-actions[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.