Giter VIP home page Giter VIP logo

rgb565_video's Introduction

RGB565_video

Simple example for playing RGB565 raw video

Prototype

Please find more details at instructables: https://www.instructables.com/id/Play-Video-With-ESP32/

Fastest Example

Currently SPIFFS_MJPEG_JPEGDEC_MP3_audio_ESP32I2S8 is the fastest example that can reach 30fps@320x240 with 22050 mono MP3 playing at the same time.

Arduino_GFX 30fps@320x240 MJPEG with 22050 mono MP3

Convert video for SPIFFS

220x124@12fps

ffmpeg -t 2 -i input.mp4 -vf "fps=15,scale=-1:124:flags=lanczos,crop=220:in_h:(in_w-220)/2:0,split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse" -c:v rawvideo -pix_fmt rgb565be output.rgb

Convert audio + video for SD card

audio

PCM

44 kHz

ffmpeg -i input.mp4 -f u16le -acodec pcm_u16le -ar 44100 -ac 1 44100_u16le.pcm

MP3

44 kHz

ffmpeg -i input.mp4 -ar 44100 -ac 1 -q:a 9 44100.mp3

22 kHz

ffmpeg -i input.mp4 -ar 22050 -ac 1 -q:a 9 22050.mp3

16 kHz

ffmpeg -i input.mp4 -ar 16000 -ac 1 -q:a 9 16000.mp3

video

220x176@7fps

ffmpeg -i input.mp4 -vf "fps=7,scale=-1:176:flags=lanczos,crop=220:in_h:(in_w-220)/2:0" -c:v rawvideo -pix_fmt rgb565be 220_7fps.rgb

220x176@9fps

ffmpeg -i input.mp4 -vf "fps=9,scale=-1:176:flags=lanczos,crop=220:in_h:(in_w-220)/2:0" -c:v rawvideo -pix_fmt rgb565be 220_9fps.rgb

Animated GIF

220x176@12fps

ffmpeg -i input.mp4 -vf "fps=12,scale=-1:176:flags=lanczos,crop=220:in_h:(in_w-220)/2:0,split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse" -loop -1 220_12fps.gif

220x176@15fps

ffmpeg -i input.mp4 -vf "fps=15,scale=-1:176:flags=lanczos,crop=220:in_h:(in_w-220)/2:0,split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse" -loop -1 220_15fps.gif

Motion JPEG

320x240@12fps

ffmpeg -i input.mp4 -vf "fps=12,scale=-1:240:flags=lanczos,crop=320:in_h:(in_w-320)/2:0" -q:v 9 320_12fps.mjpeg

320x240@15fps

ffmpeg -i input.mp4 -vf "fps=15,scale=-1:240:flags=lanczos,crop=320:in_h:(in_w-320)/2:0" -q:v 9 320_15fps.mjpeg

320x240@24fps

ffmpeg -i input.mp4 -vf "fps=24,scale=-1:240:flags=lanczos,crop=320:in_h:(in_w-320)/2:0" -q:v 9 320_24fps.mjpeg

320x240@30fps

ffmpeg -i input.mp4 -vf "fps=30,scale=-1:240:flags=lanczos,crop=320:in_h:(in_w-320)/2:0" -q:v 9 320_30fps.mjpeg

220x176@24fps

ffmpeg -i input.mp4 -vf "fps=24,scale=-1:176:flags=lanczos,crop=220:in_h:(in_w-220)/2:0" -q:v 9 220_24fps.mjpeg

220x176@30fps

ffmpeg -i input.mp4 -vf "fps=30,scale=-1:176:flags=lanczos,crop=220:in_h:(in_w-220)/2:0" -q:v 9 220_30fps.mjpeg

208x176@30fps

ffmpeg -i input.mp4 -vf "fps=30,scale=-1:176:flags=lanczos,crop=208:in_h:(in_w-208)/2:0" -q:v 9 208_30fps.mjpeg

Sample Video Source

https://youtu.be/upjTmKXDnFU

rgb565_video's People

Contributors

moononournation avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

