STM32 AVI video player with OSD menu. jpeg decoder optimization in assembler
Вставка
- Опубліковано 12 кві 2023
- STM32 AVI video player with OSD menu. Optimization of jpeg decoder in assembler.
The video shows animated films (under a Creative Commons license):
"Elephants Dream": © Сopyright 2006, Blender Foundation / www.orange.blender.org
"Big Buck Bunny": © Copyright 2008, Blender Foundation / www.bigbuckbunny.org
"Sintel": © Copyright 2010, Blender Foundation / www.sintel.org
The Blender Foundation is a non-profit organization dedicated to the development of an open source 3D modeling software package called Blender (www.blender.org).
AVI format requirements:
- mjpeg (motion jpeg) video stream, i.e. video frames must be encoded with the jpeg codec;
- mp3 audio stream i.e. sound must be encoded with mp3 codec.
To convert a video file to a format supported by the player, it is recommended to use the ffmpeg library. For example, the following command line converts an mp4 video to a player-supported avi format with a frame size of 320x240, a frame rate of 25 frames per second, and an encoding quality of 15:
ffmpeg -i video.mp4 -c:a mp3 -c:v mjpeg -s 320x240 -r 25 -q 15 video.avi
Where:
-i video.mp4 - an indication of the source file that you want to convert to the avi format supported by the player;
video.avi - output file with avi extension, where the conversion result will be saved;
-c:a mp3 - an indication that the "audio track" (audio stream) in the output file must be in the mp3 codec format;
-c:v mjpeg - an indication that the "video track" (video stream) in the output file must be in the mjpeg codec format (a set of pictures encoded with the jpeg codec, the so-called motion jpeg);
-s 320x240 - indication of the video frame size in the output avi file (width, height);
-r 25 - indication of the frequency of video frames in the output avi file (frames per second);
-q 15 indicates the encoding quality of the avi file (from 1 (best) to 31 (worst)). The sound quality can be set with the -b switch, which means bitrate (stream speed in bits / s). For example, a key such as -b:a 128k will set the audio stream to 128 kbps, which is considered the entry level for the mp3 codec when encoding music data (32-96 kbps is enough for speech encoding, and from 96 kbps or more - low quality music). A stream of 256 kbps is enough for high quality music when encoding mp3. 320 kbps is the limit for the mp3 codec.
When converting video, keep the aspect ratio of the source video frame in mind. For example, if the source video had a frame aspect ratio of 16:9, then when using a display with a width of 320 pixels, the height of the output frame should be 180 pixels. Those. the parameter s for the given example should be set to 320x180. If the aspect ratio of the source frame is 4:3, then when using a display with a width of 320 pixels, the height of the output frame should be 240 pixels. Those. the s parameter for this example should be set to 320x240. The q parameter determines the encoding quality and can take values from 1 to 31. As q increases, the quality decreases, and as q decreases, it increases. This setting naturally affects the performance of the software jpeg decoder.
List of components:
- development board stm32f401ccu6 alii.pub/6fdumy
- 3.2" touchscreen display ILI9341 spi alii.pub/6fdvcf
- pcm5102a audio DAC alii.pub/6fdurf
- micro SD card module alii.pub/6o72eb
- breadboard alii.pub/6fduuq
- wires for breadboard alii.pub/6fduwo
- encoder with button alii.pub/6o72l4
- ceramic capacitors 0.01-0.1 uF - 2 pcs.
Project link (github):
github.com/vadrov/stm32f4_fas...
Contacts:
/ @vadrov
dzen.ru/vadrov
t.me/vadrov_channel
stm32, jpeg stm32, avi stm32, mp3 stm32, video stm32, audio stm32, video stm32, audio stm32
#stm32 #jpeg #video
👉
Предлогаю Че́ллендж - повтори устройство и выложи видос . Порадуй автора за его труды!!!!
Вот до чего безответная любовь к мультикам может довести человека ) В неравной борьбе с компилятором победил Человек. Великий труд!
Код ужасен и излишне замудрен, тяжело под свое железо подгонять, все редактировать надо, по удобному не заинклюдить ничего. Хорошо хоть комментарии в коде есть, тяжело, но понимать удается
Асм жив! И будет жив всегда. Лайк и комментарий в поддержку канала.
Доброго здравия! Решил на досуге посмотреть Вашу реализацию энкодера на прерываниях. Никак не соображу 167 строку ...keys &= ENCODER_C; /* Получаем состояние выхода С, выделив его из совокупности выходов. */ Так как переменная keys изначально равна 0, то после логического И мы также имеем 0. Не поясните? Заранее спасибо.
повторил проект, просто огонь. хотелось бы продолжение, например перемотка видео, и пауза. попробуй сам добавить, но изучать и понять чужой код это сложно. А так супер, удачи. 👍
Попытался повторить. Прошил готовый hex-файл из проекта на гитхабе. Дисплей заработал, выдал заставку и сообщение "Error FileManager!" на розовом фоне. При попытке повернуть энкодер это сообщние начинает быстро мерцать. Схему проверил. Видеофайл на карточку залил. Нифига! Не работает! Кто-нибудь, кроме автора, пытался запустить этот проект?
не знаю сколько людей взялись бы за такую работу, но вы молодец. такое не каждому под силу)
Шикарно! Не понятно почему энкодер таймером не обрабатывать, еще б больше разгрузился проц. Но результат впечатляет!
Отличный проект, спасибо что делитесь с нами проектами.
Очень интересный проект !
Почему я вас встретил именно сегодня? Спасибо вам!!!
Ого го Топчик!
С ассемблерными вставками и с макросом формирования смещения круто получилось 👍
Блин, совсем случайно наткнулся на это видео и это прекрасно! спасибо!
Спасибо, что делитесь наработками. Пора делать уроки по ассемблеру
Это невероятно круто
Супер проект..
Отличная работа! Снимаю шляпу. Для обработки энкодера можно иcпользовать аппаратные возможности таймеров в режиме ENCODER MODE. Там и защита от дребезга, и счетчик угла, и прерывания реже.