继续看雷霄骅的 课程资料 - 基于FFmpeg+SDL的视频播放器的制作

前面用了五个篇幅来讲 FFmpeg,其主要目的是为实现将图片转视频的功能。

总的来说,对于 FFmepg 多少有一些了解了。但是源码部分还是一点都不清楚。接下来简单的梳理一下 FFmpeg 源码结构。毕竟现在从事的工作,不太偏重这个。等以后有机会再系统的研究吧。

ffmpeg再学习 -- Linux 安装说明

ffmpeg再学习 -- Windows下安装说明

ffmpeg再学习 -- 将 jpeg 转成 mp4

ffmpeg再学习 -- 硬件加速编解码

ffmpeg再学习 -- 视音频基础知识

一、FFmpeg 简介

参看:ffmpeg 源码
来来来,README。
FFmpeg是库和工具的集合来处理多媒体内容,如音频、视频、字幕和相关的元数据。

其包含的库有:

libavcodec         提供了更广泛的编解码器的实现。
libavformat        实现流协议,容器格式和基本I / O访问。
libavutil              包括哈希尔,解压缩器和杂项效用函数。
libavfilter            提供了通过一系列过滤器来改变已解码的音频和视频的意思。
libavdevice         提供了访问捕获和播放设备的抽象。
libswresample    实现音频混合和重采样程序。
libswscale           实现颜色转换和缩放程序。

工具

ffmpeg   是用于操纵,转换和流式传输多媒体内容的命令行工具箱。
ffplay      是一个简约的多媒体播放器。
ffprobe   是一种检查多媒体内容的简单分析工具。
ffserver   是一种多媒体流媒体服务器,用于直播。
其他小工具,如 aviocat,ismindex 和 qt-faststart。

二、FFmpeg 解码函数

FFmpeg解码函数简介

av_register_all()                         注册所有组件。
avformat_open_input()             打开输入视频文件。
avformat_find_stream_info()    获取视频文件信息。
avcodec_find_decoder()           查找解码器。
avcodec_open2()                      打开解码器。
av_read_frame()                       从输入文件读取一帧压缩数据。
avcodec_decode_video2()       解码一帧压缩数据。
avcodec_close()                       关闭解码器。
avformat_close_input()            关闭输入视频文件。

FFmpeg解码的流程图如下所示



源码解析

架构图】

FFmpeg源代码结构图 - 解码

FFmpeg源代码结构图 - 编码

【通用】

FFmpeg 源代码简单分析:av_register_all()

FFmpeg 源代码简单分析:avcodec_register_all()

FFmpeg 源代码简单分析:内存的分配和释放(av_malloc()、av_free()等)

FFmpeg 源代码简单分析:常见结构体的初始化和销毁(AVFormatContext,AVFrame等)

FFmpeg 源代码简单分析:avio_open2()

FFmpeg 源代码简单分析:av_find_decoder()和av_find_encoder()

FFmpeg 源代码简单分析:avcodec_open2()

FFmpeg 源代码简单分析:avcodec_close()

【解码】

图解FFMPEG打开媒体的函数avformat_open_input

FFmpeg 源代码简单分析:avformat_open_input()

FFmpeg 源代码简单分析:avformat_find_stream_info()

FFmpeg 源代码简单分析:av_read_frame()

FFmpeg 源代码简单分析:avcodec_decode_video2()

FFmpeg 源代码简单分析:avformat_close_input()

三、FFFmpeg解码的数据结构

可通过,转到定义(F12),来查看下面的结构体定义.

FFmpeg解码的数据结构如下所示


FFmpeg数据结构简介

AVFormatContext
    封装格式上下文结构体,也是统领全局的结构体,保存了视频文件封装格式相关信息。

  1. iformat:输入视频的AVInputFormat
  2. nb_streams :输入视频的AVStream 个数
  3. streams :输入视频的AVStream []数组
  4. duration :输入视频的时长(以微秒为单位)
  5. bit_rate :输入视频的码率
AVInputFormat
    每种封装格式(例如FLV, MKV, MP4, AVI)对应一个该结构体。
  1. name:封装格式名称
  2. long_name:封装格式的长名称
  3. extensions:封装格式的扩展名
  4. id:封装格式ID
  5. 一些封装格式处理的接口函数
