Announcement

Collapse
No announcement yet.

Playing Video on a Picadillo

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Playing Video on a Picadillo

    Hi everyone,

    I was just wondering if it's possible to play videos from the SD Card using the 35T's?

    I have been using the bmpfile library for handling images and that works beautifully but I am unsure video capability is currently a supported feature.

    Thanks in advance.
    Antonio

  • #2
    You could use the gciWidget library to display successive frames of a widget from a .GCI / .DAT file pair (generated by 4D Workshop). I'm not sure off hand if it works with the video widget, but the file format is very simple, so building your own files should be easy enough.

    Doing full screen video though, nah, I can't see that working...

    Comment


    • #3
      I have just been having a play to see just what is possible...

      I converted a chunk of Dredd into a series of PNG files (using "mplayer Dredd.mkv -vo png") then resized each frame of the chunk I am using to 320x160, then converted each frame to raw 565 data (using a small PHP script, but there's many tools to do it), then concatenated all the raw files together into a raw data stream.

      I then wrote this program:
      Code:
      #include <TFT.h>
      #include <SD.h>
      
      PICadillo35t tft;
      
      void setup() {
        analogWrite(PIN_BACKLIGHT, 255);
        tft.initializeDevice();
        tft.setRotation(1);
        tft.fillScreen(Color::Black);
        tft.setFont(Fonts::Topaz);
        tft.setTextColor(Color::White, Color::Black);  
        tft.setCursor(0, 0);
        tft.print("Initializing SD card...");
        if (!SD.begin(PIN_SD_SS)) {
          tft.print("failed");
          while(1);
        }
        tft.println("OK");
        tft.fillScreen(Color::Black);
      }
      
      void loop() {
        playVideo("/dredd.vid", 80, 80, 320, 160);
      }
      
      void playVideo(char *fn, int x, int y, int w, int h) {
        File vidFile = SD.open(fn);
        int chunk = w * h;
        while (chunk >= 16384) {
          chunk = chunk >> 1;
        }
        uint16_t frame[chunk];
        tft.openWindow(x, y, w, h);
        while (vidFile.read(&frame, chunk * 2) > 0) {
          tft.windowData(frame, chunk);
        }
        vidFile.close();
        tft.closeWindow();
      }
      to display the video.

      It runs, but the framerate is rather low and you can see it refreshing. The problem isn't the updating of the TFT but the reading of the data from the SD card.

      You can download the dredd.vid file here: http://scratchpad.majenko.co.uk/dredd.zip - uncompressed it's about 45MB. Just don't tell MPAA

      Comment

      Working...
      X