Skip to content

Instantly share code, notes, and snippets.

@neilpa
Last active October 12, 2023 13:14
Show Gist options
  • Select an option

  • Save neilpa/2bfa8baa9372b5a3c908 to your computer and use it in GitHub Desktop.

Select an option

Save neilpa/2bfa8baa9372b5a3c908 to your computer and use it in GitHub Desktop.

Revisions

  1. neilpa revised this gist Nov 14, 2014. 2 changed files with 11 additions and 2 deletions.
    11 changes: 11 additions & 0 deletions nv21-convert.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,11 @@
    # 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
    2 changes: 0 additions & 2 deletions nv21-to-jpeg.sh
    Original file line number Diff line number Diff line change
    @@ -1,2 +0,0 @@
    # Assuming the raw byte[] buffer from onPreviewFrame was writting to input.nv21
    ffmpeg -y -f image2 -vcodec rawvideo -s 1280x960 -pix_fmt nv21 -i input.nv21 output.jpeg
  2. neilpa renamed this gist Nov 14, 2014. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  3. neilpa renamed this gist Nov 14, 2014. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  4. neilpa created this gist Nov 14, 2014.
    2 changes: 2 additions & 0 deletions nv21-decode
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,2 @@
    # Assuming the raw byte[] buffer from onPreviewFrame was writting to input.nv21
    ffmpeg -y -f image2 -vcodec rawvideo -s 1280x960 -pix_fmt nv21 -i input.nv21 output.jpeg