CN111866546A - 一种基于FFmpeg的网络音频选择源的实现方法 - Google Patents

一种基于FFmpeg的网络音频选择源的实现方法 Download PDF

Info

Publication number
CN111866546A
CN111866546A CN202010701710.2A CN202010701710A CN111866546A CN 111866546 A CN111866546 A CN 111866546A CN 202010701710 A CN202010701710 A CN 202010701710A CN 111866546 A CN111866546 A CN 111866546A
Authority
CN
China
Prior art keywords
audio
ffmpeg
network
selection source
channels
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202010701710.2A
Other languages
English (en)
Inventor
张武
马晓光
王朝晖
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shandong Chaoyue CNC Electronics Co Ltd
Original Assignee
Shandong Chaoyue CNC Electronics Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shandong Chaoyue CNC Electronics Co Ltd filed Critical Shandong Chaoyue CNC Electronics Co Ltd
Priority to CN202010701710.2A priority Critical patent/CN111866546A/zh
Publication of CN111866546A publication Critical patent/CN111866546A/zh
Pending legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/20Servers specifically adapted for the distribution of content, e.g. VOD servers; Operations thereof
    • H04N21/23Processing of content or additional data; Elementary server operations; Server middleware
    • H04N21/234Processing of video elementary streams, e.g. splicing of video streams or manipulating encoded video stream scene graphs
    • H04N21/2343Processing of video elementary streams, e.g. splicing of video streams or manipulating encoded video stream scene graphs involving reformatting operations of video signals for distribution or compliance with end-user requests or end-user device requirements
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/20Servers specifically adapted for the distribution of content, e.g. VOD servers; Operations thereof
    • H04N21/23Processing of content or additional data; Elementary server operations; Server middleware
    • H04N21/236Assembling of a multiplex stream, e.g. transport stream, by combining a video stream with other content or additional data, e.g. inserting a URL [Uniform Resource Locator] into a video stream, multiplexing software data into a video stream; Remultiplexing of multiplex streams; Insertion of stuffing bits into the multiplex stream, e.g. to obtain a constant bit-rate; Assembling of a packetised elementary stream
    • H04N21/2368Multiplexing of audio and video streams
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/43Processing of content or additional data, e.g. demultiplexing additional data from a digital video stream; Elementary client operations, e.g. monitoring of home network or synchronising decoder's clock; Client middleware
    • H04N21/439Processing of audio elementary streams
    • H04N21/4398Processing of audio elementary streams involving reformatting operations of audio signals
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/43Processing of content or additional data, e.g. demultiplexing additional data from a digital video stream; Elementary client operations, e.g. monitoring of home network or synchronising decoder's clock; Client middleware
    • H04N21/44Processing of video elementary streams, e.g. splicing a video clip retrieved from local storage with an incoming video stream or rendering scenes according to encoded video stream scene graphs
    • H04N21/4402Processing of video elementary streams, e.g. splicing a video clip retrieved from local storage with an incoming video stream or rendering scenes according to encoded video stream scene graphs involving reformatting operations of video signals for household redistribution, storage or real-time display

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Two-Way Televisions, Distribution Of Moving Picture Or The Like (AREA)

Abstract

一种基于FFmpeg的网络音频选择源的实现方法,通过对各种音视频编解码器、复用器、过滤器的注册,同时可以打开多路网络音频源,并根据音频新型选择合适的音频编码器,提取单一声道并使用合适的音频过滤器进行合流播放。实现了基于ffmpeg的多路网络音频选择输出方案,可以将网络传输过来的多路音频进行合并输出,具有很高的传输实时性,可以满足实际应用中多路音频采集输出的需求。

Description