rgb565_video's Issues

Minor adaption SD_MMC examples if backlight is on GPIO 4

Trying to run the SDMMC_MJPEG_video_PCM_audio_dualSPI_multitask example on a TTGO T4 V1.3 board, I noticed that 'SD_MMC.begin("/sdcard", true)' pulls GPIO 4 down, although SD_MMC in1-bit mode doesn't use that pin. However, GPIO 4 is TFT_BL on the TTGO T4, so nothing appeared on the screen. After putting the backlight control lines after SD.begin(...), it works great! Thanks for sharing your code.

About esp32s3 playback mjepg video constantly reboot problem

Playing videos using the library rgb565_video esp32s3 keeps rebooting, is it a problem of not enough memory? But already have psram on.

Here are the serial port messages:

Rebooting...
ESP-ROM:esp32s3-20210327
Build:Mar 27 2021
rst:0xc (RTC_SW_CPU_RST),boot:0x2b (SPI_FAST_FLASH_BOOT)
Saved PC:0x40376ed4
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fce3808,len:0x44c
load:0x403c9700,len:0xbe4
load:0x403cc700,len:0x2a68
entry 0x403c98d4
MJPEG video start

assert failed: spinlock_acquire spinlock.h:122 (result == core_id || result == SPINLOCK_FREE)

Backtrace: 0xfffffffe:0x8037ead8 |<-CORRUPTED

Backtrace: 0x403772c6:0x3fceb920 0x4037ce51:0x3fceb940 0x40382cad:0x3fceb960 0x403800f9:0x3fceba90 0x4037ddbe:0x3fcebad0 0x42004082:0x3fcebb10 0x42002ee1:0x3fcebe70 0x4200a612:0x3fcebee0

ELF file SHA256: 386e3ac5afb988d6

Cannot play completely

19:46:46.796 -> Guru Meditation Error: Core 1 panic'ed (LoadStoreError). Exception was unhandled.
19:46:46.836 ->
19:46:46.836 -> Core 1 register dump:
19:46:46.836 -> PC : 0x400d18f9 PS : 0x00060f30 A0 : 0x800d9266 A1 : 0x3ffb27c0
19:46:46.836 -> A2 : 0x3ffc0178 A3 : 0x00000800 A4 : 0x000000ff A5 : 0x00000001
19:46:46.836 -> A6 : 0x400002b7 A7 : 0x00000000 A8 : 0x00000000 A9 : 0x3ffb27a0
19:46:46.836 -> A10 : 0x400002b8 A11 : 0x3ffb28b8 A12 : 0x00000800 A13 : 0x400002b8
19:46:46.836 -> A14 : 0x04000000 A15 : 0xa201ca43 SAR : 0x00000008 EXCCAUSE: 0x00000003
19:46:46.876 -> EXCVADDR: 0x400002b7 LBEG : 0x40085f75 LEND : 0x40085f97 LCOUNT : 0x00000000
19:46:46.876 ->
19:46:46.876 ->
19:46:46.876 -> Backtrace:0x400d18f6:0x3ffb27c00x400d9263:0x3ffb2820
19:46:46.876 ->
19:46:46.876 ->
19:46:46.876 ->
19:46:46.876 ->
19:46:46.876 -> ELF file SHA256: 0000000000000000
19:46:46.876 ->
19:46:46.876 -> Rebooting...
19:46:46.876 -> ets Jun 8 2016 00:22:57
19:46:46.876 ->
19:46:46.876 -> rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
19:46:46.876 -> configsip: 0, SPIWP:0xee
19:46:46.876 -> clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
19:46:46.876 -> mode:DIO, clock div:1
19:46:46.876 -> load:0x3fff0030,len:1240
19:46:46.916 -> load:0x40078000,len:13012
19:46:46.916 -> load:0x40080400,len:3648
19:46:46.916 -> entry 0x400805f8
19:46:47.652 -> MJPEG video start

ESP32 resets

Whenever I upload the code along with the data as spiffs content, it keeps on resetting with this log:

Guru Meditation Error: Core  1 panic'ed (LoadProhibited). Exception was unhandled.
Core 1 register dump:
PC      : 0x4006897f  PS      : 0x00060530  A0      : 0x1a66660c  A1      : 0x3ffb1ec0  
A2      : 0x3ffbec00  A3      : 0x00000013  A4      : 0x00000001  A5      : 0x00000001  
A6      : 0x00000000  A7      : 0x00000001  A8      : 0x800d74a2  A9      : 0x3ffb1ea0  
A10     : 0x3ffb843c  A11     : 0x00000000  A12     : 0x00000000  A13     : 0x00000000  
A14     : 0x00000000  A15     : 0x00000000  SAR     : 0x0000000d  EXCCAUSE: 0x0000001c  
EXCVADDR: 0x00000004  LBEG    : 0x400d4fb9  LEND    : 0x400d4fc6  LCOUNT  : 0x00000000  

I am using ST7789 with this configuration:

// ST7789 Display
#define TFT_BL 22
Arduino_DataBus *bus = new Arduino_ESP32SPI(15 /* DC */, 12 /* CS */, 18 /* SCK */, 23 /* MOSI */, 19 /* MISO */);
Arduino_ST7789 *gfx = new Arduino_ST7789(bus, -1 /* RST */, 2 /* rotation */, true /* IPS */, 240 /* width */, 240 /* height */, 0 /* col offset 1 */, 80 /* row offset 1 */);

Using ESP32 Dev module with 4MB Flash
and the following partition scheme : 1.2MB APP && 1.5MB SPIFFS

PlatformIO IDE error

esp32_vscode

I have this kind of error message in the PlatformIO IDE environment

/home/jin/.platformio/lib/Arduino_GFX/Arduino_ESP32SPI_DMA.h:19:19: fatal error: unity.h: No such file or directory

Card Mount failed ILI9225

Hi,

I can't run it with ESP-32S NodeMCU ver 1.1 and ILI9225 with SD card like at images below:

image
image
It says card mount failed.

malloc fails on SD_RGB565_video

according to ESP.getFreeHeap() i have ~300kb of memory and my video takes only 240 * 240 * 2 = 115200 but i get the malloc failed error on the example code.

尝试“SPIFFS_MJPEG_JPEGDEC_MP3_audio_ESP32I2S8”但失败了

非常有趣的项目!我通过这个项目已经基本熟悉了Arduino_GFX

我首先尝试“SD_MJPEG_video_PCM_audio”,我成功了!我使用2.8寸240x320分辨率的7789屏幕,我将程序和视频素材文件都调整为每秒24帧,再将视频素材文件降低色调饱和度、降低对比度、降低锐度,降低到2300kb/s左右的码率再转成mjpeg,这样能够确保任何视频都能够绝对流畅。

我还有一块4寸320x480分辨率的7796屏幕,我像上面一样修改了“SD_MJPEG_video_PCM_audio”这个程序和我的视频素材文件,能够播放,我能听到pcm文件的声音,虽然屏幕的图像是扭曲的,但我还能继续调整,不过视频此时是非常不流畅的,可能不到每秒10帧,声音也是不流畅的,难道esp32的性能真的无法支持播放320x480分辨率的mjpeg吗?

我并不死心,于是我又尝试“SPIFFS_MJPEG_JPEGDEC_MP3_audio_ESP32I2S8”,希望这个程序能够让320x480分辨率的mjpeg流畅播放。

我已将esp32的分区设置改为“No OTA (1MB APP/3MB SPIFFS)”,并且我已成功上传data中的mjpeg和mp3文件到esp32的闪存内,但esp32依旧无法读取闪存内的文件,串口监视器显示:

05:39:31.497 ->
05:39:31.497 -> rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
05:39:31.497 -> configsip: 0, SPIWP:0xee
05:39:31.497 -> clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
05:39:31.497 -> mode:DIO, clock div:1
05:39:31.497 -> load:0x3fff0018,len:4
05:39:31.497 -> load:0x3fff001c,len:1216
05:39:31.497 -> ho 0 tail 12 room 4
05:39:31.497 -> load:0x40078000,len:10944
05:39:31.497 -> load:0x40080400,len:6388
05:39:31.497 -> entry 0x400806b4
05:39:32.153 -> ERROR: File system mount failed!

