libav

Resampling audio using libswresample from 48000 to 44100

旧时模样 提交于 2020-12-12 06:22:12
问题 I'm trying to resample a decoded audio frame from 48KHz to 44.1KHz using the libswresample API. The code I have is the following: // 'frame' is the original decoded audio frame AVFrame *output_frame = av_frame_alloc(); // Without this, there is no sound at all at the output (PTS stuff I guess) av_frame_copy_props(output_frame, frame); output_frame->channel_layout = audioStream->codec->channel_layout; output_frame->sample_rate = audioStream->codec->sample_rate; output_frame->format =

Python使用pydub库对mp3与wav格式进行互转的方法

点点圈 提交于 2020-08-10 05:46:57
我们需要用到一个叫pydub的类库, pydub是python的高级一个音频处理库,可以让你以一种不那么蠢的方法处理音频。---开发者原话 1 https: / / github.com / jiaaro / pydub 附上开发者的github地址 安装: 1 pip install pydub 如果在pycharm中也可以这样安装: setting----Project Interpreter----右边绿色+号 点一下install package 依赖安装: 作者在github 上说,依赖可以安装libav or ffmpeg 关于这两个东西的爱恨情仇可以自行百度 我们安装其一就行 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 Mac (using homebrew): # libav brew install libav - - with - libvorbis - - with - sdl - - with - theora #### OR ##### # ffmpeg brew install ffmpeg - - with - libvorbis - - with - sdl2 - - with - theora Linux (using aptitude): # libav apt - get install libav

centos 7.5源码安装freeswitch 1.10.3

夙愿已清 提交于 2020-08-07 19:13:20
1、下载freeswitch安装包(freeswitch-1.10.2.-release.tar.gz) 2、安装对应依赖 yum install -y git alsa-lib-devel autoconf automake bison broadvoice-devel bzip2 curl-devel libdb4-devel e2fsprogs-devel erlang flite-devel g722_1-devel gcc-c++ gdbm-devel gnutls-devel ilbc2-devel ldns-devel libcodec2-devel libcurl-devel libedit-devel libidn-devel libjpeg-devel libmemcached-devel libogg-devel libsilk-devel libsndfile-devel libtheora-devel libtiff-devel libtool libuuid-devel libvorbis-devel libxml2-devel lua-devel lzo-devel mongo-c-driver-devel ncurses-devel net-snmp-devel openssl-devel opus-devel pcre-devel perl

Pydub unable to locte ffprobe

為{幸葍}努か 提交于 2020-07-08 11:25:26
问题 First of all, here is the link to a similar question to this: Pydub (WindowsError: [Error 2] The system can not find the file specified) Although in this one the problem is with ffmpeg, which I solved by setting the absolute path. After setting the absolute path for converter and/or ffmpeg with either: AudioSegment.converter = r'C:\ffmpeg\bin' or AudioSegment.ffmpeg = r'C:\ffmpeg\bin' I still get this error: C:\Program Files\Python36\lib\site-packages\pydub\utils.py:193: RuntimeWarning:

Pydub unable to locte ffprobe

孤者浪人 提交于 2020-07-08 11:25:06
问题 First of all, here is the link to a similar question to this: Pydub (WindowsError: [Error 2] The system can not find the file specified) Although in this one the problem is with ffmpeg, which I solved by setting the absolute path. After setting the absolute path for converter and/or ffmpeg with either: AudioSegment.converter = r'C:\ffmpeg\bin' or AudioSegment.ffmpeg = r'C:\ffmpeg\bin' I still get this error: C:\Program Files\Python36\lib\site-packages\pydub\utils.py:193: RuntimeWarning:

Copying avcodec parameters

假如想象 提交于 2020-06-28 06:35:54
问题 I am trying to use libav to convert an MP4 file to an MP3 file. Basically trying to achieve what ffmpeg -i filename.mp4 filename.mp3 does. I've found this official example. But when I run it with an input MP4 and an output MP3 I get an error: Invalid audio stream. Exactly one MP3 audio stream is required. I am not at all familiar with this library but I think I have narrowed the problem down to this line: ret = avcodec_parameters_copy(out_stream->codecpar, in_codecpar); It seems to copy all

How to extract audio form video using ffmpeg in C++?

你离开我真会死。 提交于 2020-06-11 14:30:33
问题 I'm developing a C++ app that uses FFmpeg to play audio/video. Now I want to enhance the application to allow the users to extract audio from video. How can FFmpeg can be used for this? I searched a lot about this but I was not able to find a tutorial regarding it. 回答1: You need to Open the input context [ avformat_open_input ] Get the stream information [ avformat_find_stream_info ] Get the audio stream: if (inputFormatContext->streams[index]->codec->codec_type == AVMEDIA_TYPE_AUDIO) {

Rotating a video during encoding with ffmpeg and libav API results in half of video corrupted

喜欢而已 提交于 2020-05-17 05:50:12
问题 I'm using the C API for ffmpeg/libav to rotate a vertically filmed iphone video during the encoding step. There are other questions asking to do a similar thing but they are all using the CLI tool to do so. So far I was able to figure out how to use the AVFilter to rotate the video, base off this example https://github.com/FFmpeg/FFmpeg/blob/master/doc/examples/filtering_video.c The problem is that half the output file is corrupt. Here is the code for my encoding logic. Its written with

手把手教你在Windows下使用MinGW编译libav

五迷三道 提交于 2020-03-01 14:34:15
手把手教你在Windows下使用MinGW编译libav libav是在Linux下使用纯c语言开发的,不可避免的,libav源码使用了一些gcc的特性,那么在Windows下很难使用VC编译,但是使用MinGW编译却简单多了,下面我将根据自己的经历逐步介绍使用MinGW编译libav的过程以及在此过程中遇到的问题及其解决方法。 1 安装MinGW编译环境 1.1 安装MinGW l 下载和运行最新的mingw-get-inst版本。 l 选择安装MinGW的目录,注意:安装目录的路径中不能包含空格符。 l 安装可选的组件:C++编译器、Forthan编译器、Objective-C编译器、Ada编译器和MSYS。 图1:选择需要安装的组件 由于我们需要使用MinGW编译libav,因此除了C编译器之外,还需要选择C++编译器和MSYS,如图1所示。 接下来,安装程序会下载并运行mingw-get CLI安装程序安装GCC 。取决于你的网络状况,这个过程可能会持续数分钟。在使用MinGW之前,请将${MinGWDir}\bin添加到PATH环境变量,其中${MinGWDir}是MinGW的安装目录,默认情况下${MinGWDir}=C:\MinGW。 安装完成后,打开开始菜单 ->程序 -> MinGW -> MinGW Shell,运行MinGW。 1.2 安装coreutils

Video decoder on Cuda ffmpeg

亡梦爱人 提交于 2020-01-01 19:37:27
问题 I starting to implement custum video decoder that utilize cuda HW decoder to generate YUV frame for next to encode it. How can I fill "CUVIDPICPARAMS" struc ??? Is it possible? My algorithm are: For get video stream packet I'm use ffmpeg-dev libs avcodec, avformat... My steps: 1) Open input file: avformat_open_input(&ff_formatContext,in_filename,nullptr,nullptr); 2) Get video stream property's: avformat_find_stream_info(ff_formatContext,nullptr); 3) Get video stream: ff_video_stream=ff