AVStream
    视频文件中每个视频(音频)流对应一个该结构体。
  1. id:序号
  2. codec:该流对应的AVCodecContext
  3. time_base:该流的时基
  4. r_frame_rate 该流的帧率
AVCodecContext
    编码器上下文结构体,保存了视频(音频)编解码相关信息。
  1. codec:编解码器的AVCodec
  2. width, height:图像的宽高(只针对视频)
  3. pix_fmt:像素格式(只针对视频)
  4. sample_rate:采样率( 只针对音频)
  5. channels:声道数(只针对音频)
  6. sample_fmt:采样格式(只针对音频)
AVCodec
    每种视频(音频)编解码器(例如H.264解码器)对应一个该结构体。
  1. name:编解码器名称
  2. long_name:编解码器长名称
  3. type:编解码器类型
  4. id:编解码器ID
  5. 一些编解码的接口函数
AVPacket
    存储一帧压缩编码数据。
  1. pts:显示时间戳
  2. dts :解码时间戳
  3. data :压缩编码数据
  4. size :压缩编码数据大小
  5. stream_index :所属的AVStream
AVFrame
    存储一帧解码后像素(采样)数据。
  1. data:解码后的图像像素数据(音频采样数据)。
  2. linesize:对视频来说是图像中一行像素的大小;对音频来说是整个音频帧的大小。
  3. width, height:图像的宽高(只针对视频)。
  4. key_frame:是否为关键帧(只针对视频)
  5. pict_type:帧类型(只针对视频) 。例如I P B

四、解码示例

