使用FFmpeg新解码API解封装解码音视频(代码实例)

简介: 在ffmpeg的源代码中,有新旧版本的编解码接口调用示例,但是demux、mux然后decode、encode的联动起来的接口调用实例并没有,在使用旧版本的编解码接口在编译时会报接口弃用告警信息,所以最好尽快把原有的调用方式切换到新的编解码接口调用方式,告警信息如下: ...
在ffmpeg的源代码中,有新旧版本的编解码接口调用示例,但是demux、mux然后decode、encode的联动起来的接口调用实例并没有,在使用旧版本的编解码接口在编译时会报接口弃用告警信息,所以最好尽快把原有的调用方式切换到新的编解码接口调用方式,告警信息如下:

点击(此处)折叠或打开

  1. liuqideMBP:xxx liuqi$ make doc/examples/demuxing_decoding
  2. CC doc/examples/demuxing_decoding.o
  3. src/doc/examples/demuxing_decoding.c:73:15: warning: 'avcodec_decode_video2' is deprecated [-Wdeprecated-declarations]
  4.         ret = avcodec_decode_video2(video_dec_ctx, frame, got_frame, &pkt);
  5.               ^
  6. src/libavcodec/avcodec.h:4631:1: note: 'avcodec_decode_video2' has been explicitly marked deprecated here
  7. attribute_deprecated
  8. ^
  9. src/libavutil/attributes.h:94:49: note: expanded from macro 'attribute_deprecated'
  10. # define attribute_deprecated __attribute__((deprecated))
  11.                                                 ^
  12. src/doc/examples/demuxing_decoding.c:111:15: warning: 'avcodec_decode_audio4' is deprecated [-Wdeprecated-declarations]
  13.         ret = avcodec_decode_audio4(audio_dec_ctx, frame, got_frame, &pkt);
  14.               ^
  15. src/libavcodec/avcodec.h:4582:1: note: 'avcodec_decode_audio4' has been explicitly marked deprecated here
  16. attribute_deprecated
  17. ^
  18. src/libavutil/attributes.h:94:49: note: expanded from macro 'attribute_deprecated'
  19. # define attribute_deprecated __attribute__((deprecated))
  20.                                                 ^
  21. 2 warnings generated.
  22. LD doc/examples/demuxing_decoding_g
  23. ld: warning: directory not found for option '-Llibavresample'
  24. STRIP doc/examples/demuxing_decoding
为了修改方便,而网上又没有只管举例的相关完整的实例,所以在这里写一个例子,供大伙参考


  1. /*
  2.  * Copyright (c) 2017 bbs.chinaffmpeg.com 孙悟空
  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.  * Demuxing and decoding example.
  26.  *
  27.  * Show how to use the libavformat and libavcodec API to demux and
  28.  * decode audio and video data.
  29.  * @example demuxing_decoding.c
  30.  */
  31.  
  32. #include libavutil/imgutils.h>
  33. #include libavutil/samplefmt.h>
  34. #include libavutil/timestamp.h>
  35. #include libavformat/avformat.h>
  36.  
  37. static AVFormatContext *fmt_ctx = NULL;
  38. static AVCodecContext *video_dec_ctx = NULL, *audio_dec_ctx;
  39. static int width, height;
  40. static enum AVPixelFormat pix_fmt;
  41. static AVStream *video_stream = NULL, *audio_stream = NULL;
  42. static const char *src_filename = NULL;
  43. static const char *video_dst_filename = NULL;
  44. static const char *audio_dst_filename = NULL;
  45. static FILE *video_dst_file = NULL;
  46. static FILE *audio_dst_file = NULL;
  47.  
  48. static uint8_t *video_dst_data[4] = {NULL};
  49. static int video_dst_linesize[4];
  50. static int video_dst_bufsize;
  51.  
  52. static int video_stream_idx = -1, audio_stream_idx = -1;
  53. static AVFrame *frame = NULL;
  54. static AVPacket pkt;
  55. static int video_frame_count = 0;
  56. static int audio_frame_count = 0;
  57.  
  58. /* Enable or disable frame reference counting. You are not supposed to support
  59.  * both paths in your application but pick the one most appropriate to your
  60.  * needs. Look for the use of refcount in this example to see what are the
  61.  * differences of API usage between them. */
  62. static int refcount = 0;
  63.  
  64. static int decode_packet(int *got_frame, int cached)
  65. {
  66.     int ret = 0;
  67.     int i = 0;
  68.     int ch = 0;
  69.     int data_size = 0;
  70.     int decoded = pkt.size;
  71.  
  72.     *got_frame = 0;
  73.  
  74.     if (pkt.stream_index == video_stream_idx) {
  75.         /* decode video frame */
  76.         ret = avcodec_send_packet(video_dec_ctx, &pkt);
  77.         if (ret 0) {
  78.             fprintf(stderr, "Error sending a packet for decoding\n");
  79.             exit(1);
  80.         }
  81.  
  82.         while (ret >= 0) {
  83.             ret = avcodec_receive_frame(video_dec_ctx, frame);
  84.             if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF)
  85.                 return ret;
  86.             else if (ret 0) {
  87.                 fprintf(stderr, "Error during decoding\n");
  88.                 exit(1);
  89.             }
  90.             printf("bbs.chinaffmpeg.com 孙悟空 video_frame%s n:%d coded_n:%d\n",
  91.                    cached ? "(cached)" : "",
  92.                    video_frame_count++, frame->coded_picture_number);
  93.  
  94.             /* copy decoded frame to destination buffer:
  95.              * this is required since rawvideo expects non aligned data */
  96.             av_image_copy(video_dst_data, video_dst_linesize,
  97.                           (const uint8_t **)(frame->data), frame->linesize,
  98.                           pix_fmt, width, height);
  99.  
  100.             /* write to rawvideo file */
  101.             fwrite(video_dst_data[0], 1, video_dst_bufsize, video_dst_file);
  102.  
  103.             printf("saving frame %3d\n", video_dec_ctx->frame_number);
  104.             fflush(stdout);
  105.         }
  106.     } else if (pkt.stream_index == audio_stream_idx) {
  107.         /* decode audio frame */
  108. #if 1
  109.         /* send the packet with the compressed data to the decoder */
  110.         ret = avcodec_send_packet(audio_dec_ctx, &pkt);
  111.         if (ret 0) {
  112.             fprintf(stderr, "Error submitting the packet to the decoder\n");
  113.             exit(1);
  114.         }
  115.  
  116.         /* read all the output frames (in general there may be any number of them */
  117.         while (ret >= 0) {
  118.             ret = avcodec_receive_frame(audio_dec_ctx, frame);
  119.             if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF)
  120.                 return ret;
  121.             else if (ret 0) {
  122.                 fprintf(stderr, "Error during decoding\n");
  123.                 exit(1);
  124.             }
  125.             data_size = av_get_bytes_per_sample(audio_dec_ctx->sample_fmt);
  126.             if (data_size 0) {
  127.                 /* This should not occur, checking just for paranoia */
  128.                 fprintf(stderr, "Failed to calculate data size\n");
  129.                 exit(1);
  130.             }
  131.             for (i = 0; i frame->nb_samples; i++)
  132.                 for (ch = 0; ch audio_dec_ctx->channels; ch++)
  133.                     fwrite(frame->data[ch] + data_size*i, 1, data_size, audio_dst_file);
  134.         }
  135.  
  136.         printf("audio_frame%s n:%d nb_samples:%d pts:%s\n",
  137.                cached ? "(cached)" : "",
  138.                audio_frame_count++, frame->nb_samples,
  139.                av_ts2timestr(frame->pts, &audio_dec_ctx->time_base));
  140. #else
  141.         ret = avcodec_decode_audio4(audio_dec_ctx, frame, got_frame, &pkt);
  142.         if (ret 0) {
  143.             fprintf(stderr, "Error decoding audio frame (%s)\n", av_err2str(ret));
  144.             return ret;
  145.         }
  146.         /* Some audio decoders decode only part of the packet, and have to be
  147.          * called again with the remainder of the packet data.
  148.          * Sample: 转自bbs.chinaffmpeg.com 孙悟空fate-suite/lossless-audio/
  149.          * luckynight-partial.shn
  150.          * Also, some decoders might over-read the packet. */
  151.         decoded = FFMIN(ret, pkt.size);
  152.  
  153.         if (*got_frame) {
  154.             size_t unpadded_linesize = frame->nb_samples * av_get_bytes_per_sample(frame->format);
  155.             printf("audio_frame%s n:%d nb_samples:%d pts:%s\n",
  156.                    cached ? "(cached)" : "",
  157.                    audio_frame_count++, frame->nb_samples,
  158.                    av_ts2timestr(frame->pts, &audio_dec_ctx->time_base));
  159.  
  160.             /* Write the raw audio data samples of the first plane. This works
  161.              * fine for packed formats (e.g. AV_SAMPLE_FMT_S16). However,
  162.              * most audio decoders output planar audio, which uses a separate
  163.              * plane of audio samples for each channel (e.g. AV_SAMPLE_FMT_S16P).
  164.              * In other words, this code will write only the first audio channel
  165.              * in these cases.
  166.              * You should use libswresample or libavfilter to convert the frame
  167.              * to packed data. */
  168.             fwrite(frame->extended_data[0], 1, unpadded_linesize, audio_dst_file);
  169.         }
  170. #endif
  171.     }
  172.  
  173.     /* If we use frame reference counting, we own the data and need
  174.      * to de-reference it when we don't use it anymore */
  175.     if (*got_frame && refcount)
  176.         av_frame_unref(frame);
  177.  
  178.     return decoded;
  179. }
  180.  
  181. static int open_codec_context(int *stream_idx,
  182.                               AVCodecContext **dec_ctx, AVFormatContext *fmt_ctx, enum AVMediaType type)
  183. {
  184.     int ret, stream_index;
  185.     AVStream *st;
  186.     AVCodec *dec = NULL;
  187.     AVDictionary *opts = NULL;
  188.  
  189.     ret = av_find_best_stream(fmt_ctx, type, -1, -1, NULL, 0);
  190.     if (ret 0) {
  191.         fprintf(stderr, "Could not find %s stream in input file '%s'\n",
  192.                 av_get_media_type_string(type), src_filename);
  193.         return ret;
  194.     } else {
  195.         stream_index = ret;
  196.         st = fmt_ctx->streams[stream_index];
  197.  
  198.         /* find decoder for the stream */
  199.         dec = avcodec_find_decoder(st->codecpar->codec_id);
  200.         if (!dec) {
  201.             fprintf(stderr, "Failed to find %s codec\n",
  202.                     av_get_media_type_string(type));
  203.             return AVERROR(EINVAL);
  204.         }
  205.  
  206.         /* Allocate a codec context for the decoder */
  207.         *dec_ctx = avcodec_alloc_context3(dec);
  208.         if (!*dec_ctx) {
  209.             fprintf(stderr, "Failed to allocate the %s codec context\n",
  210.                     av_get_media_type_string(type));
  211.             return AVERROR(ENOMEM);
  212.         }
  213.  
  214.         /* Copy codec parameters from input stream to output codec context */
  215.         if ((ret = avcodec_parameters_to_context(*dec_ctx, st->codecpar)) 0) {
  216.             fprintf(stderr, "Failed to copy %s codec parameters to decoder context\n",
  217.                     av_get_media_type_string(type));
  218.             return ret;
  219.         }
  220.  
  221.         /* Init the decoders, with or without reference counting */
  222.         av_dict_set(&opts, "refcounted_frames", refcount ? "1" : "0", 0);
  223.         if ((ret = avcodec_open2(*dec_ctx, dec, &opts)) 0) {
  224.             fprintf(stderr, "Failed to open %s codec\n",
  225.                     av_get_media_type_string(type));
  226.             return ret;
  227.         }
  228.         *stream_idx = stream_index;
  229.     }
  230.  
  231.     return 0;
  232. }
  233.  
  234. static int get_format_from_sample_fmt(const char **fmt,
  235.                                       enum AVSampleFormat sample_fmt)
  236. {
  237.     int i;
  238.     struct sample_fmt_entry {
  239.         enum AVSampleFormat sample_fmt; const char *fmt_be, *fmt_le;
  240.     } sample_fmt_entries[] = {
  241.         { AV_SAMPLE_FMT_U8, "u8", "u8" },
  242.         { AV_SAMPLE_FMT_S16, "s16be", "s16le" },
  243.         { AV_SAMPLE_FMT_S32, "s32be", "s32le" },
  244.         { AV_SAMPLE_FMT_FLT, "f32be", "f32le" },
  245.         { AV_SAMPLE_FMT_DBL, "f64be", "f64le" },
  246.     };
  247.     *fmt = NULL;
  248.  
  249.     for (i = 0; i FF_ARRAY_ELEMS(sample_fmt_entries); i++) {
  250.         struct sample_fmt_entry *entry = &sample_fmt_entries[i];
  251.         if (sample_fmt == entry->sample_fmt) {
  252.             *fmt = AV_NE(entry->fmt_be, entry->fmt_le);
  253.             return 0;
  254.         }
  255.     }
  256.  
  257.     fprintf(stderr,
  258.             "sample format %s is not supported as output format\n",
  259.             av_get_sample_fmt_name(sample_fmt));
  260.     return -1;
  261. }
  262.  
  263. int main (int argc, char **argv)
  264. {
  265.     int ret = 0, got_frame;
  266.  
  267.     if (argc != 4 && argc != 5) {
  268.         fprintf(stderr, "usage: %s [-refcount] input_file video_output_file audio_output_file\n"
  269.                 "API example program to show how to read frames from an input file.\n"
  270.                 "This program reads frames from a file, decodes them, and writes decoded\n"
  271.                 "video frames to a rawvideo file named video_output_file, and decoded\n"
  272.                 "audio frames to a rawaudio file named audio_output_file.\n\n"
  273.                 "If the -refcount option is specified, the program use the\n"
  274.                 "reference counting frame system which allows keeping a copy of\n"
  275.                 "the data for longer than one decode call.\n"
  276.                 "\n", argv[0]);
  277.         exit(1);
  278.     }
  279.     if (argc == 5 && !strcmp(argv[1], "-refcount")) {
  280.         refcount = 1;
  281.         argv++;
  282.     }
  283.     src_filename = argv[1];
  284.     video_dst_filename = argv[2];
  285.     audio_dst_filename = argv[3];
  286.  
  287.     /* register all formats and codecs */
  288.     av_register_all();
  289.  
  290.     /* open input file, and allocate format context */
  291.     if (avformat_open_input(&fmt_ctx, src_filename, NULL, NULL) 0) {
  292.         fprintf(stderr, "Could not open source file %s\n", src_filename);
  293.         exit(1);
  294.     }
  295.  
  296.     /* retrieve stream information */
  297.     if (avformat_find_stream_info(fmt_ctx, NULL) 0) {
  298.         fprintf(stderr, "Could not find stream information\n");
  299.         exit(1);
  300.     }
  301.  
  302.     if (open_codec_context(&video_stream_idx, &video_dec_ctx, fmt_ctx, AVMEDIA_TYPE_VIDEO) >= 0) {
  303.         video_stream = fmt_ctx->streams[video_stream_idx];
  304.  
  305.         video_dst_file = fopen(video_dst_filename, "wb");
  306.         if (!video_dst_file) {
  307.             fprintf(stderr, "Could not open destination file %s\n", video_dst_filename);
  308.             ret = 1;
  309.             goto end;
  310.         }
  311.  
  312.         /* allocate image where the decoded image will be put */
  313.         width = video_dec_ctx->width;
  314.         height = video_dec_ctx->height;
  315.         pix_fmt = video_dec_ctx->pix_fmt;
  316.         ret = av_image_alloc(video_dst_data, video_dst_linesize,
  317.                              width, height, pix_fmt, 1);
  318.         if (ret 0) {
  319.             fprintf(stderr, "Could not allocate raw video buffer\n");
  320.             goto end;
  321.         }
  322.         video_dst_bufsize = ret;
  323.     }
  324.  
  325.     if (open_codec_context(&audio_stream_idx, &audio_dec_ctx, fmt_ctx, AVMEDIA_TYPE_AUDIO) >= 0) {
  326.         audio_stream = fmt_ctx->streams[audio_stream_idx];
  327.         audio_dst_file = fopen(audio_dst_filename, "wb");
  328.         if (!audio_dst_file) {
  329.             fprintf(stderr, "Could not open destination file %s\n", audio_dst_filename);
  330.             ret = 1;
  331.             goto end;
  332.         }
  333.     }
  334.  
  335.     /* dump input information to stderr */
  336.     av_dump_format(fmt_ctx, 0, src_filename, 0);
  337.  
  338.     if (!audio_stream && !video_stream) {
  339.         fprintf(stderr, "Could not find audio or video stream in the input, aborting\n");
  340.         ret = 1;
  341.         goto end;
  342.     }
  343.  
  344.     frame = av_frame_alloc();
  345.     if (!frame) {
  346.         fprintf(stderr, "Could not allocate frame\n");
  347.         ret = AVERROR(ENOMEM);
  348.         goto end;
  349.     }
  350.  
  351.     /* initialize packet, set data to NULL, let the demuxer fill it */
  352.     av_init_packet(&pkt);
  353.     pkt.data = NULL;
  354.     pkt.size = 0;
  355.  
  356.     if (video_stream)
  357.         printf("Demuxing video from file '%s' into '%s'\n", src_filename, video_dst_filename);
  358.     if (audio_stream)
  359.         printf("Demuxing audio from file '%s' into '%s'\n", src_filename, audio_dst_filename);
  360.  
  361.     /* read frames from the file */
  362.     while (av_read_frame(fmt_ctx, &pkt) >= 0) {
  363.         AVPacket orig_pkt = pkt;
  364.         do {
  365.             ret = decode_packet(&got_frame, 0);
  366.             if (ret 0)
  367.                 break;
  368.             pkt.data += ret;
  369.             pkt.size -= ret;
  370.         } while (pkt.size > 0);
  371.         av_packet_unref(&orig_pkt);
  372.     }
  373.  
  374.     /* flush cached frames */
  375.     pkt.data = NULL;
  376.     pkt.size = 0;
  377.     do {
  378.         decode_packet(&got_frame, 1);
  379.     } while (got_frame);
  380.  
  381.     printf("Demuxing succeeded.\n");
  382.  
  383.     if (video_stream) {
  384.         printf("Play the output video file with the command:\n"
  385.                "ffplay -f rawvideo -pix_fmt %s -video_size %dx%d %s\n",
  386.                av_get_pix_fmt_name(pix_fmt), width, height,
  387.                video_dst_filename);
  388.     }
  389.  
  390.     if (audio_stream) {
  391.         enum AVSampleFormat sfmt = audio_dec_ctx->sample_fmt;
  392.         int n_channels = audio_dec_ctx->channels;
  393.         const char *fmt;
  394.  
  395.         if (av_sample_fmt_is_planar(sfmt)) {
  396.             const char *packed = av_get_sample_fmt_name(sfmt);
  397.             printf("Warning: the sample format the decoder produced is planar "
  398.                    "(%s). This example will output the first channel only.\n",
  399.                    packed ? packed : "?");
  400.             sfmt = av_get_packed_sample_fmt(sfmt);
  401.             n_channels = 2;
  402.         }
  403.  
  404.         if ((ret = get_format_from_sample_fmt(&fmt, sfmt)) 0)
  405.             goto end;
  406.  
  407.         printf("Play the output audio file with the command:\n"
  408.                "ffplay -f %s -ac %d -ar %d %s\n",
  409.                fmt, n_channels, audio_dec_ctx->sample_rate,
  410.                audio_dst_filename);
  411.     }
  412.  
  413. end:
  414.     avcodec_free_context(&video_dec_ctx);
  415.     avcodec_free_context(&audio_dec_ctx);
  416.     avformat_close_input(&fmt_ctx);
  417.     if (video_dst_file)
  418.         fclose(video_dst_file);
  419.     if (audio_dst_file)
  420.         fclose(audio_dst_file);
  421.     av_frame_free(&frame);
  422.     av_free(video_dst_data[0]);
  423.  
  424.     return ret 0;
  425. }
