tomaszzmuda / Xabe.FFmpeg

.NET Standard wrapper for FFmpeg. It allows to process media without know how FFmpeg works, and can be used to pass customized arguments to FFmpeg from dotnet core application.

Home Page:https://xabe.net/product/xabe_ffmpeg/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Own Arguments - Package add incorrect parameters

oreleraki opened this issue · comments

Part of my use cases, i have a concatenation which doesn't supported by Xabe and i tried to pass my own arguments.
I have noticed that Xabe is adding arguments which produce me incorrect results.
The added parameters i didn't wanted are: -map 0:0 -map 0:1 -n

Temporary solution
I have added -i input.mp4 to my parameter and removed .AddStream builder function, so the source code will ignore it.

C#

var mediaInfo = await FFmpeg.GetMediaInfo(fileName);
string @params = "-filter_complex \"[0:v]trim=start=10:duration=10,setpts=PTS-STARTPTS[v0]; [0:v]trim=start=70:duration=10,setpts=PTS-STARTPTS[v1]; [0:v]trim=start=190:duration=10,setpts=PTS-STARTPTS[v2]; [v0][v1][v2]concat=n=3:v=1[final]\" -map \"[final]\"";
IConversionResult conversionResult = await FFmpeg.Conversions.New()
	.AddStream(mediaInfo.Streams)
	.AddParameter(@params)
	.SetOutput("concat-video.mp4")
	.Start();

"C:\ffmpeg-5.1.2-full_build\ffmpeg-5.1.2-full_build\bin\ffmpeg.exe" -i "H:\input.mp4" -map 0:0 -map 0:1 -n -filter_complex "[0:v]trim=start=10:duration=10,setpts=PTS-STARTPTS[v0]; [0:v]trim=start=70:duration=10,setpts=PTS-STARTPTS[v1]; [0:v]trim=start=190:duration=10,setpts=PTS-STARTPTS[v2]; [v0][v1][v2]concat=n=3:v=1[final]" -map "[final]" "concat-video.mp4"

Hello @oreleraki
I don't think there is anything I can do about that.
For more complex scenarios if you know FFmpeg I suggest using .Start(string params) overload.
That builder should fulfill most of user cases but it's not perfect :)

Hello @oreleraki I don't think there is anything I can do about that. For more complex scenarios if you know FFmpeg I suggest using .Start(string params) overload. That builder should fulfill most of user cases but it's not perfect :)

Thank you @tomaszzmuda, that helps a lot.