diff --git a/internal/pkg/mediaconvert/command.go b/internal/pkg/mediaconvert/command.go index 2b68893404..ceb95c85de 100644 --- a/internal/pkg/mediaconvert/command.go +++ b/internal/pkg/mediaconvert/command.go @@ -76,8 +76,8 @@ func BuildAudioCommand(opts *Options) []string { // BuildRawVideoCommand returns an extremely lightweight ffmpeg command for converting raw video without extra cost. func BuildRawVideoCommand(opts *Options) []string { return append(buildCommonComamnd(opts), - "-c:v", - "copy", + "-c:a", "copy", // Copy audio stream + "-c:v", "copy", // Copy video stream "-hls_time", "5", "-hls_flags", "split_by_time", "-hls_list_size", "0", @@ -101,8 +101,8 @@ func BuildScalingVideoCommand(opts *Options) []string { for _, level := range opts.ScalingLevels { result = append(result, "-vf", "scale=-2:"+level[:len(level)-1], - "-c:v", - "libx264", + "-c:a", "copy", // Copy audio stream + "-c:v", "libx264", "-preset", "veryfast", "-crf", "23", "-g", "60", diff --git a/internal/pkg/mediaconvert/command_test.go b/internal/pkg/mediaconvert/command_test.go index 42ddc4ea4d..b67fe8060b 100644 --- a/internal/pkg/mediaconvert/command_test.go +++ b/internal/pkg/mediaconvert/command_test.go @@ -31,7 +31,7 @@ func Test_BuildVideoCommand_Scaling(t *testing.T) { ScalingLevels: []string{"720p", "480p"}, }) - const expected = `-threads 4 -i pipe:0 -vf scale=-2:720 -c:v libx264 -preset veryfast -crf 23 -g 60 -hls_time 5 -hls_flags split_by_time -hls_list_size 0 -hls_segment_filename test/1/1_%03d_720p.ts test/1/1_720p_master.m3u8 -vf scale=-2:480 -c:v libx264 -preset veryfast -crf 23 -g 60 -hls_time 5 -hls_flags split_by_time -hls_list_size 0 -hls_segment_filename test/1/1_%03d_480p.ts test/1/1_480p_master.m3u8` + const expected = `-threads 4 -i pipe:0 -vf scale=-2:720 -c:a copy -c:v libx264 -preset veryfast -crf 23 -g 60 -hls_time 5 -hls_flags split_by_time -hls_list_size 0 -hls_segment_filename test/1/1_%03d_720p.ts test/1/1_720p_master.m3u8 -vf scale=-2:480 -c:a copy -c:v libx264 -preset veryfast -crf 23 -g 60 -hls_time 5 -hls_flags split_by_time -hls_list_size 0 -hls_segment_filename test/1/1_%03d_480p.ts test/1/1_480p_master.m3u8` require.Contains(t, expected, strings.Join(scaleCommand, " ")) } @@ -45,7 +45,7 @@ func Test_BuildVideoCommand_Raw(t *testing.T) { Level: resconv.Level("651:490"), }) - const expected = `"-threads 4 -i pipe:0 -c:v copy -hls_time 5 -hls_flags split_by_time -hls_list_size 0 -hls_segment_filename test/1/1_%03d_480p.ts test/1/1_480p_master.m3u8` + const expected = `"-threads 4 -i pipe:0 -c:a copy -c:v copy -hls_time 5 -hls_flags split_by_time -hls_list_size 0 -hls_segment_filename test/1/1_%03d_480p.ts test/1/1_480p_master.m3u8` require.Contains(t, expected, strings.Join(rawCommand, " ")) } diff --git a/internal/pkg/resconv/resconv_test.go b/internal/pkg/resconv/resconv_test.go index 48fd291d57..553beb6d05 100644 --- a/internal/pkg/resconv/resconv_test.go +++ b/internal/pkg/resconv/resconv_test.go @@ -91,6 +91,11 @@ func Test_Resconv_ShouldReturnCorrectPrefixes(t *testing.T) { res: "2560:1440", expected: []string{"1080p", "720p"}, }, + { + name: "pixels between 1k and 2k", + res: "2880:1800", + expected: []string{"1080p", "720p"}, + }, { name: "pixels equal to 2k", res: "3840:2160",