Android音视频学习思路整理

音视频学习有好多文章,但是很多都是非常杂乱,整理了一下网上学习的比较有用的文章,学习思路可以按这个链接下来学习:

【Android 音视频开发打怪升级:音视频硬解码篇】一、音视频基础知识 - 掘金

整理的很到位,包括基础,OpenGL,ffmpeg。就是代码是 kotlin,可以花一天时间入个门,代码就能看懂。

实在看不懂的,可以按照他的目录作为学习思路,百度文章来看。

可以看上面文章中的概念,然后代码看下面的整理用 java 来学习音视频。

关于摄像头学习

参考这个,语言是java,这里面整理了一系列:

Camera开发系列之一 显示摄像头实时画面 - 掘金

关于OpenGL学习

热门专题 - OpenGL ES - 玩Android - wanandroid.com

里面有OpenGL的基础,OpenGL入门画三角形简单,面向过程的思维和复杂的渲染流程让用户用起来难以扩展。要死记住渲染流程。

了解之后可以用 OpenGL 来录制视频,代码是java的:
Android视频编辑器(一)通过OpenGL预览、录制视频以及断点续录等_qqchenjian318的博客-CSDN博客_opengl 编辑器

关于ffmpeg学习

Android使用FFmpeg(一)--编译ffmpeg - 简书

里面有完成ffmpeg学习过程,代码是java的,学习不要卡在ffmpeg编译,编译不过去可以跳过。直接看后面就可以。

一些有帮助的文章与教程

下面是我近年来学习的所有文章,有OpenGL,ffmpeg,mediacodec,gpuimage,OpenCV,WebRtc,还有很厉害的项目:CainCamera。里面也有不少已经失效的网址。。


OpenGL ES、OpenSL ES、OpenCV、WebRtc、SDL、SoundPool

常见问题:
图解YU12、I420、YV12、NV12、NV21、YUV420P、YUV420SP、YUV422P、YUV444P的区别:
https://blog.csdn.net/byhook/article/details/84037338

读完这篇文章,你就能全面掌握做视频码率设置:
https://www.bilibili.com/read/cv10439183/

Android 录屏时控制帧率:
https://www.jianshu.com/p/f2e4db2fb211
https://blog.csdn.net/chailongger/article/details/83653652

MediaCodec编码H264视频模糊、花屏:
https://www.jianshu.com/p/a0873b4a92b6

MediaCodec的bitrate_mode配置问题:
https://blog.csdn.net/kris_fei/article/details/73527630

H264三种码率控制方法(CBR, VBR, CVBR):
https://blog.csdn.net/szfhy/article/details/50820119

H264编码中Baseline Main High简介:
https://blog.csdn.net/yangzhenhui/article/details/104298335

H264系列十二 H.264概述:
https://www.jianshu.com/p/2ff4b2e865a3

浅谈TMPGEnc中码率控制的模式(CBR/VBR/CQ):
https://www.dianbo.org/forum.php?mod=viewthread&tid=1288

===========================================

Android视频编辑器(一)通过OpenGL预览、录制视频以及断点续录等
https://blog.csdn.net/qqchenjian318/article/details/77396653

FFmpeg与OpenGL: https://cloud.tencent.com/developer/user/2061724
https://juejin.cn/post/6844903949451919368
https://github.com/ChenLittlePing/LearningVideo/tree/79e94cf5e35664e6dd2e1d595e2ec633f14acf22

OpenGL :https://zhuanlan.zhihu.com/p/150528739
OpenGL :https://blog.csdn.net/Kennethdroid/article/details/106844678?spm=1001.2014.3001.5501
FFmpeg 视频教程:
链接:https://pan.baidu.com/s/1juUEAMXBeVhQfvvMCUMz4g 
提取码:zjld 

NDK 视频教程:
链接:https://pan.baidu.com/s/1XYBKWx9wV-V9wR7P5jPKWA 
提取码:zjld 

OpenGL ES 视频教程:
链接:https://pan.baidu.com/s/1ax3NMoT0A8GohUgOw8uqhQ 
提取码:zjld

音视频相关资料和视频教程
链接: https://pan.baidu.com/s/1sQQo0Mq7gJcAYz8GTMLuPQ 
提取码: s2w3

视频录制编码解码:http://vivianking6855.github.io/2017/06/19/Android-Vedio-merge-Music/

