fix(server): h264 videos failing to transcode in two-pass mode (#3053)

* set `-fps_mode` to passthrough

* updated tests
This commit is contained in:
Mert 2023-06-30 21:48:40 -04:00 committed by GitHub
parent b1fcf02d13
commit f9671dfbf7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 36 additions and 4 deletions

View File

@ -232,7 +232,14 @@ describe(MediaService.name, () => {
'/original/path.ext',
'upload/encoded-video/user-id/asset-id.mp4',
{
outputOptions: ['-vcodec h264', '-acodec aac', '-movflags faststart', '-preset ultrafast', '-crf 23'],
outputOptions: [
'-vcodec h264',
'-acodec aac',
'-movflags faststart',
'-fps_mode passthrough',
'-preset ultrafast',
'-crf 23',
],
twoPass: false,
},
);
@ -261,7 +268,14 @@ describe(MediaService.name, () => {
'/original/path.ext',
'upload/encoded-video/user-id/asset-id.mp4',
{
outputOptions: ['-vcodec h264', '-acodec aac', '-movflags faststart', '-preset ultrafast', '-crf 23'],
outputOptions: [
'-vcodec h264',
'-acodec aac',
'-movflags faststart',
'-fps_mode passthrough',
'-preset ultrafast',
'-crf 23',
],
twoPass: false,
},
);
@ -279,6 +293,7 @@ describe(MediaService.name, () => {
'-vcodec h264',
'-acodec aac',
'-movflags faststart',
'-fps_mode passthrough',
'-vf scale=-2:720',
'-preset ultrafast',
'-crf 23',
@ -299,7 +314,14 @@ describe(MediaService.name, () => {
'/original/path.ext',
'upload/encoded-video/user-id/asset-id.mp4',
{
outputOptions: ['-vcodec h264', '-acodec aac', '-movflags faststart', '-preset ultrafast', '-crf 23'],
outputOptions: [
'-vcodec h264',
'-acodec aac',
'-movflags faststart',
'-fps_mode passthrough',
'-preset ultrafast',
'-crf 23',
],
twoPass: false,
},
);
@ -318,6 +340,7 @@ describe(MediaService.name, () => {
'-vcodec h264',
'-acodec aac',
'-movflags faststart',
'-fps_mode passthrough',
'-vf scale=720:-2',
'-preset ultrafast',
'-crf 23',
@ -340,6 +363,7 @@ describe(MediaService.name, () => {
'-vcodec h264',
'-acodec aac',
'-movflags faststart',
'-fps_mode passthrough',
'-vf scale=-2:720',
'-preset ultrafast',
'-crf 23',
@ -362,6 +386,7 @@ describe(MediaService.name, () => {
'-vcodec h264',
'-acodec aac',
'-movflags faststart',
'-fps_mode passthrough',
'-vf scale=-2:720',
'-preset ultrafast',
'-crf 23',
@ -392,6 +417,7 @@ describe(MediaService.name, () => {
'-vcodec h264',
'-acodec aac',
'-movflags faststart',
'-fps_mode passthrough',
'-vf scale=-2:720',
'-preset ultrafast',
'-crf 23',
@ -419,6 +445,7 @@ describe(MediaService.name, () => {
'-vcodec h264',
'-acodec aac',
'-movflags faststart',
'-fps_mode passthrough',
'-vf scale=-2:720',
'-preset ultrafast',
'-b:v 3104k',
@ -443,6 +470,7 @@ describe(MediaService.name, () => {
'-vcodec h264',
'-acodec aac',
'-movflags faststart',
'-fps_mode passthrough',
'-vf scale=-2:720',
'-preset ultrafast',
'-crf 23',
@ -468,6 +496,7 @@ describe(MediaService.name, () => {
'-vcodec vp9',
'-acodec aac',
'-movflags faststart',
'-fps_mode passthrough',
'-vf scale=-2:720',
'-cpu-used 5',
'-row-mt 1',
@ -496,6 +525,7 @@ describe(MediaService.name, () => {
'-vcodec vp9',
'-acodec aac',
'-movflags faststart',
'-fps_mode passthrough',
'-vf scale=-2:720',
'-cpu-used 5',
'-row-mt 1',
@ -521,6 +551,7 @@ describe(MediaService.name, () => {
'-vcodec h264',
'-acodec aac',
'-movflags faststart',
'-fps_mode passthrough',
'-vf scale=-2:720',
'-preset ultrafast',
'-threads 2',

View File

@ -222,7 +222,8 @@ export class MediaService {
`-acodec ${ffmpeg.targetAudioCodec}`,
// Makes a second pass moving the moov atom to the beginning of
// the file for improved playback speed.
`-movflags faststart`,
'-movflags faststart',
'-fps_mode passthrough',
];
// video dimensions