(1)源代码如下:

  1. /**
  2. * 最简单的基于FFmpeg的解码器
  3. * Simplest FFmpeg Decoder
  4. *
  5. * 雷霄骅 Lei Xiaohua
  6. * leixiaohua1020@126.com
  7. * 中国传媒大学/数字电视技术
  8. * Communication University of China / Digital TV Technology
  9. * http://blog.csdn.net/leixiaohua1020
  10. *
  11. * 本程序实现了视频文件的解码(支持HEVC,H.264,MPEG2等)。
  12. * 是最简单的FFmpeg视频解码方面的教程。
  13. * 通过学习本例子可以了解FFmpeg的解码流程。
  14. * This software is a simplest video decoder based on FFmpeg.
  15. * Suitable for beginner of FFmpeg.
  16. *
  17. */
  18.  
  19. #include <stdio.h>
  20. #include "stdafx.h"
  21.  
  22. #define __STDC_CONSTANT_MACROS
  23.  
  24. #ifdef _WIN32
  25. //Windows
  26. extern "C"
  27. {
  28. #include "libavcodec/avcodec.h"
  29. #include "libavformat/avformat.h"
  30. #include "libswscale/swscale.h"
  31. };
  32. #else
  33. //Linux...
  34. #ifdef __cplusplus
  35. extern "C"
  36. {
  37. #endif
  38. #include <libavcodec/avcodec.h>
  39. #include <libavformat/avformat.h>
  40. #include <libswscale/swscale.h>
  41. #ifdef __cplusplus
  42. };
  43. #endif
  44. #endif
  45.  
  46. int main(int argc, char* argv[])
  47. {
  48. AVFormatContext *pFormatCtx;
  49. int i, videoindex;
  50. AVCodecContext *pCodecCtx;
  51. AVCodec *pCodec;
  52. AVFrame *pFrame, *pFrameYUV;
  53. uint8_t *out_buffer;
  54. AVPacket *packet;
  55. int y_size;
  56. int ret, got_picture;
  57. struct SwsContext *img_convert_ctx;
  58. //输入文件路径
  59. char filepath[] = "Titanic.ts";
  60. //创建两个解码后的输出文件
  61. FILE *fp_yuv = fopen("output.yuv", "wb+");
  62. FILE *fp_h264 = fopen("output.h264", "wb+");
  63.  
  64. av_register_all();//注册所有组件
  65. avformat_network_init();//初始化网络
  66. pFormatCtx = avformat_alloc_context();//初始化一个AVFormatContext
  67.  
  68. if (avformat_open_input(&pFormatCtx, filepath, NULL, NULL) != 0) {//打开输入的视频文件
  69. printf("Couldn't open input stream.\n");
  70. return -1;
  71. }
  72. if (avformat_find_stream_info(pFormatCtx, NULL)<0) {//获取视频文件信息
  73. printf("Couldn't find stream information.\n");
  74. return -1;
  75. }
  76. videoindex = -1;
  77. for (i = 0; i < pFormatCtx->nb_streams; i++)
  78. {
  79. if (pFormatCtx->streams[i]->codec->codec_type == AVMEDIA_TYPE_VIDEO) {
  80. videoindex = i;
  81. break;
  82. }
  83. }
  84. if (videoindex == -1) {
  85. printf("Didn't find a video stream.\n");
  86. return -1;
  87. }
  88.  
  89. pCodecCtx = pFormatCtx->streams[videoindex]->codec;
  90. pCodec = avcodec_find_decoder(pCodecCtx->codec_id);//查找解码器
  91. if (pCodec == NULL) {
  92. printf("Codec not found.\n");
  93. return -1;
  94. }
  95. if (avcodec_open2(pCodecCtx, pCodec, NULL)<0) {//打开解码器
  96. printf("Could not open codec.\n");
  97. return -1;
  98. }
  99.  
  100. /*
  101. * 在此处添加输出视频信息的代码
  102. * 取自于pFormatCtx,使用fprintf()
  103. */
  104. FILE *fp = fopen("info.txt", "wb+");
  105. fprintf(fp,"时长:%d\n",pFormatCtx->duration);
  106. fprintf(fp,"封装格式:%s\n",pFormatCtx->iformat->long_name);
  107. fprintf(fp,"宽高:%d*%d\n",pFormatCtx->streams[videoindex]->codec->width, pFormatCtx->streams[videoindex]->codec->height);
  108.  
  109. pFrame = av_frame_alloc();
  110. pFrameYUV = av_frame_alloc();
  111. out_buffer = (uint8_t *)av_malloc(avpicture_get_size(PIX_FMT_YUV420P, pCodecCtx->width, pCodecCtx->height));
  112. avpicture_fill((AVPicture *)pFrameYUV, out_buffer, PIX_FMT_YUV420P, pCodecCtx->width, pCodecCtx->height);
  113. packet = (AVPacket *)av_malloc(sizeof(AVPacket));
  114. //Output Info-----------------------------
  115. printf("--------------- File Information ----------------\n");
  116. av_dump_format(pFormatCtx, 0, filepath, 0);
  117. printf("-------------------------------------------------\n");
  118. img_convert_ctx = sws_getContext(pCodecCtx->width, pCodecCtx->height, pCodecCtx->pix_fmt,
  119. pCodecCtx->width, pCodecCtx->height, PIX_FMT_YUV420P, SWS_BICUBIC, NULL, NULL, NULL);
  120.  
  121. int frame_cnt=0;
  122. while (av_read_frame(pFormatCtx, packet) >= 0) {//读取一帧压缩数据
  123. if (packet->stream_index == videoindex) {
  124. /*
  125. * 在此处添加输出H264码流的代码
  126. * 取自于packet,使用fwrite()
  127. */
  128. fwrite(packet->data, 1, packet->size, fp_h264); //把H264数据写入fp_h264文件
  129.  
  130. ret = avcodec_decode_video2(pCodecCtx, pFrame, &got_picture, packet);//解码一帧压缩数据
  131. if (ret < 0) {
  132. printf("Decode Error.\n");
  133. return -1;
  134. }
  135. if (got_picture) {
  136. sws_scale(img_convert_ctx, (const uint8_t* const*)pFrame->data, pFrame->linesize, 0, pCodecCtx->height,
  137. pFrameYUV->data, pFrameYUV->linesize);
  138.  
  139. y_size = pCodecCtx->width*pCodecCtx->height;
  140. /*
  141. * 在此处添加输出YUV的代码
  142. * 取自于pFrameYUV,使用fwrite()
  143. */
  144. printf("Decoded frame index: %d\n", frame_cnt);
  145.  
  146. fwrite(pFrameYUV->data[0], 1, y_size, fp_yuv); //Y
  147. fwrite(pFrameYUV->data[1], 1, y_size / 4, fp_yuv); //U
  148. fwrite(pFrameYUV->data[2], 1, y_size / 4, fp_yuv); //V
  149.  
  150. frame_cnt++;
  151.  
  152. }
  153. }
  154. av_free_packet(packet);
  155. }
  156.  
  157. //flush decoder
  158. //FIX: Flush Frames remained in Codec
  159. int frame_cnt1 = 0;
  160. while (1) {
  161. ret = avcodec_decode_video2(pCodecCtx, pFrame, &got_picture, packet);
  162. if (ret < 0)
  163. break;
  164. if (!got_picture)
  165. break;
  166. sws_scale(img_convert_ctx, (const uint8_t* const*)pFrame->data, pFrame->linesize, 0, pCodecCtx->height,
  167. pFrameYUV->data, pFrameYUV->linesize);
  168.  
  169. int y_size = pCodecCtx->width*pCodecCtx->height;
  170. printf("Flush Decoder: %d\n", frame_cnt1);
  171. fwrite(pFrameYUV->data[0], 1, y_size, fp_yuv); //Y
  172. fwrite(pFrameYUV->data[1], 1, y_size / 4, fp_yuv); //U
  173. fwrite(pFrameYUV->data[2], 1, y_size / 4, fp_yuv); //V
  174. frame_cnt1++;
  175. }
  176.  
  177. sws_freeContext(img_convert_ctx);
  178.  
  179. //关闭文件以及释放内存
  180. fclose(fp_yuv);
  181. fclose(fp_h264);
  182.  
  183. av_frame_free(&pFrameYUV);
  184. av_frame_free(&pFrame);
  185. avcodec_close(pCodecCtx);
  186. avformat_close_input(&pFormatCtx);
  187.  
  188. return 0;
  189. }