Camera学习:https://juejin.im/post/5b1e9d2b6fb9a01e4320d0ad

Ffmpeg :官网:https://www.ffmpeg.org/

Ffmpeg 学习:https://www.jianshu.com/p/1bfece62c937

Ffmpeg github可使用的demo:https://github.com/coopsrc/FFPlayerDemo
        https://github.com/jdpxiaoming/PPlayer

ffmpeg采集nv21数据编码:
https://blog.csdn.net/byhook/article/details/84504670

直播实现:https://blog.csdn.net/Mr_Sk/article/details/71083366
srs环境搭建:https://www.jianshu.com/p/60f2ee64137c
srs环境搭建参考:https://blog.csdn.net/qq_24904667/article/details/80063031

webrtc:https://blog.csdn.net/youmingyu/article/details/53192714

OpenCV:https://www.w3cschool.cn/opencv/opencv-2gnx28u3.html

Android推拉流,直播功能:https://blog.csdn.net/Mr_Sk/article/details/71083366

Android音视频编解码MediaCodec:https://www.jianshu.com/p/aac2f8699735

Android音频录制转码可视化等相关:https://www.jianshu.com/p/a72deab95b4c

rtmp推流介绍:https://www.jianshu.com/p/fedfeef4ed8f
https://blog.csdn.net/ai2000ai/article/details/85095835

手机内录和外录:https://www.tuicool.com/articles/RVJFF3v

ffmpeg命令(全):https://blog.csdn.net/kingvon_liwei/article/details/79271361

Github音频文件转码:https://github.com/adrielcafe/AndroidAudioConverter

Android Ndk交叉编译ffmpeg,辉天神龙:
https://xucanhui.com/2018/07/22/android-ndk-ffmpeg-compile/
ffmpeg编译为一个so库:
https://www.jianshu.com/p/9ec753a7204e

Mp3 lame编译:
https://www.jianshu.com/p/d5c5dae3ac9c

Android利用lame录制mp3音频:
https://github.com/clam314/LameMp3ForAndroid

音视频学习汇总
https://www.cnblogs.com/renhui/p/7452572.html

//github音视频学习
https://github.com/979451341/Audio-and-video-learning-materials

OpenGL ES学习
https://www.wanandroid.com/article/list/0?cid=159

Android OpenGL添加水印并录制视频--抖音视频录制原理
https://blog.csdn.net/csqingchen/article/details/105492716

OpenGL.ES在Android上的简单实践:21-水印录制(MediaCodec输出h264+MediaMuxer合成mp4 上):
https://github.com/ChenLittlePing/LearningVideo

FFmpeg库的使用。
https://github.com/NearXxx/FFmpegAndroid

音视频学习日志,OpenGL ,ffmpeg ,ndk:
https://blog.csdn.net/a360940265a

Android图像滤镜框架GPUImage从配置到应用:
https://blog.csdn.net/it_zjyang/article/details/52268918

android 录制视频,使用OpenGL:
https://github.com/ICECHN/VideoRecorderWithOpenGL

CainCamera 介绍
CainCamera是一个集美颜相机、图片编辑、短视频编辑等功能的综合性开源APP,目前主要介绍美颜相机、短视频编辑功能的实现,图片编辑功能暂时还没时间处理。 本人编写该项目主要用于学习如何实现相机的实时美颜、动态滤镜、动态贴纸、彩妆、拍照、短视频分段录制与回删、图片编辑、短时频编辑与合成等功能:
https://github.com/CainKernel/CainCamera