一种基于FFmpeg的网络音频选择源的实现方法
技术领域
本发明涉及网络音频源选择技术领域,具体涉及一种基于FFmpeg的网络音频选择源的实现方法。
背景技术
随着5G无线通信和网络技术的蓬勃发展,网络视频会议、实时音视频传输在实际生活中的应用越来越广泛。目前音频接收端播放的大部分是单一音频源数据,而实际应用中可能会出现两个以上音频来源,需要对多个音频源进行控制,单独输出某个音频数据,或者对多个音频源进行同时输出。
FFmpeg是一套可以用来记录、转换数字音频、视频,并能将其转化为流的开源计算机程序。它提供了录制、转换以及流化音视频的完整解决方案。但是针对网络音频中多音频源时,无法对多音频源进行合并输出。
发明内容
本发明为了克服以上技术的不足,提供了一种可以同多个音频源中的声道进行提取并进行合流播放的方法。
本发明克服其技术问题所采用的技术方案是:
一种基于FFmpeg的网络音频选择源的实现方法,包括如下步骤:
a)通过FFmpeg注册音视频编解码器、注册音视频过滤器以及注册音视频复用器;
b)注册加载网络和加密的相关库;
c)打开网络中的N路音频流,N为大于等于2的正整数,获取每路音频流对应解码器;
d)使用对应的解码器将对应的音频流中的单一声道进行提取;
e)使用混音合流过滤器对每路音频流提取的单一声道进行合并并输出播放。
进一步的,步骤a)中通过FFmpeg中的avcodec_register_all函数注册加载音视频编解码器。
进一步的,步骤a)中通过FFmpeg中的avfilter_register_all函数注册加载音视频复用器。
进一步的,步骤a)中通过FFmpeg中的av_register_all函数注册加载音视频过滤器。
进一步的,步骤b)中通过FFmpeg中的avformat_network_init函数注册加载网络和加密的相关库。
进一步的,步骤c)中通过FFmpeg中的AVFormatContext函数根据音频流查找到对应的解码器。
进一步的,步骤d)中每路音频流中有M个声道,M为大于等于2的正整数,解码器将M个声道中的任意一声道进行提取。
进一步的,步骤d)中每路音频流中有M个声道,M为大于等于2的正整数,解码器将M个声道合称为一个声道后提取。
本发明的有益效果是:通过对各种音视频编解码器、复用器、过滤器的注册,同时可以打开多路网络音频源,并根据音频新型选择合适的音频编码器,提取单一声道并使用合适的音频过滤器进行合流播放。实现了基于ffmpeg的多路网络音频选择输出方案,可以将网络传输过来的多路音频进行合并输出,具有很高的传输实时性,可以满足实际应用中多路音频采集输出的需求。
附图说明
图1为本发明的方法流程图。
具体实施方式
下面结合附图1对本发明做进一步说明。
一种基于FFmpeg的网络音频选择源的实现方法,包括如下步骤:
a)通过FFmpeg注册音视频编解码器、注册音视频过滤器以及注册音视频复用器;
b)注册加载网络和加密的相关库;
c)打开网络中的N路音频流,N为大于等于2的正整数,获取每路音频流对应解码器;
d)使用对应的解码器将对应的音频流中的单一声道进行提取;
e)使用混音合流过滤器对每路音频流提取的单一声道进行合并并输出播放。
通过对各种音视频编解码器、复用器、过滤器的注册,同时可以打开多路网络音频源,并根据音频新型选择合适的音频编码器,提取单一声道并使用合适的音频过滤器进行合流播放。实现了基于ffmpeg的多路网络音频选择输出方案,可以将网络传输过来的多路音频进行合并输出,具有很高的传输实时性,可以满足实际应用中多路音频采集输出的需求。
优选的,步骤a)中通过FFmpeg中的avcodec_register_all函数注册加载音视频编解码器。
优选的,步骤a)中通过FFmpeg中的avfilter_register_all函数注册加载音视频复用器。
优选的,步骤a)中通过FFmpeg中的av_register_all函数注册加载音视频过滤器。
优选的,步骤b)中通过FFmpeg中的avformat_network_init函数注册加载网络和加密的相关库。
优选的,步骤c)中通过FFmpeg中的AVFormatContext函数根据音频流查找到对应的解码器。
优选的,步骤d)中每路音频流中有M个声道,M为大于等于2的正整数,解码器将M个声道中的任意一声道进行提取。
优选的,步骤d)中每路音频流中有M个声道,M为大于等于2的正整数,解码器将M个声道合称为一个声道后提取。
以上各实施例仅用以说明本发明的技术方案,而非对其限制;尽管参照前述各实施例对本发明进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分或者全部技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本发明各实施例技术方案的范围。

Claims (8)

1.一种基于FFmpeg的网络音频选择源的实现方法,其特征在于,包括如下步骤:
a)通过FFmpeg注册音视频编解码器、注册音视频过滤器以及注册音视频复用器;
b)注册加载网络和加密的相关库;
c)打开网络中的N路音频流,N为大于等于2的正整数,获取每路音频流对应解码器;
d)使用对应的解码器将对应的音频流中的单一声道进行提取;
e)使用混音合流过滤器对每路音频流提取的单一声道进行合并并输出播放。
2.根据权利要求1所述的基于FFmpeg的网络音频选择源的实现方法,其特征在于:步骤a)中通过FFmpeg中的avcodec_register_all函数注册加载音视频编解码器。
3.根据权利要求1所述的基于FFmpeg的网络音频选择源的实现方法,其特征在于:步骤a)中通过FFmpeg中的avfilter_register_all函数注册加载音视频复用器。
4.根据权利要求1所述的基于FFmpeg的网络音频选择源的实现方法,其特征在于:步骤a)中通过FFmpeg中的av_register_all函数注册加载音视频过滤器。
5.根据权利要求1所述的基于FFmpeg的网络音频选择源的实现方法,其特征在于:步骤b)中通过FFmpeg中的avformat_network_init函数注册加载网络和加密的相关库。
6.根据权利要求1所述的基于FFmpeg的网络音频选择源的实现方法,其特征在于:步骤c)中通过FFmpeg中的AVFormatContext函数根据音频流查找到对应的解码器。
7.根据权利要求1所述的基于FFmpeg的网络音频选择源的实现方法,其特征在于:步骤d)中每路音频流中有M个声道,M为大于等于2的正整数,解码器将M个声道中的任意一声道进行提取。
8.根据权利要求1所述的基于FFmpeg的网络音频选择源的实现方法,其特征在于:步骤d)中每路音频流中有M个声道,M为大于等于2的正整数,解码器将M个声道合称为一个声道后提取。
CN202010701710.2A 2020-07-21 2020-07-21 一种基于FFmpeg的网络音频选择源的实现方法 Pending CN111866546A (zh)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010701710.2A CN111866546A (zh) 2020-07-21 2020-07-21 一种基于FFmpeg的网络音频选择源的实现方法

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010701710.2A CN111866546A (zh) 2020-07-21 2020-07-21 一种基于FFmpeg的网络音频选择源的实现方法

Publications (1)

Publication Number Publication Date
CN111866546A true CN111866546A (zh) 2020-10-30

Family

ID=73002414

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010701710.2A Pending CN111866546A (zh) 2020-07-21 2020-07-21 一种基于FFmpeg的网络音频选择源的实现方法

Country Status (1)

Country Link
CN (1) CN111866546A (zh)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113727115A (zh) * 2021-07-21 2021-11-30 天津津航计算技术研究所 一种高效可转码的视频解码方法

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101040565A (zh) * 2004-10-14 2007-09-19 杜比实验室特许公司 用于移动立体声内容的改善的头相关传递函数
CN109036446A (zh) * 2017-06-08 2018-12-18 腾讯科技(深圳)有限公司 一种音频数据处理方法以及相关设备
CN110033780A (zh) * 2019-04-07 2019-07-19 西安电子科技大学 基于FFmpeg和EMIF驱动的音视频数据传输方法

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101040565A (zh) * 2004-10-14 2007-09-19 杜比实验室特许公司 用于移动立体声内容的改善的头相关传递函数
CN109036446A (zh) * 2017-06-08 2018-12-18 腾讯科技(深圳)有限公司 一种音频数据处理方法以及相关设备
CN110033780A (zh) * 2019-04-07 2019-07-19 西安电子科技大学 基于FFmpeg和EMIF驱动的音视频数据传输方法

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
SIMADI: "ffmpeg 多个音频合并截取拆分", 《博客园,HTTPS://WWW.CNBLOGS.COM/SIMADI/P/10649345.HTML》 *
雷霄骅: "ffmpeg源代码简单分析:av_register_all()", 《 CSDN,HTTPS://BLOG.CSDN.NET/LEIXIAOHUA1020/ARTICLE/DETAILS/12677129》 *

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113727115A (zh) * 2021-07-21 2021-11-30 天津津航计算技术研究所 一种高效可转码的视频解码方法
CN113727115B (zh) * 2021-07-21 2024-04-23 天津津航计算技术研究所 一种高效可转码的视频解码方法

Similar Documents

Publication Publication Date Title
US11218740B2 (en) Decoder for decoding a media signal and encoder for encoding secondary media data comprising metadata or control data for primary media data
CN102301730B (zh) 多路音视频传输和处理方法、装置及系统
RU2509378C2 (ru) Способ и устройство для формирования выровненного многоканального аудиосигнала
JP6377784B2 (ja) オーディオビデオ同期取込によって一対多オーディオビデオストリーミングを行う方法
CN108235052A (zh) 基于ios可选择多音频通道硬件混音、采集及播放的方法
CN109040818B (zh) 直播时的音视频同步方法、存储介质、电子设备及系统
CN111866546A (zh) 一种基于FFmpeg的网络音频选择源的实现方法
US10242684B2 (en) Systems and methods for adjusting audio levels in a plurality of audio signals
CN114363648A (zh) 直播系统混流过程中音视频对齐的方法、设备及存储介质
CN103177725B (zh) 用于输送对齐的多通道音频的方法和设备
CN108665749A (zh) 云桌面下的多媒体教学系统的显示装置及多媒体教学系统
CN103474076B (zh) 用于输送对齐的多通道音频的方法和设备
CN116261008A (zh) 音频处理方法和音频处理装置
CN106851331B (zh) 易播处理方法及系统
CN112565808B (zh) 一种在直播流中插播垫片的方法
CN107888946A (zh) 一种流媒体服务器混流合屏方法
JP2016025534A (ja) 多重化装置
CN107959884B (zh) 一种单声道多音频流媒体文件的转码处理方法
KR100601596B1 (ko) Mpeg 비트스트림 기록재생장치 및 방법
CN117156082A (zh) 一种无人机图传四路接收系统及方法
Mason et al. The Atlantic Audio Demonstration Equipment
CN113395581A (zh) 音频播放方法、装置、电子设备及存储介质
Spath et al. Dolby EA Practical Way to Distribute Multichannel Audio
GB2596107A (en) Managing network jitter for multiple audio streams
KR101089933B1 (ko) 인코딩 가속 기술의 디지털 멀티미디어 인코더

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20201030