Last active
October 12, 2023 13:14
-
-
Save neilpa/2bfa8baa9372b5a3c908 to your computer and use it in GitHub Desktop.
Use ffmpeg to convert raw Android camera frame buffers
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Assuming the raw byte[] buffer from onPreviewFrame was written at $1 | |
INPUT=$1 | |
# Need preview size since we dumped to a raw file w/out header info | |
SIZE=1280x960 | |
# Converting to JPEG | |
ffmpeg -f image2 -vcodec rawvideo -s $SIZE -pix_fmt nv21 -i $INPUT out.jpeg | |
# Converting to PNG | |
ffmpeg -f image2 -vcodec rawvideo -s $SIZE -pix_fmt nv21 -i $INPUT out.png |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment