simple mp4 player based on rockchip rv1109 platform

mp4player

RV1109平台上实现一个简单的 mp4 播放器,主要是本人使用的开发板QT无法播放mp4,应该是没有编译qst所致,因而想利用rockchip平台自有的 功能实现一个简单的播放器。
base目录包含一些基础框架实现,包含信号,线程,时间等,线程和消息泵的实现非常非常简单,因而不是很安全。安全的消息泵可以参考chromium base。
但那个过于庞大,不大适合引入这里。
media目录包含mp4播放的实现
ui目录,简单的QT UI,为了显示视频。
作者对QT不怎么熟悉,用法比较粗糙。

技术实现

一般而言,音视频同步有三种方式:
1.以视频时间戳为基准
2.以音频时间戳为基准
3.以外部时钟为基准
本项目中使用外部时钟,使用一个定时器周期性播放音频和视频。其中比较关键的是,需要对定时器误差进行补偿,否则
容易造成同步丢失,或者音频播放缓冲区欠载。
这里没有什么复杂的算法,之所以播放能连续,主要依赖前期的缓冲,再加上及时修正定时器误差,可以保证播放的流畅性,
音视频同步误差不超过40ms,理论上。

本项目实现的功能包含:
1.pause/resume
2.seek
3.快播慢播暂时不支持

依赖

rkmedia:用来播放声音,以及rga的一些东西。
mpp:用来解码 h264/h265
ffmpeg:用来解码音频
libevent:实现一个简单的消息泵
QT:用来显示视频
以上库均已包含在rv1109固件中

代码

chromium,mini-chromium, webrtc中精简了部分代码,形成了简单的base库。
部分逻辑参考了 rockchip ffmpeg 解码器部分。
还有一部分参考 android 模拟器的 video player部分。(https://github.com/gameltb/rnbox)

注意事项

缓冲的时长可以预先指定(以秒单位),音视频根据这个时长计算缓冲长度。这里需要注意,mpp解码器的缓冲区不能小于视频输出缓冲区,
否则视频输出缓冲区永远不可能填满。
有些mp4 包含5.1或者更多的声道,因为这是针对rv1109的,我们直接转换为立体声输出。
如果不想依赖rkmedia,可以自己实现 audio render,这个也不是很复杂。 chromium/webrtc中都包含了alsa的播放支持。
很多mp4包含B帧,不缓冲的话也没法正确播放。
代码中只验证了aac的解码,对于可能存在的其他音频编码方式,因为没找到样本,也没有验证过。是否需要在送入解码器之前将sample特殊处理,
没有什么特别的概念。
rkmedia中的 AO 要求指定送入播放器的每帧样本数,不是严格意义上的nb_samples。个人理解nb_samples是每通道的样本数。而rkmedia需要传入每帧的总样本数。
比如立体声,16bit音频。一般,aac解码出来,nb_samples=1024,实际包含2048个samples。

性能测试

1.不使用QT的话,单核CPU占用不会超过10%。
2.运行于QT上,CPU0:12-13%, CPU1:13-16%
3.内存占用略高,主要看缓冲时长。
4.如果想进一步优化CPU占用,可以用RK VO直接显示。 但用QT测试尚可。

Similar Resources

Yakuza Arcade Machine Player - play Virtua Fighter 5: Final Showdown on PC, using Yakuza 6 files.

Yakuza Arcade Machine Player - play Virtua Fighter 5: Final Showdown on PC, using Yakuza 6 files.

Yakuza Arcade Machines Player Yakuza Arcade Machines Player is a launcher that allows you to run Virtua Fighter 5: Final Showdown, standalone and nati

Nov 26, 2022

A clone of Media Player Classic reimplemented in Qt.

A clone of Media Player Classic reimplemented in Qt.

Media Player Classic Qute Theater A clone of Media Player Classic reimplemented in Qt. Media Player Classic Home Cinema (mpc-hc) is considered by many

Jan 6, 2023

🤟Super fast H.264/H.265 FLV player

🤟Super fast H.264/H.265 FLV player

🤟Super fast H.264/H.265 FLV player

Jan 7, 2023

FFmpeg powered audio player in node.js

sange FFmpeg powered audio player in node.js prerequisites node.js cmake sudo apt install cmake c++ compiler sudo apt install g++ gcc ffmpeg sudo apt

Nov 25, 2022

Poppy Music Player

Poppy Music Player poppy is a simple music player that is controlled by process signals. Build Before anything: meson setup build cd build Compiling n

Apr 26, 2022

RTSP Wasm Player

RTSP Wasm Player

RTSP Wasm Player Overview # RTSP WebSocket Proxy RTSP/Webcam/File FFmpeg open Packets WebSocket # WS Wasm Player WebSocket Packets Wasm FFm

Dec 23, 2022

Kodi is an award-winning free and open source software media player and entertainment hub for digital media

Kodi is an award-winning free and open source software media player and entertainment hub for digital media

website • docs • community • add-ons Welcome to Kodi Home Theater Software! Kodi is an award-winning free and open source software media player and en

Jan 2, 2023

Free and open-source media player written in C++

Liquid Media Player Free and open-source media player written in C++. Currently in development. Build Guide Windows Install the MSYS2 Building Platfor

Sep 20, 2022

Even newer Custom Firmware for Xiaomi Cameras based on Hi3518ev200 Chipset. It includes free RTSP, ONVIF and other improvements based on the work by roleoroleo

Even newer Custom Firmware for Xiaomi Cameras based on Hi3518ev200 Chipset. It includes free RTSP, ONVIF and other improvements based on the work by roleoroleo

Why this Yi-Hack-V5 firmware? The answer is simple: missing updates, RTSP and not based on the latest stock firmware (which features improvements and

Dec 30, 2022
theora-player is an embeddable theora video player C++ library based on the libtheora sample. It has no audio support at this moment.

theora-player Description theora-player is an embeddable theora video player C++ library based on the libtheora sample. It has no audio support at thi

Jun 18, 2022
A project for the latest Steam PC (US) release of Resident Evil 4 that patches the game to use high-quality MP4 video.

A project for the latest Steam PC (US) release of Resident Evil 4 that patches the game to use high-quality MP4 video.

Oct 10, 2022
A simple but powerful multimedia player library designed for Qt Quick.

QtMediaPlayer A simple but powerful multimedia player library designed for Qt Quick. Features Full-featured multimedia player Cross-platform: support

Nov 29, 2022
Jellyfin Desktop Client based on Plex Media Player
Jellyfin Desktop Client based on Plex Media Player

Desktop client using jellyfin-web with embedded MPV player. Supports Windows, Mac OS, and Linux. Media plays within the same window using the jellyfin-web interface unlike Jellyfin Desktop. Supports audio passthrough. Based on Plex Media Player.

Jan 1, 2023
Implement a universal video player based on FFmpeg

qiaopcmusic 实现一个万能视频播放器 添加依赖方式: To get a Git project into your build: Step 1. Add the JitPack repository to your build file Add it in your root build.

Oct 15, 2021
Console based Streaming Music Player [W.I.P]

?? quanta It's a command line music player that can streams same music to multiple devices, hence creating a surround sound system. Or just use it as

Jan 27, 2022
🎥 mpv is a free (as in freedom) media player for the command line.
🎥 mpv is a free (as in freedom) media player for the command line.

mpv is a free (as in freedom) media player for the command line. It supports a wide variety of media file formats, audio and video codecs, and subtitle types.

Jan 5, 2023
Video player for 3ds
Video player for 3ds

Video player for 3DS Patch note v1.0.1 Added allow skip frames option v1.0.0 Initial release Summary Video player for 3DS Performance 256x144(144p)@30

Jan 6, 2023
TIP (translate it, please) is a plugin for VLC media player that helps you to study languages by watching videos.

vlc-tip-plugin TIP (translate it, please) is a plugin for VLC media player that helps you to study languages by watching videos. Features The plugin a

Oct 11, 2022
GB Studio Extended Nominal Player Adaptation/Interface
GB Studio Extended Nominal Player Adaptation/Interface

gbsenpai gbsenpai - GB Studio Extended Nominal Player Adaptation/Interface - is a project to port the GB Studio player to additional, non-GB/GBC platf

Dec 8, 2022