下面看一下编译的方式,其实我是用的ffmpeg原生的编译方式编译的make doc/examples/demuxing_decoding,在这里贴一下make -n doc/examples/demuxing_decoding的输出


点击(此处)折叠或打开

  1. liuqideMBP:xxx liuqi$ make -n doc/examples/demuxing_decoding
  2. printf "CC\t%s\n" doc/examples/demuxing_decoding.o; ccache gcc -I. -Isrc/ -D_ISOC99_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -I/Users/liuqi/multimedia/ffmpeg/compat/dispatch_semaphore -DPIC -DZLIB_CONST -std=c11 -Werror=partial-availability -fomit-frame-pointer -fPIC -pthread -I/usr/local/include -I/usr/local/Cellar/fontconfig/2.12.6/include -I/usr/local/opt/freetype/include/freetype2 -I/usr/local/Cellar/fribidi/0.19.7_1/include/fribidi -I/usr/local/Cellar/glib/2.54.2/include/glib-2.0 -I/usr/local/Cellar/glib/2.54.2/lib/glib-2.0/include -I/usr/local/opt/gettext/include -I/usr/local/Cellar/pcre/8.41/include -I/usr/local/opt/freetype/include/freetype2 -I/usr/local/Cellar/libbluray/1.0.1/include -I/usr/local/include -I/usr/local/Cellar/fontconfig/2.12.6/include -I/usr/local/opt/freetype/include/freetype2 -I/usr/local/opt/freetype/include/freetype2 -I/usr/local/Cellar/speex/1.2rc1/include -I/usr/local/include -I/usr/local/Cellar/x265/2.5_1/include -g -Wdeclaration-after-statement -Wall -Wdisabled-optimization -Wpointer-arith -Wredundant-decls -Wwrite-strings -Wtype-limits -Wundef -Wmissing-prototypes -Wno-pointer-to-int-cast -Wstrict-prototypes -Wempty-body -Wno-parentheses -Wno-switch -Wno-format-zero-length -Wno-pointer-sign -Wno-unused-const-variable -O3 -fno-math-errno -fno-signed-zeros -mstack-alignment=16 -Qunused-arguments -Werror=implicit-function-declaration -Werror=missing-prototypes -Werror=return-type -D_THREAD_SAFE -I/usr/local/include/SDL2 -MMD -MF doc/examples/demuxing_decoding.d -MT doc/examples/demuxing_decoding.o -c -o doc/examples/demuxing_decoding.o src/doc/examples/demuxing_decoding.c
  3. printf "LD\t%s\n" doc/examples/demuxing_decoding_g; ccache gcc -Llibavcodec -Llibavdevice -Llibavfilter -Llibavformat -Llibavresample -Llibavutil -Llibpostproc -Llibswscale -Llibswresample -Wl,-dynamic,-search_paths_first -Qunused-arguments -o doc/examples/demuxing_decoding_g doc/examples/demuxing_decoding.o -lavdevice -lavfilter -lavformat -lavcodec -lpostproc -lswresample -lswscale -lavutil -framework Foundation -lm -framework AVFoundation -framework CoreVideo -framework CoreMedia -pthread -framework CoreGraphics -L/usr/local/lib -lSDL2 -framework OpenGL -framework OpenGL -pthread -lm -L/usr/local/lib -lass -framework CoreImage -framework AppKit -L/usr/local/Cellar/fontconfig/2.12.6/lib -L/usr/local/opt/freetype/lib -lfontconfig -lfreetype -L/usr/local/opt/freetype/lib -lfreetype -lm -lbz2 -L/usr/local/Cellar/libbluray/1.0.1/lib -lbluray -lz -Wl,-framework,CoreFoundation -Wl,-framework,Security -liconv -lm -llzma -lz -framework AudioToolbox -L/usr/local/lib -lfdk-aac -lmp3lame -L/usr/local/Cellar/speex/1.2rc1/lib -lspeex -L/usr/local/lib -lx264 -L/usr/local/Cellar/x265/2.5_1/lib -lx265 -pthread -framework VideoToolbox -framework CoreFoundation -framework CoreMedia -framework CoreVideo -framework CoreServices -lm -lm -lm -pthread -lm -framework VideoToolbox -framework CoreFoundation -framework CoreMedia -framework CoreVideo -framework CoreServices
  4. printf "STRIP\t%s\n" doc/examples/demuxing_decoding; strip -x -o doc/examples/demuxing_decoding doc/examples/demuxing_decoding_g

