Skip to content

Commit 0072283

Browse files
committed
Fixing the problem with videos that do not have audio tracks.
Videos are now probed using ffprobe to determine the correct video track indexes instead of using hardcoded 0 and 5 in the filter graph. Videos that do not have audio tracks now show a small "speaker muted" icon in the top right corner of the thumbnail.
1 parent 39d42ba commit 0072283

15 files changed

Lines changed: 225 additions & 45 deletions

scripts/360.avfilter

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,4 +58,4 @@ crop=64:1344:x=0:y=0,format=yuvj420p,scale=96:1344[TOPFRAME_overlap_slice],
5858
[BOTTOM_BACK_frames_joined][TOPFRAME_completed]hstack[BOTTOM_BACK_TOP_completed],
5959

6060
[LEFT_CENTER_RIGHT_completed][BOTTOM_BACK_TOP_completed]vstack[FULL_EAC_FRAME],
61-
[FULL_EAC_FRAME]v360=eac:equirect:interp=cubic:roll=PARAM_ROLL:pitch=PARAM_PITCH:yaw=PARAM_YAW,crop=4032:2388:x=0:y=0[OUTPUT_FRAME]
61+
[FULL_EAC_FRAME]v360=eac:equirect:interp=cubic:roll=PARAM_ROLL:pitch=PARAM_PITCH:yaw=PARAM_YAW,crop=4032:2388:x=0:y=0[OUTPUT_FRAME]

src/VideoConversionApp.Tests/VideoConversionTests.cs

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,20 @@ public class VideoConversionTests
1111
[Fact]
1212
public async Task ShouldConvertVideos()
1313
{
14-
var videoDir = "/drive/data/Media/VideoEditing/ProjectDirs/TestingVideos";
14+
var videoDir = "/drive/data/Media/VideoEditing/ProjectDirs/TestingVideos2";
1515
var tmpDir = Path.Combine(Path.GetTempPath(), "videoConversionTests");
16+
1617
Directory.CreateDirectory(tmpDir);
1718

19+
var mockLogger = new Mock<ILogger>();
20+
var configManager = new ConfigManager();
21+
configManager.LoadConfigurations("test.config");
22+
configManager.GetConfig<ConversionConfig>()!.OutputBesideOriginals = false;
23+
configManager.GetConfig<ConversionConfig>()!.OutputDirectory = tmpDir;
24+
1825
var filterFactory = new AvFilterFactory();
1926
var poolManager = new VideoPoolManager();
20-
var videoInfoService = new VideoInfoService();
27+
var videoInfoService = new VideoInfoService(configManager, mockLogger.Object);
2128
var vids = Directory.GetFiles(videoDir, "*.360");
2229

2330
foreach (var vid in vids)
@@ -26,12 +33,7 @@ public async Task ShouldConvertVideos()
2633
poolManager.AddVideoToPool(maxVideo);
2734
}
2835

29-
var mockLogger = new Mock<ILogger>();
30-
31-
var configManager = new ConfigManager();
32-
configManager.LoadConfigurations("test.config");
33-
configManager.GetConfig<ConversionConfig>()!.OutputBesideOriginals = false;
34-
configManager.GetConfig<ConversionConfig>()!.OutputDirectory = tmpDir;
36+
3537

3638
var queueEntries = poolManager.VideoPool.Select(x => new VideoRenderQueueEntry(x)).ToList();
3739
var conversionService = new VideoConverterService(configManager, filterFactory, mockLogger.Object);

src/VideoConversionApp.Tests/VideoInfoServiceTests.cs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
using VideoConversionApp.Services;
1+
using Moq;
2+
using VideoConversionApp.Abstractions;
3+
using VideoConversionApp.Config;
4+
using VideoConversionApp.Services;
25

36
namespace VideoConversionApp.Tests;
47