请问我的错误出在哪里呢?并且我还有必要继续尝试让esp32流畅播放320x480分辨率的mjpeg吗?

ESP32-S3-WROOM-1U-N16R8能实现GIF播放吗?

您好,我想请问这个库是否能使用ESP32-S3-WROOM-1U-N16R8实现GIF播放呢,因为我这ESP32S3型号板子报错,同样的代码使用其他型号就能通过编译。希望得到您的回复,谢谢。
17A$ RRON( (0`)5(RI(UWE
image

Can't play a 2nd video

Great library and examples!
I'v adopted the main routine of SD_MJPEG_video to play two videos, one after the other. The 1st video plays fine, the 2nd not at all. The videos are mjpeg's at 320x240/25fps without audio.
What I'm missing here?

uint8_t *mjpeg_buf = (uint8_t *)malloc(MJPEG_BUFFER_SIZE);
File vFile = SD.open(file1);
mjpeg.setup(vFile, mjpeg_buf, gfx, true);
  while (mjpeg.readMjpegBuf()) {
    mjpeg.drawJpg();
  }
vFile.close();
free(mjpeg_buf);

uint8_t *mjpeg_buf = (uint8_t *)malloc(MJPEG_BUFFER_SIZE);
File vFile = SD.open(file2);
mjpeg.setup(vFile, mjpeg_buf, gfx, true);
  while (mjpeg.readMjpegBuf()) {
    mjpeg.drawJpg();
  }
vFile.close();
free(mjpeg_buf);

Feature Request

What FPS would it run at using mjpeg without the audio ?
What FPS would it run at using gifs without the audio ?
What FPS would it run at using mjpeg without the audio on ili9341 320x240 pixels?
What FPS would it run at using gifs without the audio on ili9341 320x240 pixels?

thanks

ST7735屏幕编译报错

在使用ST7735屏幕时编译报错

引脚:
Arduino_GFX *gfx = new Arduino_ST7735(bus, 33 /* RST */, 0 /* rotation */, false /* IPS */, 128 /* width */, 160 /* height */, 2 /* col offset 1 */, 1 /* row offset 1 */, 2 /* col offset 2 */, 1 /* row offset 2 */, false /* BGR */);

报错内容:
`
C:\Users\shuai\Downloads\Compressed\ESP-32_GC9A01_JPG-main\Video_Demo\SD_MJPEG_video\SD_MJPEG_video.ino: In function 'void setup()':
SD_MJPEG_video:80:48: error: invalid conversion from 'Arduino_GFX*' to 'Arduino_TFT*' [-fpermissive]
mjpeg.setup(vFile, mjpeg_buf, gfx, true);
^

In file included from C:\Users\shuai\Downloads\Compressed\ESP-32_GC9A01_JPG-main\Video_Demo\SD_MJPEG_video\SD_MJPEG_video.ino:31:0:
sketch\MjpegClass.h:16:8: note: initializing argument 3 of 'bool MjpegClass::setup(fs::File, uint8_t*, Arduino_TFT*, bool)'
bool setup(File input, uint8_t *mjpeg_buf, Arduino_TFT *tft, bool multiTask)
^

SD_MJPEG_video:107:8: error: 'class Arduino_GFX' has no member named 'displayOff'
gfx->displayOff();
^

exit status 1
invalid conversion from 'Arduino_GFX*' to 'Arduino_TFT*' [-fpermissive]
`

Motion JPEG ffmpeg command colors reverted

Hi,

Thank you for your great work!
I used your motion Mjpeg ffmpeg command to a video on youtube. But when I played it back, the colors get reverted. This is my ffmpeg version, could you please help me this?

ffmpeg version 6.0-essentials_build-www.gyan.dev Copyright (c) 2000-2023 the FFmpeg developers

Thank you,
Manh

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.