(2)项目下载

(3)项目说明

使用 MediaInfo 软件查看 Titanic.ts 视频信息


查看调式生成 info.txt 可看出对应的视频信息


通过 YUV播放器 和 CyberLink PowerDVD 14 查看生成的视频。


五、后续总结

(1)flush_decoder作用

当av_read_frame()循环退出的时候,实际上解码器中可能还包含剩余的几帧数据。因此需要通过“flush_decoder”将这几帧数据输出。“flush_decoder”功能简而言之即直接调用avcodec_decode_video2()获得AVFrame,而不再向解码器传递AVPacket。
具体原因:
打断点也可以看到,确实有几帧是之前没有打印出来的。

(2)解码后的数据为什么要经过sws_scale()函数处理?

解码后 YUV 格式的视频像素数据保存在 AVFrame 的 data[0]、 data[1]、data[2] 中。 但是这些像素值并不是连续存储的, 每行有效像素之后存储了一些无效像素 。以亮度 Y 数据为例,data[0] 中一共包含了 linesize[0]*height 个数据。 但是出于优化等方面的考虑, linesize[0 ]实际上并不等于宽度 width, 而是一个比宽度大一些的值。 因此需要使用 sws_scale() 进行转换。 转换后去除了无效数据, width 和 linesize[0] 取值相等。

(3)源码示例

源码中也是有示例的,查看 FFmpeg/doc/examples/


