Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
OpenBoard
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lifo
Nicolas Ollinger
OpenBoard
Commits
bde9c947
Commit
bde9c947
authored
May 18, 2018
by
Clément Fauconnier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed some issues on audio resampling
parent
b8a37121
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
13 deletions
+26
-13
UBFFmpegVideoEncoder.cpp
src/podcast/ffmpeg/UBFFmpegVideoEncoder.cpp
+10
-11
UBMicrophoneInput.cpp
src/podcast/ffmpeg/UBMicrophoneInput.cpp
+14
-0
podcast.pri
src/podcast/podcast.pri
+2
-2
No files found.
src/podcast/ffmpeg/UBFFmpegVideoEncoder.cpp
View file @
bde9c947
...
...
@@ -392,13 +392,17 @@ bool UBFFmpegVideoEncoder::init()
c
=
mAudioStream
->
codec
;
c
->
bit_rate
=
96000
;
c
->
sample_fmt
=
audioCodec
->
sample_fmts
[
0
];
// FLTP by default for AAC
c
->
sample_fmt
=
audioCodec
->
sample_fmts
?
audioCodec
->
sample_fmts
[
0
]
:
AV_SAMPLE_FMT_FLTP
;
// FLTP by default for AAC
c
->
sample_rate
=
mAudioSampleRate
;
c
->
channels
=
2
;
c
->
channel_layout
=
av_get_default_channel_layout
(
c
->
channels
);
c
->
profile
=
FF_PROFILE_AAC_MAIN
;
c
->
time_base
=
{
1
,
mAudioSampleRate
};
c
->
strict_std_compliance
=
-
2
;
// Enable use of experimental codec
c
->
channel_layout
=
AV_CH_LAYOUT_STEREO
;
c
->
channels
=
av_get_channel_layout_nb_channels
(
c
->
channel_layout
);
//https://trac.ffmpeg.org/wiki/Encode/H.264#Profile
//Omit this unless your target device only supports a certain profile
//(see https://trac.ffmpeg.org/wiki/Encode/H.264#Compatibility).
//c->profile = FF_PROFILE_AAC_MAIN;
c
->
time_base
=
{
1
,
c
->
sample_rate
};
if
(
mOutputFormatContext
->
oformat
->
flags
&
AVFMT_GLOBALHEADER
)
c
->
flags
|=
AV_CODEC_FLAG_GLOBAL_HEADER
;
...
...
@@ -562,11 +566,6 @@ void UBFFmpegVideoEncoder::processAudio(QByteArray &data)
}
// Convert to destination format
qDebug
()
<<
mSwrContext
;
qDebug
()
<<
outSamples
;
qDebug
()
<<
outSamplesCount
;
qDebug
()
<<
inSamples
;
qDebug
()
<<
inSamplesCount
;
ret
=
swr_convert
(
mSwrContext
,
outSamples
,
outSamplesCount
,
...
...
src/podcast/ffmpeg/UBMicrophoneInput.cpp
View file @
bde9c947
...
...
@@ -42,6 +42,18 @@ bool UBMicrophoneInput::init()
}
mAudioFormat
=
mAudioDeviceInfo
.
preferredFormat
();
/*
* https://ffmpeg.org/doxygen/3.1/group__lavu__sampfmts.html#gaf9a51ca15301871723577c730b5865c5
The data described by the sample format is always in native-endian order.
Sample values can be expressed by native C types, hence the lack of a signed 24-bit sample format
even though it is a common raw audio data format.
If a signed 24-bit sample format is natively preferred, we a set signed 16-bit sample format instead.
*/
if
(
mAudioFormat
.
sampleSize
()
==
24
)
mAudioFormat
.
setSampleSize
(
16
);
mAudioInput
=
new
QAudioInput
(
mAudioDeviceInfo
,
mAudioFormat
,
NULL
);
connect
(
mAudioInput
,
SIGNAL
(
stateChanged
(
QAudio
::
State
)),
...
...
@@ -294,6 +306,8 @@ QString UBMicrophoneInput::getErrorString(QAudio::Error errorCode)
case
QAudio
:
:
FatalError
:
return
"Fatal error; audio device unusable"
;
default
:
return
"unhandled error..."
;
}
return
""
;
}
src/podcast/podcast.pri
View file @
bde9c947
...
...
@@ -31,8 +31,8 @@ macx {
HEADERS += src/podcast/ffmpeg/UBFFmpegVideoEncoder.h \
src/podcast/ffmpeg/UBMicrophoneInput.h
LIBS += -lavformat -lavcodec -lswscale -lavutil \
-lpthread -lvpx -lvorbisenc -lfreetype -llzma -lbz2 -lz -ldl -lswresample -lswscale
-lavutil -lm
LIBS += -lavformat -lavcodec -lswscale
-lswresample
-lavutil \
-lpthread -lvpx -lvorbisenc -lfreetype -llzma -lbz2 -lz -ldl
-lavutil -lm
# (ffmpeg-4.0 with all options (to clean))
# brew install ffmpeg --with-chromaprint --with-fdk-aac --with-libass --with-librsvg --with-libsoxr --with-libssh --with-tesseract
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment