Skip to content

Instantly share code, notes, and snippets.

@tranthamp
Created October 25, 2012 16:02
Show Gist options
  • Save tranthamp/3953665 to your computer and use it in GitHub Desktop.
Save tranthamp/3953665 to your computer and use it in GitHub Desktop.

Revisions

  1. Patrick Trantham created this gist Oct 25, 2012.
    48 changes: 48 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,48 @@
    // I'm using a virtual video capture device via the vivi kernel module
    # modprobe vivi

    // This creates /dev/video0 if no other devices have yet been enumerated.

    // Display available formats for the video device
    # yavta --enum-formats /dev/video0
    Device /dev/video0 opened.
    Device `vivi' on `vivi-000' is a video capture device.
    - Available formats:
    Format 0: YUYV (56595559)
    Type: Video capture (1)
    Name: 4:2:2, packed, YUYV

    Format 1: UYVY (59565955)
    Type: Video capture (1)
    Name: 4:2:2, packed, UYVY

    Format 2: RGB565 (50424752)
    Type: Video capture (1)
    Name: RGB565 (LE)

    Format 3: RGB565X (52424752)
    Type: Video capture (1)
    Name: RGB565 (BE)

    Format 4: RGB555 (4f424752)
    Type: Video capture (1)
    Name: RGB555 (LE)

    Format 5: RGB555X (51424752)
    Type: Video capture (1)
    Name: RGB555 (BE)

    Video format: RGB565 (50424752) 640x480 (stride 1280) buffer size 614400

    // Choose a format and dimensions, then use yavta to capture and dump some frames
    # yavta -f RGB565 -s 640x480 -n 4 --capture=5 -F /dev/video0

    // This command will capture 5 frames (--capture=5) using 4 buffers (-n 4) with a
    // size of 640x480 (-s 640x480) in the rgb565 little endian format (-f RGB565),
    // then it will dump them to files (-F) named frame-00000x.bin

    // Change the file extensions to indicate the format (required for conversion by ffmpeg)
    # mv frame-000001.{bin,rgb}

    // To display the raw 16-bit rgb files, I convert them to the png format using ffmpeg
    # ffmpeg -s 640x480 -pix_fmt rgb565le -i frame-000001.rgb -f image2 -pix_fmt rgb24 frame1.png