Play video and audio from ESP32!
HTML-код
- Опубликовано: 14 июл 2024
- As you know, due to the lack of resources on the ESP32, it is hard to play the video. However, if you separate the MJPEG image and audio AAC from the video, you can make it playable on ESP32.
My project is based on a Mini Retro TV project that already works great. Based on this, I made it possible to change the channel of several video clips on the SD card using the touch screen.
Timestamps
0:00 - Intro
1:00 - Mini Retro TV
2:48 - Download Sample Videos
2:59 - Make MJPEG, AAC FILE (FFMPEG)
3:16 - Copy Files to SD Card
4:08 - Added Touch Action
4:57 - Organize Video Clips on SD Card
5:07 - Lego Housing Case
5:29 - All Done!
[Mini Retro TV]
www.instructables.com/Mini-Re...
[FFMPEG]
ffmpeg.org/
//Video Encoding
ffmpeg -i SampleVideo_640x360_10mb.mp4 -vf "fps=30,scale=-1:240:flags=lanczos,crop=288:in_h:(in_w-288)/2:0" -q:v 11 288_30fps.mjpeg
//Aduio Encoding
ffmpeg -i SampleVideo_640x360_10mb.mp4 -ar 44100 -ac 1 -ab 24k -filter:a loudnorm -filter:a "volume=5dB" 44100.aac
[Sample Videos]
sample-videos.com/
[Project Github]
github.com/0015/ThatProject/t...
#VideoPlayer #MINITV #ESP32 #Lego #ThatProject - Наука
For more projects - ruclips.net/user/ThatProject
That Project Github Repository - github.com/0015/ThatProject
Join FB Group - facebook.com/groups/138965931539175
Just done the MJPEG+MP3.
Nice to see you made MJPEG+AAC. Good job!
Amazing project. Excellent work. Keep it up!
Thanks very much my dear. You are great!!!
Nice bro, I guess you might be Chinese aren't you? Your accent sounds like my friend. I am Korean and I have very strong Korean accent on my english too. By the way, your project looks awesome and I am amazed by your works with ESP32. It is hard to keep recording video with great quality of the projects. I would like to record my project but..... I found out doing project + video recording + editing are not easy taking time twice. Especially, your project is meaningful and your idea is really fresh. The completion level is also great. Nice job so far and I am looking forward seeing more project on this channel. Thanks.
Good project. Are you using tearing support in this screen/project ?
No, absolutely not. It doesn't have that kind of luxury function.
nice~funny TV
nice - i used lego to embed a video camera, and another set for the streaming "flippy-screen" - cheaper than a digital printer, and kids can build it into bigger projects.
I love this, I am planning on a similar project however using a single button to change channel. I am no coding expert but can usually get things going with some tips! Looks like I need to change the 'touchTask' into something that relates to button presses, got any suggestions to set me in the right direction?
How about adding a button interrupt?
At the end of your video, you do a demo of the final result. Many of the videos have visible glitching. Is this due to screen tearing? A mismatch in refresh rate? Or is it struggling to keep up with the frame rate?
ESP32 doesn't have a codec to play a media file. So it's decoding with software to play both video and audio at the same. This is a pretty heavy task on ESP32. Glitches may occur because the entire screen cannot be redrawn within a certain time.
Did you make the pcb with the MINI TV text on it? Or is it possible to buy that?
This was a just prototype. You need to make it by yourself with the small display.
I always program with the arduino ide
I don't know how to program on
visual studio code
do you have a tutorial on how to
Or a video from an another channel ?
This project was done with Arduino IDE. Are you talking about ESP-IDF? It's tricky but worth learning. Looking at examples is very helpful. I don't have a tutorial on that yet. I'll try to make it if I have a chance. Thanks.
if there a remote with basic keys it would awsome hope you will ad it for your viewers... dont forget everyone have a kid inside😁
Nice work. Would this also work with a RP2040 microcontroller?
Unfortunately, it won't work in RP2040 with my code. You need to change the code for it.
Nice project. I will do such a project too. So, can we add the channels we want to the device?
What do you mean by "add channels"? In this project, I just showed the channel number to determine which file is selected from SD card. Is that what you think?
@@ThatProject I mean, for example, I want to add a television channel. For example, is it possible to add the CNN news channel?
@@Elshan_Mammadov_ Do you mean in real-time?
Then it is impossible. Currently, the task of separating the image and audio cannot be performed inside the ESP32, so you must first separate the image data and audio data from the original video.
@@ThatProject I understand. Thank you for the information.
Hi, Can connect setup box output to esp32 as input and see all video on webserver?
The small size of video files might be possible, but at the moment I have no idea how to configure the system for it. I'll try it if I have a good idea.
At 1:51 , you say we need something running at 80Mhz, but I can't quite understand what it is you're mentioning. Could you clarify that part please? EDIT: I used AI to create subtitles, and it says you said "A display that operates at 80Mhz". I don't know if that's accurate, but I do know that I can't find any specs on any display that shows its Mhz. At best, Hz, but usually its speed is measured in ms. I guess I'm barking up the wrong tree?
The 80Mhz is the maximum speed of the APB Clock of ESP32. Also, it can be the maximum speed of the SPI interface if the display IC supports it.
Thank you@@ThatProject
is that possible to run on esp8266? with mjpeg only?
I don't think so. The base project mentions only ESP32 not ESP8266 so not sure about it.
trying to get this to loop a video, but it keeps restarting even though I removed the command from the controller.
I know it has something to do with clearing the buffers, But I cant get them to work.
What display are you using? Try using only 50% of your current screen size. As you said, it seems like it's not emptying all the buffers in time.
@ThatProject 2" st7789. I'm currently running a single core code right now, but like the smoothness of dual core.
I'm using them for props, the videos need to loop seamlessly unless an interrupt to change files happens.
In the code I'm using, the originator added free(_mjpeg_Buf);
At the end of the video, it allows it to loop without crashing.
I just don't know how to do that for the dual core, because I would think it would need to free 2 buffers, correct? NULL doesn't work.
@@davisje011 The use of 2 cores is to reduce bottlenecks and increase FPS by separating the decoding and drawing parts of the image when drawing the screen.
I also had a similar problem, and in the end, when one file was finished playing, I had to set it to the next file name and then reset it to play the next video. In order to make it without restarting, you will need to clear everything allocated to memory at the end of the video and reset both the video and audio tasks. I don't know how effective this will be.
Mine works. No restarts! I've created a void and run the code from there. At the end of the video the void returns to the main loop where it gets called again.
Make sure to initialize the sd card-reader inside the void again otherwise it will crash and resets.
Also add a small delay (2000 or so) before the video closes. It compensates for a a/v length-difference and thus avoiding a crash. Usefull for longer clips.
Would be nice if has an A/V or HDMI connection 😅
EL PROYECTO SE PUEDE HACER CON TTGO - T - DISPLAY ????
There is a high possibility that it will not work because TTGO T Display does not have PSRAM.
Works perfect on a TTGO S3 Display,. Make sure to use the Arduino_ESP32LCD8 databus driver, together with the Arduino_st7789 GFX driver.
Define all LCD pins (according to the data bus), the Pin_POWER (15) and BUTTON pins (0 and 14).
Do not forget to power on the display in Setup (PIN_POWER_ON)
Connect your SD card reader to pins 10 (CS), 11 (MISO), 12 (CLK), 13 (MOSI)
@@dutchflyingpilot Good to know! Thank you!
Cute project. Where can I find the ctp 1.69 lcd module like that from your video?
Check this one. www.alibaba.com/product-detail/Optional-Capacitive-Touch-Panel-Smart-Watch_1600283882399.html
I would pay you to make me one of those.
Haha
I can't understand you well bro. :(
What is the exact name of the lcd display you have in the video, could you provide me with a link if possible? Thank you
I'm not sure because it's been so long. I'll let you know when I find out.
Hello! fails to compile :(
log file:
drive.google.com/file/d/1gL1YQ0BjoKZwliLLDg1qTCOJHMYiHpr1/view?usp=sharing
I used: ESP32 by Espressif Systems 2.0.11 installed
Please upload libraries to google drive