目录
相关文章
|
2月前
|
缓存 测试技术 API
API的封装步骤流程
API封装流程是一个系统化的过程,旨在将内部功能转化为可复用的接口供外部调用。流程包括明确需求、设计接口、选择技术和工具、编写代码、测试、文档编写及部署维护。具体步骤为确定业务功能、数据来源;设计URL、请求方式、参数及响应格式;选择开发语言、框架和数据库技术;实现数据连接、业务逻辑、错误处理;进行功能、性能测试;编写详细文档;部署并持续维护。通过这些步骤,确保API稳定可靠,提高性能。
|
21天前
|
人工智能 机器人 API
【通义】AI视界|谷歌Q3财报:Gemini API六个月增长14倍,公司超25%的新代码由AI生成
本文内容由通义自动生成,涵盖谷歌Q3财报、马斯克xAI融资、九巨头联盟挑战英伟达、Meta加大AI投入及麻省理工研究LLM与人脑相似性等热点资讯。更多精彩内容,请访问通通知道。
|
1月前
|
机器学习/深度学习 PyTorch 算法框架/工具
揭秘深度学习中的微调难题:如何运用弹性权重巩固(EWC)策略巧妙应对灾难性遗忘,附带实战代码详解助你轻松掌握技巧
【10月更文挑战第1天】深度学习中,模型微调虽能提升性能,但常导致“灾难性遗忘”,即模型在新任务上训练后遗忘旧知识。本文介绍弹性权重巩固(EWC)方法,通过在损失函数中加入正则项来惩罚对重要参数的更改,从而缓解此问题。提供了一个基于PyTorch的实现示例,展示如何在训练过程中引入EWC损失,适用于终身学习和在线学习等场景。
60 4
揭秘深度学习中的微调难题:如何运用弹性权重巩固(EWC)策略巧妙应对灾难性遗忘,附带实战代码详解助你轻松掌握技巧
|
2月前
|
API PHP
ThinkPHP 通用的API格式封装
本文介绍了在ThinkPHP框架中如何统一封装API返回格式的方法,包括创建状态码枚举类、编写统一格式化函数以及在BaseController和Error控制器中重写`__call`方法来处理不存在的方法或控制器调用,以实现统一的错误处理和返回格式。
ThinkPHP 通用的API格式封装
|
1月前
|
JSON API 数据格式
低代码实现鸿蒙API返回JSON转TS及快速生成ArkUI代码
低代码实现鸿蒙API返回JSON转TS及快速生成ArkUI代码
40 0
低代码实现鸿蒙API返回JSON转TS及快速生成ArkUI代码
|
1月前
|
JSON JavaScript API
(API接口系列)商品详情数据封装接口json数据格式分析
在成长的路上,我们都是同行者。这篇关于商品详情API接口的文章,希望能帮助到您。期待与您继续分享更多API接口的知识,请记得关注Anzexi58哦!
|
27天前
|
存储 数据管理 API
零代码能力:轻松搞定表单和API接口,少写80%后端代码,内含资源
小白接口(果创云 YesApi.cn)是一个零代码和低代码开发平台,提供一站式后端云服务,帮助开发者、学生、业余爱好者、工作室、中小企业及无IT技术人员的传统企业快速搭建应用、接口、服务和网站。平台提供500+免费API接口,支持在线API开发、在线表单、数据库管理、图片文件存储、会员管理等功能,无需后端开发经验,轻松实现数据处理和应用开发。
|
3月前
|
JSON 安全 API
构建高效后端API:最佳实践与代码示例
【8月更文挑战第2天】 在数字化时代,后端API是连接数据与用户的桥梁。本文深入探讨了如何设计并实现高效的后端API,从理论到实践,提供了实用的技巧和代码示例。通过阅读本篇文章,你将学会如何避免常见的陷阱,优化你的API性能,从而提供更加流畅的用户体验。
|
3月前
|
Web App开发 5G Linux
FFmpeg开发笔记(四十四)毕业设计可做的几个拉满颜值的音视频APP
一年一度的毕业季来临,计算机专业的毕业设计尤为重要,不仅关乎学业评价还积累实战经验。选择紧跟5G技术趋势的音视频APP作为课题极具吸引力。这里推荐三类应用:一是融合WebRTC技术实现视频通话的即时通信APP;二是具备在线直播功能的短视频分享平台,涉及RTMP/SRT等直播技术;三是具有自定义动画特效及卡拉OK歌词字幕功能的视频剪辑工具。这些项目不仅技术含量高,也符合市场需求,是毕业设计的理想选择。
79 6
FFmpeg开发笔记(四十四)毕业设计可做的几个拉满颜值的音视频APP
|
2月前
|
Android开发 计算机视觉 C++
FFmpeg开发笔记(五十一)适合学习研究的几个音视频开源框架
音视频编程对许多程序员来说是一片充满挑战的领域,但借助如OpenCV、LearnOpenGL、FFmpeg、OBS Studio及VLC media player等强大的开源工具,可以降低入门门槛。这些框架不仅覆盖了计算机视觉、图形渲染,还包括多媒体处理与直播技术,通过多种编程语言如Python、C++的应用,使得音视频开发更为便捷。例如,OpenCV支持跨平台的视觉应用开发,FFmpeg则擅长多媒体文件的处理与转换,而VLC media player则是验证音视频文件质量的有效工具。
92 0
FFmpeg开发笔记(五十一)适合学习研究的几个音视频开源框架