查看 decode_video.c 源码:

  1. /*
  2. * Copyright (c) 2001 Fabrice Bellard
  3. *
  4. * Permission is hereby granted, free of charge, to any person obtaining a copy
  5. * of this software and associated documentation files (the "Software"), to deal
  6. * in the Software without restriction, including without limitation the rights
  7. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  8. * copies of the Software, and to permit persons to whom the Software is
  9. * furnished to do so, subject to the following conditions:
  10. *
  11. * The above copyright notice and this permission notice shall be included in
  12. * all copies or substantial portions of the Software.
  13. *
  14. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
  17. * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  18. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  19. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  20. * THE SOFTWARE.
  21. */
  22.  
  23. /**
  24. * @file
  25. * video decoding with libavcodec API example
  26. *
  27. * @example decode_video.c
  28. */
  29.  
  30. #include <stdio.h>
  31. #include <stdlib.h>
  32. #include <string.h>
  33.  
  34. #include <libavcodec/avcodec.h>
  35.  
  36. #define INBUF_SIZE 4096
  37.  
  38. static void pgm_save(unsigned char *buf, int wrap, int xsize, int ysize,
  39. char *filename)
  40. {
  41. FILE *f;
  42. int i;
  43.  
  44. f = fopen(filename,"w");
  45. fprintf(f, "P5\n%d %d\n%d\n", xsize, ysize, 255);
  46. for (i = 0; i < ysize; i++)
  47. fwrite(buf + i * wrap, 1, xsize, f);
  48. fclose(f);
  49. }
  50.  
  51. static int decode_write_frame(const char *outfilename, AVCodecContext *avctx,
  52. AVFrame *frame, int *frame_count, AVPacket *pkt, int last)
  53. {
  54. int len, got_frame;
  55. char buf[1024];
  56.  
  57. len = avcodec_decode_video2(avctx, frame, &got_frame, pkt);
  58. if (len < 0) {
  59. fprintf(stderr, "Error while decoding frame %d\n", *frame_count);
  60. return len;
  61. }
  62. if (got_frame) {
  63. printf("Saving %sframe %3d\n", last ? "last " : "", *frame_count);
  64. fflush(stdout);
  65.  
  66. /* the picture is allocated by the decoder, no need to free it */
  67. snprintf(buf, sizeof(buf), "%s-%d", outfilename, *frame_count);
  68. pgm_save(frame->data[0], frame->linesize[0],
  69. frame->width, frame->height, buf);
  70. (*frame_count)++;
  71. }
  72. if (pkt->data) {
  73. pkt->size -= len;
  74. pkt->data += len;
  75. }
  76. return 0;
  77. }
  78.  
  79. int main(int argc, char **argv)
  80. {
  81. const char *filename, *outfilename;
  82. const AVCodec *codec;
  83. AVCodecContext *c= NULL;
  84. int frame_count;
  85. FILE *f;
  86. AVFrame *frame;
  87. uint8_t inbuf[INBUF_SIZE + AV_INPUT_BUFFER_PADDING_SIZE];
  88. AVPacket avpkt;
  89.  
  90. if (argc <= 2) {
  91. fprintf(stderr, "Usage: %s <input file> <output file>\n", argv[0]);
  92. exit(0);
  93. }
  94. filename = argv[1];
  95. outfilename = argv[2];
  96.  
  97. avcodec_register_all();
  98.  
  99. av_init_packet(&avpkt);
  100.  
  101. /* set end of buffer to 0 (this ensures that no overreading happens for damaged MPEG streams) */
  102. memset(inbuf + INBUF_SIZE, 0, AV_INPUT_BUFFER_PADDING_SIZE);
  103.  
  104. /* find the MPEG-1 video decoder */
  105. codec = avcodec_find_decoder(AV_CODEC_ID_MPEG1VIDEO);
  106. if (!codec) {
  107. fprintf(stderr, "Codec not found\n");
  108. exit(1);
  109. }
  110.  
  111. c = avcodec_alloc_context3(codec);
  112. if (!c) {
  113. fprintf(stderr, "Could not allocate video codec context\n");
  114. exit(1);
  115. }
  116.  
  117. if (codec->capabilities & AV_CODEC_CAP_TRUNCATED)
  118. c->flags |= AV_CODEC_FLAG_TRUNCATED; // we do not send complete frames
  119.  
  120. /* For some codecs, such as msmpeg4 and mpeg4, width and height
  121. MUST be initialized there because this information is not
  122. available in the bitstream. */
  123.  
  124. /* open it */
  125. if (avcodec_open2(c, codec, NULL) < 0) {
  126. fprintf(stderr, "Could not open codec\n");
  127. exit(1);
  128. }
  129.  
  130. f = fopen(filename, "rb");
  131. if (!f) {
  132. fprintf(stderr, "Could not open %s\n", filename);
  133. exit(1);
  134. }
  135.  
  136. frame = av_frame_alloc();
  137. if (!frame) {
  138. fprintf(stderr, "Could not allocate video frame\n");
  139. exit(1);
  140. }
  141.  
  142. frame_count = 0;
  143. for (;;) {
  144. avpkt.size = fread(inbuf, 1, INBUF_SIZE, f);
  145. if (avpkt.size == 0)
  146. break;
  147.  
  148. /* NOTE1: some codecs are stream based (mpegvideo, mpegaudio)
  149. and this is the only method to use them because you cannot
  150. know the compressed data size before analysing it.
  151.  
  152. BUT some other codecs (msmpeg4, mpeg4) are inherently frame
  153. based, so you must call them with all the data for one
  154. frame exactly. You must also initialize 'width' and
  155. 'height' before initializing them. */
  156.  
  157. /* NOTE2: some codecs allow the raw parameters (frame size,
  158. sample rate) to be changed at any frame. We handle this, so
  159. you should also take care of it */
  160.  
  161. /* here, we use a stream based decoder (mpeg1video), so we
  162. feed decoder and see if it could decode a frame */
  163. avpkt.data = inbuf;
  164. while (avpkt.size > 0)
  165. if (decode_write_frame(outfilename, c, frame, &frame_count, &avpkt, 0) < 0)
  166. exit(1);
  167. }
  168.  
  169. /* Some codecs, such as MPEG, transmit the I- and P-frame with a
  170. latency of one frame. You must do the following to have a
  171. chance to get the last frame of the video. */
  172. avpkt.data = NULL;
  173. avpkt.size = 0;
  174. decode_write_frame(outfilename, c, frame, &frame_count, &avpkt, 1);
  175.  
  176. fclose(f);
  177.  
  178. avcodec_free_context(&c);
  179. av_frame_free(&frame);
  180.  
  181. return 0;
  182. }

