Skip to content

Commit

Permalink
Add ffmpeg6 support
Browse files Browse the repository at this point in the history
  • Loading branch information
ioppermann committed Feb 5, 2024
1 parent 92ce3b5 commit 2c88c4d
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/version.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import pkg from '../package.json';

const Core = '^16.11.0';
const FFmpeg = '^5.1.0';
const FFmpeg = '^5.1.0 || ^6.1.0';
const UI = pkg.bundle ? pkg.bundle : pkg.name + ' v' + pkg.version;
const Version = pkg.version;

Expand Down
34 changes: 34 additions & 0 deletions src/views/Edit/Sources/Network.js
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,23 @@ const createInputs = (settings, config, skills) => {
if (settings.general.analyzeduration_rtmp !== 5000000) {
input.options.push('-analyzeduration', settings.general.analyzeduration_rtmp);
}

if (ffmpeg_version === 6) {
const codecs = [];
if (skills.codecs.video.hevc?.length > 0) {
codecs.push('hvc1');
}
if (skills.codecs.video.av1?.length > 0) {
codecs.push('av01');
}
if (skills.codecs.video.vp9?.length > 0) {
codecs.push('vp09');
}

if (codecs.length !== 0) {
input.options.push('-rtmp_enhanced_codecs', codecs.join(','));
}
}
} else if (settings.push.type === 'srt') {
if (settings.general.analyzeduration !== 5000000) {
input.options.push('-analyzeduration', settings.general.analyzeduration);
Expand All @@ -272,6 +289,23 @@ const createInputs = (settings, config, skills) => {
if (settings.general.analyzeduration_rtmp !== 5000000) {
input.options.push('-analyzeduration', settings.general.analyzeduration_rtmp);
}

if (ffmpeg_version === 6) {
const codecs = [];
if (skills.codecs.video.hevc?.length > 0) {
codecs.push('hvc1');
}
if (skills.codecs.video.av1?.length > 0) {
codecs.push('av01');
}
if (skills.codecs.video.vp9?.length > 0) {
codecs.push('vp09');
}

if (codecs.length !== 0) {
input.options.push('-rtmp_enhanced_codecs', codecs.join(','));
}
}
} else {
if (settings.general.analyzeduration !== 5000000) {
input.options.push('-analyzeduration', settings.general.analyzeduration);
Expand Down
12 changes: 10 additions & 2 deletions src/views/Edit/Sources/Network.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,14 @@ const $skills_ffmpeg6 = {
protocols: {
input: ['http', 'https', 'rtmp', 'rtmps', 'srt'],
},
codecs: {
audio: {},
video: {
av1: ['librav1e'],
hevc: ['hevc'],
vp9: ['libvpx-vp9'],
},
},
};

const $skills_ffmpeg5 = {
Expand Down Expand Up @@ -241,7 +249,7 @@ pullmatrix.tests = [
skills: $skills_ffmpeg6,
input: {
address: 'rtmp://admin:[email protected]/live/stream',
options: ['-fflags', '+genpts', '-thread_queue_size', 512, '-analyzeduration', 3000000],
options: ['-fflags', '+genpts', '-thread_queue_size', 512, '-analyzeduration', 3000000, '-rtmp_enhanced_codecs', 'hvc1,av01,vp09'],
},
},
{
Expand Down Expand Up @@ -438,7 +446,7 @@ pushmatrix.tests = [
config: $config,
input: {
address: '{rtmp,name=external.stream}',
options: ['-fflags', '+genpts', '-thread_queue_size', 512, '-analyzeduration', 3000000],
options: ['-fflags', '+genpts', '-thread_queue_size', 512, '-analyzeduration', 3000000, '-rtmp_enhanced_codecs', 'hvc1,av01,vp09'],
},
},
{
Expand Down

0 comments on commit 2c88c4d

Please sign in to comment.