Default to AAC audio codec (#135)

* Adding strict experimental to FFmpegReader and Writer (hopefully allowing all the encoders to be used)

(cherry picked from commit 1bcd1e5)

* init all formats and codecs before checking if valid

(cherry picked from commit 7250226)
This commit is contained in:
Jonathan Thomas
2018-06-29 15:06:34 -05:00
committed by GitHub
parent ef1fb6320b
commit 9972600931
2 changed files with 37 additions and 4 deletions

View File

@@ -156,10 +156,18 @@ void FFmpegReader::Open()
if (pCodec == NULL) {
throw InvalidCodec("A valid video codec could not be found for this file.", path);
}
// Init options
AVDictionary *opts = NULL;
av_dict_set(&opts, "strict", "experimental", 0);
// Open video codec
if (avcodec_open2(pCodecCtx, pCodec, NULL) < 0)
if (avcodec_open2(pCodecCtx, pCodec, &opts) < 0)
throw InvalidCodec("A video codec was found, but could not be opened.", path);
// Free options
av_dict_free(&opts);
// Update the File Info struct with video details (if a video stream is found)
UpdateVideoInfo();
}
@@ -186,10 +194,18 @@ void FFmpegReader::Open()
if (aCodec == NULL) {
throw InvalidCodec("A valid audio codec could not be found for this file.", path);
}
// Init options
AVDictionary *opts = NULL;
av_dict_set(&opts, "strict", "experimental", 0);
// Open audio codec
if (avcodec_open2(aCodecCtx, aCodec, NULL) < 0)
if (avcodec_open2(aCodecCtx, aCodec, &opts) < 0)
throw InvalidCodec("An audio codec was found, but could not be opened.", path);
// Free options
av_dict_free(&opts);
// Update the File Info struct with audio details (if an audio stream is found)
UpdateAudioInfo();
}