- Camera

    [Android相机开发系列](https://www.polarxiong.com/archives/Android%E7%9B%B8%E6%9C%BA%E5%BC%80%E5%8F%91%E7%B3%BB%E5%88%97.html)

- graphics

    [Android图形架构](https://source.android.com/devices/graphics/architecture)

- OpenGLES

    [learnopengl-cn](https://learnopengl-cn.github.io/)

    [opengl-tutorial-cn](http://www.opengl-tutorial.org/cn/)

    [coordinate-mapping](https://developer.android.com/guide/topics/graphics/opengl#coordinate-mapping)

    [安卓 OpenGL ES 2.0 完全入门 一](https://blog.piasy.com/2016/06/07/Open-gl-es-android-2-part-1/)

    [安卓 OpenGL ES 2.0 完全入门 二](https://blog.piasy.com/2016/06/14/Open-gl-es-android-2-part-2/)

    [安卓 OpenGL ES 2.0 完全入门 三](https://blog.piasy.com/2017/10/06/Open-gl-es-android-2-part-3/)


    [OpenGL ES和坐标变换概述 一](http://zhangtielei.com/posts/blog-opengl-transformations-1.html)

    [OpenGL ES和坐标变换概述 二](http://zhangtielei.com/posts/blog-opengl-transformations-2.html)

    [http://www.songho.ca/opengl/index.html](http://www.songho.ca/opengl/index.html)

    [surfaceTexture#getTransformMatrix什么意思](https://stackoverflow.com/questions/30595493/what-does-the-return-value-of-surfacetexture-gettransformmatrix-mean-who-can-ex)


- PixelBufferObject

    [glReadPixels](https://www.khronos.org/opengl/wiki/GLAPI/glReadPixels)

    [Android 关于美颜/滤镜 利用PBO从OpenGL录制视频](https://www.jianshu.com/p/3bc4db687546)

    [gl_pbo](http://www.songho.ca/opengl/gl_pbo.html)

    [fast-pixel-transfers-with-pixel-buffer-objects](http://roxlu.com/2014/048/fast-pixel-transfers-with-pixel-buffer-objects)

    [像素缓冲对象](https://www.khronos.org/opengl/wiki/Pixel_Buffer_Object)

    [像素传输](https://www.khronos.org/opengl/wiki/Pixel_Transfer#Pixel_transfer_parameters)

- 音频采集

    [快速处理实时麦克风音频,设置回调功能](https://stackoverflow.com/questions/4525206/android-audiorecord-class-process-live-mic-audio-quickly-set-up-callback-func/4834651#4834651)

    [https://blog.csdn.net/flowingflying/article/details/39576701](https://blog.csdn.net/flowingflying/article/details/39576701)

    [https://github.com/Kickflip/kickflip-android-sdk/issues/9](https://github.com/Kickflip/kickflip-android-sdk/issues/9)

    [android-dev-audiorecord-without-blocking-or-threads](https://stackoverflow.com/questions/15804903/android-dev-audiorecord-without-blocking-or-threads)

    [https://issuetracker.google.com/issues/36968761](https://issuetracker.google.com/issues/36968761)

- 编码

    [Android MediaCodec stuff](https://bigflake.com/mediacodec/)

    [MediaCodec](https://developer.android.com/reference/android/media/MediaCodec)

    [MediaMuxer](https://developer.android.com/reference/android/media/MediaMuxer)

    [optimizing-mediamuxers-writing-speed](https://blog.horizon.camera/post/134263616000/optimizing-mediamuxers-writing-speed)

    [安卓视频硬编码实现分析三](https://blog.piasy.com/2017/08/08/WebRTC-Android-HW-Encode-Video/)

    [我需要知道:H.264](https://blog.piasy.com/2017/09/22/I-Need-Know-About-H264/)

- 加水印

   [how-to-embed-text-while-recording-video-in-android](https://stackoverflow.com/questions/23735464/how-to-embed-text-while-recording-video-in-android)

   [media-for-mobile/blob/master/effects/src/main/java/org/m4m/effects/TextOverlayEffect.java](https://github.com/INDExOS/media-for-mobile/blob/master/effects/src/main/java/org/m4m/effects/TextOverlayEffect.java)

   [纹理翻转](https://stackoverflow.com/questions/7811195/must-opengl-textures-be-flipped?rq=1)

- 拍照相关

    [简化的Windows BMP位图文件格式规范](http://www.dragonwins.com/domains/getteched/bmp/bmpfileformat.htm)


    [保存一帧数据](https://stackoverflow.com/questions/21634450/how-can-we-make-the-saveframe-method-in-extractmpegframestest-more-efficient)

    [takePirture图片翻转的问题](https://stackoverflow.com/questions/28350695/flipping-opengl-texture-from-bytebuffer-before-creating-the-bitmap-in-android)

- 相关项目

   [grafika](https://github.com/google/grafika)

   [FilterRecord](https://github.com/a483210/myExample) 成功的使用出了PBO异步 glReadPixel , 读取耗时非常小

   [android-gpuimage-plus](https://github.com/wysaid/android-gpuimage-plus)

   [AudioVideoRecordingSample](https://github.com/saki4510t/AudioVideoRecordingSample)

   [media-for-mobile](https://github.com/INDExOS/media-for-mobile)

- 图像处理

   [Kernel (image_processing)](https://en.wikipedia.org/wiki/Kernel_(image_processing))

## Android Camera OpenGL添加水印并录制视频
>- 简单的视频录制,我们可以使用[MediaRecorder](https://developer.android.com/reference/android/media/MediaRecorder),具体示例可以参考[Gitee: Camera2VideoJava](https://gitee.com/chenjim/CameraDemo/tree/master/Camera2VideoJava)
>- 本文将介绍采集Camera的预览数据,然后通过[OpenGL](https://developer.android.com/guide/topics/graphics/opengl)添加水印、贴纸、美颜滤镜等后渲染到[GLSurfaceView](https://developer.android.com/reference/android/opengl/GLSurfaceView),再用[MediaCodec](https://developer.android.com/reference/android/media/MediaCodec)硬编码后通过[MediaMuxer](https://developer.android.com/reference/android/media/MediaMuxer)写入MP4文件。
> 源码地址: [Gitee: OpenGLRecorder](https://gitee.com/chenjim/CameraDemo/tree/master/OpenGLRecorder)

大致流程如下,详细可以参见相应代码连接
1. [CameraGlView](https://gitee.com/chenjim/CameraDemo/blob/master/OpenGLRecorder/app/src/main/java/com/chenjim/glrecorder/CameraGlView.java) 用来显示Camera预览的View
CameraGlView extends GLSurfaceView
2. 创建SurfaceTexture,用来显示Camera预览,参见[CameraRenderer.java](https://gitee.com/chenjim/CameraDemo/blob/master/OpenGLRecorder/app/src/main/java/com/chenjim/glrecorder/CameraRenderer.java)
mSurfaceTexture = new SurfaceTexture(mTextures[0]);
...
mCameraHelper.startPreview(mSurfaceTexture);

3. [CameraFilter.java](https://gitee.com/chenjim/CameraDemo/blob/master/OpenGLRecorder/app/src/main/java/com/chenjim/glrecorder/filter/CameraFilter.java),通过OpenGL将Camera数据写入FBO(Frame Buffer Object 帧缓存)
4. [TimeFilter.java](https://gitee.com/chenjim/CameraDemo/blob/master/OpenGLRecorder/app/src/main/java/com/chenjim/glrecorder/filter/TimeFilter.java),通过OpenGL在FBO上添加时间水印。
可以参考此处添加贴纸、美颜等
5. [ScreenFilter.java](https://gitee.com/chenjim/CameraDemo/blob/master/OpenGLRecorder/app/src/main/java/com/chenjim/glrecorder/filter/ScreenFilter.java),将FBO绘制到mSurfaceTexture
6. [MediaRecorder.java](https://gitee.com/chenjim/CameraDemo/blob/master/OpenGLRecorder/app/src/main/java/com/chenjim/glrecorder/MediaRecorder.java),用MediaCodec和EGL对Surface的内容采集编码为avc并写入到MP4文件


参考文章:
- [OpenGL ES SDK for Android: High Quality Text Rendering](https://arm-software.github.io/opengl-es-sdk-for-android/high_quality_text.html)
- [Github:opengl-es-sdk-for-android/HighQualityTextJava](https://github.com/ARM-software/opengl-es-sdk-for-android/tree/master/samples/advanced_samples/HighQualityTextJava)
- [Github:android-openGL-canvas](https://github.com/ChillingVan/android-openGL-canvas)
- [Github:Media for Mobile is a set of easy to use components and API for a wide range of media scenarios such as video editing and capturing](https://github.com/INDExOS/media-for-mobile)
- [VideoRecorder高性能任意尺寸视频录制 断点录制 离屏录制 ](https://github.com/lll-01/VideoRecorder) 录制时的Canvas API支持 实时滤镜,[相关资料介绍Link](https://github.com/lll-01/VideoRecorder/blob/master/app/doc/%E7%9B%B8%E5%85%B3%E8%B5%84%E6%96%99.md)
- [抖音录制视频预习资料](https://www.jianshu.com/p/6aaa44072272)

你可能感兴趣的:(Android音视频开发,音视频,android,学习)