编译:

make 编译会出现如下错误:
  1. Package libavdevice was not found in the pkg-config search path.
  2. Perhaps you should add the directory containing `libavdevice.pc'
  3. to the PKG_CONFIG_PATH environment variable
  4. No package 'libavdevice' found
查看 README,有一种方法:
  1. Method 1: build the installed examples in a generic read/write user directory
  2.  
  3. Copy to a read/write user directory and just use "make", it will link
  4. to the libraries on your system, assuming the PKG_CONFIG_PATH is
  5. correctly configured.
意思就是配置 PKG_CONFIG_PATH 库位置

解决方法:
  1. /etc/profile 最后添加:
  2. export PKG_CONFIG_PATH=/usr/local/ffmpeg/lib/pkgconfig:$PKG_CONFIG_PATH
  3.  
  4. 执行: source /etc/profile
  5. 立即生效

然后再 make 编译,生成文件:

FFmpeg再学习 -- FFmpeg解码知识的更多相关文章

  1. FFmpeg再学习 -- FFmpeg+SDL+MFC实现图形界面视频播放器

    继续看雷霄骅的 课程资料 - 基于FFmpeg+SDL的视频播放器的制作最后一篇,主要是想学一下 MFC 创建和配置. 一.创建 MFC 工程 文件->新建->项目->Visual ...

  2. FFmpeg再学习 -- SDL 环境搭建和视频显示

    继续看雷霄骅的 课程资料 - 基于FFmpeg+SDL的视频播放器的制作 一.SDL 简介 参看:WIKI -- Simple DirectMedia Layer 参看:最简单的视音频播放示例9:SD ...

  3. FFmpeg再学习 -- 硬件加速编解码

    为了搞硬件加速编解码,用了一周时间来看 CUDA,接下来开始加以总结. 一.什么是 CUDA (1)首先需要了解一下,什么是 CUDA. 参看:百度百科 -- CUDA 参看:CUDA基础介绍 参看: ...

  4. FFmpeg再学习 -- 视音频基础知识

    最近一直在看雷霄骅 FFmpeg 系列视频,然后将自己的理解总结一下. 参看:<基于 FFmpeg + SDL 的视频播放器的制作>课程的视频 一.视频播放器原理 自己理解: 比如一个 M ...

  5. 【转】学习FFmpeg API – 解码视频

    ffmpeg是编解码的利器,用了很久,以前看过dranger 的教程,非常精彩,受益颇多,是学习ffmpeg api很好的材料.可惜的是其针对的ffmpeg版本已经比较老了,而ffmpeg的更新又很快 ...

  6. [转]FFMPEG视音频编解码零基础学习方法

    在CSDN上的这一段日子,接触到了很多同行业的人,尤其是使用FFMPEG进行视音频编解码的人,有的已经是有多年经验的“大神”,有的是刚开始学习的初学者.在和大家探讨的过程中,我忽然发现了一个问题:在“ ...

  7. [总结]FFMPEG视音频编解码零基础学习方法--转

    ffmpeg编解码学习   目录(?)[-] ffmpeg程序的使用ffmpegexeffplayexeffprobeexe 1 ffmpegexe 2 ffplayexe 3 ffprobeexe ...

  8. FFMPEG视音频编解码零基础学习方法

    在CSDN上的这一段日子,接触到了很多同行业的人,尤其是使用FFMPEG进行视音频编解码的人,有的已经是有多年经验的“大神”,有的是刚开始学习的初学者.在和大家探讨的过程中,我忽然发现了一个问题:在“ ...

  9. FFMPEG视音频编解码零基础学习方法-b

    感谢大神分享,虽然现在还看不懂,留着大家一起看啦 PS:有不少人不清楚“FFmpeg”应该怎么读.它读作“ef ef em peg” 0. 背景知识 本章主要介绍一下FFMPEG都用在了哪里(在这里仅 ...

随机推荐

  1. raid 简单了解

    独立硬盘冗余阵列(RAID, Redundant Array of Independent Disks),旧称廉价磁盘冗余阵列(Redundant Array of Inexpensive Disks ...

  2. 20145324 《Java程序设计》第6周学习总结

    20145324 <Java程序设计>第6周学习总结 教材学习内容总结 第十章 1.使用输入串流将数据从来源取出 InputStream 使用输出串流将数据写入目的地 OutStream ...

  3. STC51六中中断配置点亮一个LED

    一.外部中断0.1(分别點亮一個LED) /****************************************************************************** ...

  4. TortoiseSVN忽略文件夹

    因为平时要做一些主干.分支的版本控制,发布增量补丁包工作,所以经常使用TortoiseSVN客户端.当然,eclipse中也安装了SVN插件,不过在打补丁方面感觉不如客户端.现在遇到了一个问题:同一项 ...

  5. [Pytorch]Pytorch 保存模型与加载模型(转)

    转自:知乎 目录: 保存模型与加载模型 冻结一部分参数,训练另一部分参数 采用不同的学习率进行训练 1.保存模型与加载 简单的保存与加载方法: # 保存整个网络 torch.save(net, PAT ...

  6. 【Network Architecture】Densely Connected Convolutional Networks 论文解析

    目录 0. Paper link 1. Overview 2. DenseNet Architecture 2.1 Analogy to ResNet 2.2 Composite function 2 ...

  7. i++为什么是线程不安全的

    主要是因为i++这个操作不是原子性的,它会编译成 i = i +1: 其实是做了3个步骤,一个是读取,修改,写入 .所以会出现多线程访问冲突问题. 可以结合Java内存模型来进行说明.

  8. (转)SQL Server中的索引结构与疑惑

    说实话我从没有在实际项目中使用过索引,仅知道索引是一个相当重要的技术点,因此我也看了不少文章知道了索引的区别.分类.优缺点以及如何使用索引.但关于索引它最本质的是什么笔者一直没明白,本文是笔者带着这些 ...

  9. MongoDB基于GridFS管理文件

    前言 GridFS是一种将大型文件存储在MongoDB的文件规范: 数据库支持以BSON格式保存二进制对象. 但是MongoDB中BSON对象最大不能超过4MB. GridFS 规范提供了一种透明的机 ...

  10. App压力测试MonkeyRunner整理

    压力测试结果:CRASH:崩溃,应用程序在使用过程中,非正常退出ANR:Application Not Responding 命令很多,不用死记,用到复制.粘贴就行,达到目的最重要. 简单通俗易懂点讲 ...