migrating podcast in osx from quicktime to ffmpeg (wip)

preferencesAboutTextFull
Clément Fauconnier 6 years ago
parent d75d84b359
commit b8a3712177
  1. 4
      OpenBoard.pro
  2. 8
      src/podcast/UBPodcastController.cpp
  3. 7
      src/podcast/ffmpeg/UBFFmpegVideoEncoder.cpp
  4. 5
      src/podcast/ffmpeg/UBFFmpegVideoEncoder.h
  5. 32
      src/podcast/podcast.pri

@ -44,6 +44,8 @@ QT += printsupport
QT += core QT += core
INCLUDEPATH += src INCLUDEPATH += src
INCLUDEPATH += /usr/local/opt/openssl/include
INCLUDEPATH += /usr/local/opt/ffmpeg/include
include($$THIRD_PARTY_PATH/libs.pri) include($$THIRD_PARTY_PATH/libs.pri)
include(src/adaptors/adaptors.pri) include(src/adaptors/adaptors.pri)
@ -162,6 +164,8 @@ macx {
LIBS += -framework AVFoundation LIBS += -framework AVFoundation
LIBS += -framework CoreMedia LIBS += -framework CoreMedia
LIBS += -lcrypto LIBS += -lcrypto
LIBS += -L/usr/local/opt/openssl/lib
LIBS += -L/usr/local/opt/ffmpeg/lib
CONFIG(release, debug|release):CONFIG += x86_64 CONFIG(release, debug|release):CONFIG += x86_64
CONFIG(debug, debug|release):CONFIG += x86_64 CONFIG(debug, debug|release):CONFIG += x86_64

@ -62,8 +62,8 @@
#include "windowsmedia/UBWindowsMediaVideoEncoder.h" #include "windowsmedia/UBWindowsMediaVideoEncoder.h"
#include "windowsmedia/UBWaveRecorder.h" #include "windowsmedia/UBWaveRecorder.h"
#elif defined(Q_OS_OSX) #elif defined(Q_OS_OSX)
#include "quicktime/UBQuickTimeVideoEncoder.h" #include "ffmpeg/UBFFmpegVideoEncoder.h"
#include "quicktime/UBAudioQueueRecorder.h" #include "ffmpeg/UBMicrophoneInput.h"
#elif defined(Q_OS_LINUX) #elif defined(Q_OS_LINUX)
#include "ffmpeg/UBFFmpegVideoEncoder.h" #include "ffmpeg/UBFFmpegVideoEncoder.h"
#include "ffmpeg/UBMicrophoneInput.h" #include "ffmpeg/UBMicrophoneInput.h"
@ -311,7 +311,7 @@ void UBPodcastController::start()
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
mVideoEncoder = new UBWindowsMediaVideoEncoder(this); //deleted on stop mVideoEncoder = new UBWindowsMediaVideoEncoder(this); //deleted on stop
#elif defined(Q_OS_OSX) #elif defined(Q_OS_OSX)
mVideoEncoder = new UBQuickTimeVideoEncoder(this); //deleted on stop mVideoEncoder = new UBFFmpegVideoEncoder(this);
#elif defined(Q_OS_LINUX) #elif defined(Q_OS_LINUX)
mVideoEncoder = new UBFFmpegVideoEncoder(this); mVideoEncoder = new UBFFmpegVideoEncoder(this);
#endif #endif
@ -808,7 +808,7 @@ QStringList UBPodcastController::audioRecordingDevices()
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
devices = UBWaveRecorder::waveInDevices(); devices = UBWaveRecorder::waveInDevices();
#elif defined(Q_OS_OSX) #elif defined(Q_OS_OSX)
devices = UBAudioQueueRecorder::waveInDevices(); devices = UBMicrophoneInput::availableDevicesNames();
#elif defined(Q_OS_LINUX) #elif defined(Q_OS_LINUX)
devices = UBMicrophoneInput::availableDevicesNames(); devices = UBMicrophoneInput::availableDevicesNames();
#endif #endif

@ -562,9 +562,16 @@ void UBFFmpegVideoEncoder::processAudio(QByteArray &data)
} }
// Convert to destination format // Convert to destination format
qDebug() << mSwrContext;
qDebug() << outSamples;
qDebug() << outSamplesCount;
qDebug() << inSamples;
qDebug() << inSamplesCount;
ret = swr_convert(mSwrContext, ret = swr_convert(mSwrContext,
outSamples, outSamplesCount, outSamples, outSamplesCount,
(const uint8_t **)&inSamples, inSamplesCount); (const uint8_t **)&inSamples, inSamplesCount);
if (ret < 0) { if (ret < 0) {
qWarning() << "Error converting audio samples: " << avErrorToQString(ret); qWarning() << "Error converting audio samples: " << avErrorToQString(ret);
return; return;

@ -36,7 +36,10 @@ extern "C" {
#include <libswscale/swscale.h> #include <libswscale/swscale.h>
// Due to the whole ffmpeg / libAV silliness, we have to support libavresample on some platforms // Due to the whole ffmpeg / libAV silliness, we have to support libavresample on some platforms
#if LIBAVFORMAT_VERSION_MICRO > 100 // Should libswresample be used with libavformat.*.*.100 ? compiles fine but crashes in swr_convert (internal call of soxr_create causes a SIGSEV (EXC_BAD_ACCESS))
// Bad config ?
// With libavresample, no crash, but the sound is inaudible (lot of noise)
#if LIBAVFORMAT_VERSION_MICRO >= 100
#include <libswresample/swresample.h> #include <libswresample/swresample.h>
#else #else
#include <libavresample/avresample.h> #include <libavresample/avresample.h>

@ -23,15 +23,33 @@ win32 {
} }
macx { macx {
CONFIG += c++11
SOURCES += src/podcast/quicktime/UBQuickTimeVideoEncoder.cpp \ SOURCES += src/podcast/ffmpeg/UBFFmpegVideoEncoder.cpp \
src/podcast/quicktime/UBAudioQueueRecorder.cpp src/podcast/ffmpeg/UBMicrophoneInput.cpp
HEADERS += src/podcast/quicktime/UBQuickTimeVideoEncoder.h \ HEADERS += src/podcast/ffmpeg/UBFFmpegVideoEncoder.h \
src/podcast/quicktime/UBQuickTimeFile.h \ src/podcast/ffmpeg/UBMicrophoneInput.h
src/podcast/quicktime/UBAudioQueueRecorder.h
LIBS += -lavformat -lavcodec -lswscale -lavutil \
OBJECTIVE_SOURCES += src/podcast/quicktime/UBQuickTimeFile.mm -lpthread -lvpx -lvorbisenc -lfreetype -llzma -lbz2 -lz -ldl -lswresample -lswscale -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
#--with-libvidstab --with-opencore-amr --with-openh264 --with-openjpeg --with-openssl --with-rtmpdump --with-rubberband --with-sdl2
#--with-snappy --with-tools --with-webp --with-x265 --with-xz --with-zeromq --with-zimg
# brew install opus
LIBS += -L/usr/local/opt/x264/lib
LIBS += -L/usr/local/opt/sdl/lib
LIBS += -L/usr/local/opt/libvorbis/lib
LIBS += -L/usr/local/opt/libvpx/lib
LIBS += -L/usr/local/opt/theora/lib
LIBS += -L/usr/local/opt/libogg/lib
LIBS += -L/usr/local/opt/opus/lib
LIBS += -L/usr/local/opt/lame/lib
LIBS += -L/usr/local/opt/fdk-aac/lib
LIBS += -L/usr/local/opt/libass/lib
} }
linux-g++* { linux-g++* {

Loading…
Cancel
Save