0

for my Android app I need to generate square videos for social media. Ideally in 1080x1080, but I have some flexibility on the resolution. For the framerate Ideal would be 60fps, but I can deal with 30, as long as it looks stable.

I have explored using a custom resolution camera object, however you can only ask the camera for pre-supported resolutions, and most cameras won't support a square aspect ratio.

I have had some success using this library https://github.com/CrazyOrr/FFmpegRecorder The library captures each frame, crops it with ffmpeg, at the end the frames are encoded together. However the resulting video always turns out choppy. I have tried tweaking the quality settings and the resolution but I haven't been able to remove the choppiness completely.

For my requirements it's not an option to record regular video and crop it into a square afterwards, since the experience needs to be seamless and cropping the video as a whole is too slow.

On the iOS incarnation of the app we were able to use this library https://github.com/Yummypets/YPImagePicker which basically does everything, is there no such thing for android?

Any advice on how to fix ffmpeg recorder is welcome, or if there's a different library that I could try, Ultimately what I need is the square video, I'm not particularly attached to any approach.

Arcantos
  • 1,052
  • 1
  • 13
  • 28
  • You need to change at least one of your requirements. There is no way to force any camera on any device to record in a square format. You might find some cameras that support it, but it won't be all of them. And an assured 60fps framerate- good luck with that. Especially since you seem to want it in realtime – Gabe Sechan Apr 30 '19 at 18:40
  • I realize I cannot force the camera, the ffmpeg recorder approach of cropping the frames is Ok, the problem with that is the choppiness. You may be right on the framerate Im ok with 30fps, as long as it's stable, I'll edit that – Arcantos Apr 30 '19 at 18:53
  • 1
    I hope *[this answer](https://stackoverflow.com/a/21531653/192373)* can satisfy your requirements. **60 fps** at 1080p is supported today on a handful of high-end devices, but with time, this will become more mainstream. – Alex Cohn Apr 30 '19 at 21:21

0 Answers0