@@ -8,7 +11,14 @@ public class VideoInfoServiceTests
811
public async Task TestGetMediaInfo()
912
{
1013
var mediaFile = "/drive/data/Media/VideoEditing/ProjectDirs/Snouk Season 24-25/GS010176.360";
11-
var service = new VideoInfoService();
14+
var tmpDir = Path.Combine(Path.GetTempPath(), "videoConversionTests");
15+
16+
var mockLogger = new Mock<ILogger>();
17+
var configManager = new ConfigManager();
18+
configManager.LoadConfigurations("test.config");
19+
configManager.GetConfig<ConversionConfig>()!.OutputBesideOriginals = false;
20+
configManager.GetConfig<ConversionConfig>()!.OutputDirectory = tmpDir;
21+
var service = new VideoInfoService(configManager, mockLogger.Object);
1222

1323
var info = await service.ParseMediaAsync(mediaFile);
1424

src/VideoConversionApp/Abstractions/IAvFilterFactory.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,13 @@ public interface IAvFilterFactory
1010
/// <summary>
1111
/// Builds an AV filter to be used with FFMPEG -filter_complex based on given parameters.
1212
/// </summary>
13+
/// <param name="videoTrack1Index">Index of the first video stream in the .360 file, these differ depending on
14+
/// whether the video has audio tracks.</param>
15+
/// <param name="videoTrack2Index">Index of the second video stream in the .360 file, these differ depending on
16+
/// whether the video has audio tracks.</param>
1317
/// <param name="frameSelectCondition">Limit frame input/output to this selection</param>
1418
/// <param name="frameRotation">Rotation parameters</param>
1519
/// <returns>Filter string to be used in -filter_complex</returns>
16-
string BuildAvFilter(AvFilterFrameSelectCondition? frameSelectCondition = null,
20+
string BuildAvFilter(int videoTrack1Index, int videoTrack2Index, AvFilterFrameSelectCondition? frameSelectCondition = null,
1721
AvFilterFrameRotation? frameRotation = null);
1822
}

src/VideoConversionApp/Abstractions/IInputVideoInfo.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@ public interface IInputVideoInfo
1111
public DateTime CreatedDateTime { get; }
1212
public long SizeBytes { get; }
1313
public string[]? ValidationIssues { get; }
14+
public int FirstVideoTrack { get; }
15+
public int SecondVideoTrack { get; }
16+
public int FirstAudioTrack { get; }
17+
public int SecondAudioTrack { get; }
18+
public bool HasAudio => FirstAudioTrack != -1;
1419

1520
public static readonly string PlaceHolderFilename = ":placeholder:";
1621
public static bool IsPlaceholderFile(string filename) => filename == PlaceHolderFilename;

src/VideoConversionApp/Resources/StreamingIcons.axaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
<StreamGeometry x:Key="text_expand_regular">M6.75 19.5H21.25C21.6642 19.5 22 19.1642 22 18.75C22 18.3703 21.7178 18.0565 21.3518 18.0068L21.25 18H6.75C6.33579 18 6 18.3358 6 18.75C6 19.1297 6.28215 19.4435 6.64823 19.4932L6.75 19.5Z M6.75 4.5H21.25C21.6642 4.5 22 4.16421 22 3.75C22 3.3703 21.7178 3.05651 21.3518 3.00685L21.25 3H6.75C6.33579 3 6 3.33579 6 3.75C6 4.1297 6.28215 4.44349 6.64823 4.49315L6.75 4.5Z M13.75 8C13.3358 8 13 8.33579 13 8.75C13 9.16421 13.3358 9.5 13.75 9.5H21.25C21.6642 9.5 22 9.16421 22 8.75C22 8.33579 21.6642 8 21.25 8H13.75Z M13 13.75C13 13.3358 13.3358 13 13.75 13H21.25C21.6642 13 22 13.3358 22 13.75C22 14.1642 21.6642 14.5 21.25 14.5H13.75C13.3358 14.5 13 14.1642 13 13.75Z M11 11.5C11 13.9853 8.98528 16 6.5 16C4.01472 16 2 13.9853 2 11.5C2 9.01472 4.01472 7 6.5 7C8.98528 7 11 9.01472 11 11.5ZM7 9.5C7 9.22386 6.77614 9 6.5 9C6.22386 9 6 9.22386 6 9.5V11H4.5C4.22386 11 4 11.2239 4 11.5C4 11.7761 4.22386 12 4.5 12H6L6 13.5C6 13.7761 6.22386 14 6.5 14C6.77614 14 7 13.7761 7 13.5V12H8.5C8.77614 12 9 11.7761 9 11.5C9 11.2239 8.77614 11 8.5 11H7V9.5Z</StreamGeometry>
3737
<StreamGeometry x:Key="remove_regular">M3.7547787,12.4995322 L20.2466903,12.4995322 C20.6609039,12.4995322 20.9966903,12.1637458 20.9966903,11.7495322 C20.9966903,11.3353187 20.6609039,10.9995322 20.2466903,10.9995322 L3.7547787,10.9995322 C3.34056514,10.9995322 3.0047787,11.3353187 3.0047787,11.7495322 C3.0047787,12.1637458 3.34056514,12.4995322 3.7547787,12.4995322 Z</StreamGeometry>
3838
<StreamGeometry x:Key="spinner_ios_regular">M10,3 C6.13401,3 3,6.13401 3,10 C3,10.2761 2.77614,10.5 2.5,10.5 C2.22386,10.5 2,10.2761 2,10 C2,5.58172 5.58172,2 10,2 C14.4183,2 18,5.58172 18,10 C18,14.4183 14.4183,18 10,18 C9.72386,18 9.5,17.7761 9.5,17.5 C9.5,17.2239 9.72386,17 10,17 C13.866,17 17,13.866 17,10 C17,6.13401 13.866,3 10,3 Z</StreamGeometry>
39+
<StreamGeometry x:Key="speaker_off_regular">M28 29.7678L41.8661 43.6339C42.3543 44.122 43.1457 44.122 43.6339 43.6339C44.122 43.1457 44.122 42.3543 43.6339 41.8661L6.13388 4.36612C5.64573 3.87796 4.85427 3.87796 4.36611 4.36612C3.87796 4.85427 3.87796 5.64573 4.36611 6.13388L13.2322 15H9C6.10051 15 3.75 17.3505 3.75 20.25V27.75C3.75 30.6495 6.10051 33 9 33H13.702C14.8734 33 16.0034 33.4328 16.875 34.2153L25.081 41.5815C26.2077 42.5929 28 41.7933 28 40.2793V29.7678ZM25.5 27.2678V38.5981L18.5451 32.3549C17.2146 31.1606 15.4898 30.5 13.702 30.5H9C7.48122 30.5 6.25 29.2688 6.25 27.75V20.25C6.25 18.7312 7.48122 17.5 9 17.5H13.702C14.3147 17.5 14.92 17.4224 15.5046 17.2723L25.5 27.2678Z M19.8115 14.5082L18.0412 12.7379L25.081 6.41847C26.2076 5.40709 28 6.20669 28 7.72074V22.6967L25.5 20.1967V9.40185L19.8115 14.5082Z M36.1857 30.8824L34.335 29.0317C34.966 27.7376 35.5 26.0404 35.5 24C35.5 21.5224 34.7127 19.5507 33.9203 18.1923C33.5242 17.5133 33.1298 16.9931 32.8397 16.6477C32.695 16.4754 32.577 16.3476 32.499 16.2664C32.46 16.2259 32.4311 16.197 32.414 16.1802L32.3972 16.164L32.398 16.1646C31.8935 15.6947 31.8647 14.9048 32.334 14.3994C32.8038 13.8935 33.5947 13.8642 34.1006 14.334L33.25 15.25C34.1006 14.334 34.1014 14.3347 34.1014 14.3347L34.1022 14.3356L34.1042 14.3374L34.1092 14.3421L34.1228 14.355C34.1336 14.3653 34.1476 14.3788 34.1646 14.3955C34.1987 14.4289 34.245 14.4753 34.3018 14.5343C34.4152 14.6524 34.5707 14.8215 34.754 15.0398C35.1202 15.4757 35.6008 16.1117 36.0797 16.9327C37.0373 18.5743 38 20.9776 38 24C38 26.9108 37.1071 29.2474 36.1857 30.8824Z M41.0185 35.7152L39.1733 33.87C40.3712 31.5479 41.5 28.2383 41.5 24C41.5 19.4474 40.1976 15.9662 38.906 13.6297C38.2594 12.46 37.6157 11.5776 37.1403 10.9943C36.9028 10.7028 36.708 10.4867 36.5767 10.3474C36.511 10.2777 36.4614 10.2274 36.4303 10.1965C36.4148 10.181 36.4039 10.1704 36.398 10.1648L36.3949 10.1617L36.393 10.16C35.8916 9.68785 35.8665 8.89867 36.3376 8.39562C36.8094 7.89169 37.6004 7.8657 38.1044 8.33755L37.2501 9.24987C38.1044 8.33755 38.1053 8.33839 38.1053 8.33839L38.1063 8.33935L38.1087 8.34162L38.115 8.34761L38.1336 8.36536C38.1485 8.37975 38.1685 8.39926 38.1932 8.42388C38.2427 8.4731 38.3112 8.54276 38.396 8.6327C38.5655 8.81253 38.8003 9.07375 39.0784 9.41509C39.6343 10.0974 40.3656 11.1025 41.094 12.4203C42.5524 15.0587 44 18.9526 44 24C44 29.0474 42.5524 32.9412 41.094 35.5797L41.0739 35.6159L41.0185 35.7152Z</StreamGeometry>
3940

4041

4142
</ResourceDictionary>

src/VideoConversionApp/Resources/transform-template.avfilter

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,56 @@
1-
[0:0]{FRAME_SELECT_EXPRESSION}crop=624:1344:x=0:y=0,format=yuvj420p[LEFTFRAME_left_slice],
2-
[0:0]{FRAME_SELECT_EXPRESSION}crop=128:1344:x=624:y=0,format=yuvj420p,
1+
[0:{V0}]{FRAME_SELECT_EXPRESSION}crop=624:1344:x=0:y=0,format=yuvj420p[LEFTFRAME_left_slice],
2+
[0:{V0}]{FRAME_SELECT_EXPRESSION}crop=128:1344:x=624:y=0,format=yuvj420p,
33
geq=
44
lum='if(between(X, 0, 64), (p((X+64),Y)*(((X+1))/65))+(p(X,Y)*((65-((X+1)))/65)), p(X,Y))':
55
cb='if(between(X, 0, 64), (p((X+64),Y)*(((X+1))/65))+(p(X,Y)*((65-((X+1)))/65)), p(X,Y))':
66
cr='if(between(X, 0, 64), (p((X+64),Y)*(((X+1))/65))+(p(X,Y)*((65-((X+1)))/65)), p(X,Y))':
77
a='if(between(X, 0, 64), (p((X+64),Y)*(((X+1))/65))+(p(X,Y)*((65-((X+1)))/65)), p(X,Y))',
88
crop=64:1344:x=0:y=0,format=yuvj420p,scale=96:1344[LEFTFRAME_overlap_slice],
9-
[0:0]{FRAME_SELECT_EXPRESSION}crop=624:1344:x=752:y=0,format=yuvj420p[LEFTFRAME_right_slice],
9+
[0:{V0}]{FRAME_SELECT_EXPRESSION}crop=624:1344:x=752:y=0,format=yuvj420p[LEFTFRAME_right_slice],
1010
[LEFTFRAME_left_slice][LEFTFRAME_overlap_slice]hstack[LEFTFRAME_left_and_overlap_joined],
1111
[LEFTFRAME_left_and_overlap_joined][LEFTFRAME_right_slice]hstack[LEFTFRAME_completed],
1212

13-
[0:0]{FRAME_SELECT_EXPRESSION}crop=1344:1344:1376:0[CENTERFRAME_completed],
13+
[0:{V0}]{FRAME_SELECT_EXPRESSION}crop=1344:1344:1376:0[CENTERFRAME_completed],
1414

15-
[0:0]{FRAME_SELECT_EXPRESSION}crop=624:1344:x=2720:y=0,format=yuvj420p[RIGHTFRAME_left_slice],
16-
[0:0]{FRAME_SELECT_EXPRESSION}crop=128:1344:x=3344:y=0,format=yuvj420p,
15+
[0:{V0}]{FRAME_SELECT_EXPRESSION}crop=624:1344:x=2720:y=0,format=yuvj420p[RIGHTFRAME_left_slice],
16+
[0:{V0}]{FRAME_SELECT_EXPRESSION}crop=128:1344:x=3344:y=0,format=yuvj420p,
1717
geq=
1818
lum='if(between(X, 0, 64), (p((X+64),Y)*(((X+1))/65))+(p(X,Y)*((65-((X+1)))/65)), p(X,Y))':
1919
cb='if(between(X, 0, 64), (p((X+64),Y)*(((X+1))/65))+(p(X,Y)*((65-((X+1)))/65)), p(X,Y))':
2020
cr='if(between(X, 0, 64), (p((X+64),Y)*(((X+1))/65))+(p(X,Y)*((65-((X+1)))/65)), p(X,Y))':
2121
a='if(between(X, 0, 64), (p((X+64),Y)*(((X+1))/65))+(p(X,Y)*((65-((X+1)))/65)), p(X,Y))',
2222
crop=64:1344:x=0:y=0,format=yuvj420p,scale=96:1344[RIGHTFRAME_overlap_slice],
23-
[0:0]{FRAME_SELECT_EXPRESSION}crop=624:1344:x=3472:y=0,format=yuvj420p[RIGHTFRAME_right_slice],
23+
[0:{V0}]{FRAME_SELECT_EXPRESSION}crop=624:1344:x=3472:y=0,format=yuvj420p[RIGHTFRAME_right_slice],
2424
[RIGHTFRAME_left_slice][RIGHTFRAME_overlap_slice]hstack[RIGHTFRAME_left_and_overlap_joined],
2525
[RIGHTFRAME_left_and_overlap_joined][RIGHTFRAME_right_slice]hstack[RIGHTFRAME_completed],
2626

2727
[LEFTFRAME_completed][CENTERFRAME_completed]hstack[LEFT_CENTER_frames_joined],
2828
[LEFT_CENTER_frames_joined][RIGHTFRAME_completed]hstack[LEFT_CENTER_RIGHT_completed],
2929

3030

31-
[0:5]{FRAME_SELECT_EXPRESSION}crop=624:1344:x=0:y=0,format=yuvj420p[BOTTOMFRAME_left_slice],
32-
[0:5]{FRAME_SELECT_EXPRESSION}crop=128:1344:x=624:y=0,format=yuvj420p,
31+
[0:{V1}]{FRAME_SELECT_EXPRESSION}crop=624:1344:x=0:y=0,format=yuvj420p[BOTTOMFRAME_left_slice],
32+
[0:{V1}]{FRAME_SELECT_EXPRESSION}crop=128:1344:x=624:y=0,format=yuvj420p,
3333
geq=
3434
lum='if(between(X, 0, 64), (p((X+64),Y)*(((X+1))/65))+(p(X,Y)*((65-((X+1)))/65)), p(X,Y))':
3535
cb='if(between(X, 0, 64), (p((X+64),Y)*(((X+1))/65))+(p(X,Y)*((65-((X+1)))/65)), p(X,Y))':
3636
cr='if(between(X, 0, 64), (p((X+64),Y)*(((X+1))/65))+(p(X,Y)*((65-((X+1)))/65)), p(X,Y))':
3737
a='if(between(X, 0, 64), (p((X+64),Y)*(((X+1))/65))+(p(X,Y)*((65-((X+1)))/65)), p(X,Y))',
3838
crop=64:1344:x=0:y=0,format=yuvj420p,scale=96:1344[BOTTOMFRAME_overlap_slice],
39-
[0:5]{FRAME_SELECT_EXPRESSION}crop=624:1344:x=752:y=0,format=yuvj420p[BOTTOMFRAME_right_slice],
39+
[0:{V1}]{FRAME_SELECT_EXPRESSION}crop=624:1344:x=752:y=0,format=yuvj420p[BOTTOMFRAME_right_slice],
4040
[BOTTOMFRAME_left_slice][BOTTOMFRAME_overlap_slice]hstack[BOTTOMFRAME_left_and_overlap_joined],
4141
[BOTTOMFRAME_left_and_overlap_joined][BOTTOMFRAME_right_slice]hstack[BOTTOMFRAME_completed],
4242

43-
[0:5]{FRAME_SELECT_EXPRESSION}crop=1344:1344:1376:0[BACKFRAME_completed],
43+
[0:{V1}]{FRAME_SELECT_EXPRESSION}crop=1344:1344:1376:0[BACKFRAME_completed],
4444

45-
[0:5]{FRAME_SELECT_EXPRESSION}crop=624:1344:x=2720:y=0,format=yuvj420p[TOPFRAME_left_slice],
46-
[0:5]{FRAME_SELECT_EXPRESSION}crop=128:1344:x=3344:y=0,format=yuvj420p,
45+
[0:{V1}]{FRAME_SELECT_EXPRESSION}crop=624:1344:x=2720:y=0,format=yuvj420p[TOPFRAME_left_slice],
46+
[0:{V1}]{FRAME_SELECT_EXPRESSION}crop=128:1344:x=3344:y=0,format=yuvj420p,
4747
geq=
4848
lum='if(between(X, 0, 64), (p((X+64),Y)*(((X+1))/65))+(p(X,Y)*((65-((X+1)))/65)), p(X,Y))':
4949
cb='if(between(X, 0, 64), (p((X+64),Y)*(((X+1))/65))+(p(X,Y)*((65-((X+1)))/65)), p(X,Y))':
5050
cr='if(between(X, 0, 64), (p((X+64),Y)*(((X+1))/65))+(p(X,Y)*((65-((X+1)))/65)), p(X,Y))':
5151
a='if(between(X, 0, 64), (p((X+64),Y)*(((X+1))/65))+(p(X,Y)*((65-((X+1)))/65)), p(X,Y))',
5252
crop=64:1344:x=0:y=0,format=yuvj420p,scale=96:1344[TOPFRAME_overlap_slice],
53-
[0:5]{FRAME_SELECT_EXPRESSION}crop=624:1344:x=3472:y=0,format=yuvj420p[TOPFRAME_right_slice],
53+
[0:{V1}]{FRAME_SELECT_EXPRESSION}crop=624:1344:x=3472:y=0,format=yuvj420p[TOPFRAME_right_slice],
5454
[TOPFRAME_left_slice][TOPFRAME_overlap_slice]hstack[TOPFRAME_left_and_overlap_joined],
5555
[TOPFRAME_left_and_overlap_joined][TOPFRAME_right_slice]hstack[TOPFRAME_completed],
5656

src/VideoConversionApp/Services/AvFilterFactory.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@ public class AvFilterFactory : IAvFilterFactory
1919

2020
public AvFilterFactory()
2121
{
22-
// using var resourceStream = AssetLoader.Open(
23-
// new Uri("avares://VideoConversionApp/Resources/transform-template.avfilter"));
2422
var assembly = GetType().Assembly;
2523
var filter = assembly
2624
.GetManifestResourceNames()
@@ -30,7 +28,7 @@ public AvFilterFactory()
3028
_avFilterTemplate = reader.ReadToEnd();
3129
}
3230

33-
public string BuildAvFilter(AvFilterFrameSelectCondition? frameSelectCondition = null,
31+
public string BuildAvFilter(int videoTrack1Index, int videoTrack2Index, AvFilterFrameSelectCondition? frameSelectCondition = null,
3432
AvFilterFrameRotation? frameRotation = null)
3533
{
3634
var filter = _avFilterTemplate;
@@ -61,6 +59,9 @@ public string BuildAvFilter(AvFilterFrameSelectCondition? frameSelectCondition =
6159
: string.Empty;
6260
filter = filter.Replace("{FRAME_SELECT_EXPRESSION}", frameSelectionExpression);
6361

62+
filter = filter.Replace("{V0}", videoTrack1Index.ToString());
63+
filter = filter.Replace("{V1}", videoTrack2Index.ToString());
64+
6465
// Rotation.
6566
var yaw = frameRotation?.Yaw ?? 0;
6667
var pitch = frameRotation?.Pitch ?? 0;

src/VideoConversionApp/Services/VideoConverterService.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,8 @@ private async Task RenderVideo(VideoRenderQueueEntry entry, CancellationToken ca
347347
var pathsConfig = _configManager.GetConfig<PathsConfig>()!;
348348
var conversionConfig = _configManager.GetConfig<ConversionConfig>()!;
349349

350-
var avFilterString = _avFilterFactory.BuildAvFilter(new AvFilterFrameSelectCondition(), rotation);
350+
var avFilterString = _avFilterFactory.BuildAvFilter(inputVideoInfo.FirstVideoTrack, inputVideoInfo.SecondVideoTrack,
351+
new AvFilterFrameSelectCondition(), rotation);
351352

352353
// Do this better later. Right now, the presets "prores" and "cfhd" render to mov container and
353354
// bluntly assume the rest to be mp4...
@@ -359,7 +360,7 @@ private async Task RenderVideo(VideoRenderQueueEntry entry, CancellationToken ca
359360

360361
var outputVideoFullFilename = GetFilenameFromPattern(video, conversionConfig.OutputFilenamePattern) + $".{fileNameExtension}";
361362
if (conversionConfig.OutputBesideOriginals)
362-
outputVideoFullFilename = Path.Combine(Path.GetDirectoryName(video.InputVideoInfo.Filename)!, outputVideoFullFilename);
363+
outputVideoFullFilename = Path.Combine(Path.GetDirectoryName(inputVideoInfo.Filename)!, outputVideoFullFilename);
363364
else
364365
outputVideoFullFilename = Path.Combine(conversionConfig.OutputDirectory, outputVideoFullFilename);
365366

@@ -398,7 +399,7 @@ private async Task RenderVideo(VideoRenderQueueEntry entry, CancellationToken ca
398399
"-c:v", conversionConfig.CodecVideo,
399400
"-f", conversionConfig.UseCustomEncodingSettings ? conversionConfig.CustomContainerName : "mov"
400401
};
401-
if (conversionConfig.OutputAudio)
402+
if (conversionConfig.OutputAudio && inputVideoInfo.HasAudio)
402403
{
403404
argsList.InsertRange(argsList.IndexOf("-map"), "-map", "0:a:0");
404405
argsList.InsertRange(argsList.IndexOf("-c:v"), "-c:a", conversionConfig.CodecAudio);

0 commit comments

Comments
 (0)