Xabe.FFmpeg
Xabe.FFmpeg copied to clipboard
Pre-Input Stream Parameters are incorrectly placed before all Stream Inputs
There is unfortunately no good way to handle seeking in a conversion that contains separate audio and video stream files. Here are the issues I am encountering.
Scenario: I have one IVideoStream and one IAudioStream obtained from separate URLs
-
When I
SetSeek
on the Video stream and Audio stream separately, it is not applied to the audio when it is converted. After the conversion is complete, the combined output media includes the correct video segment, but the audio clip starts at 0:00 -
When I
SetSeek
on the conversion, I get the same result. The seek is not properly applied to the audio stream and the output contains Video and Audio that are not properly synchronized. -
The same issue occurs when I attempt to pass SetSeek and Duration as User Defined Parameters. It seems the library only applies the seek to the first stream in the conversion.
-
When using IVideoStream.Split and IAudioStream.Split, the seek is properly applied to both streams, but the process takes a very long time with no progress output. It is several times slower doing it this way, which wouldnt necessarily be the worst thing if only there was some progress output to let you know ffmpeg is working.
I'm continuing to experiment with this to see if there is anything I might be missing, but ultimately I think the problem is that any pre-input parameters are only applied to the first stream source, and not applied to any subsequent stream sources.
I have found the problem. For some reason, Conversion.Build
puts any pre-input parameters before all of the inputs.
-ss 0:02:00.000 -ss 0:02:00.000 -i "[input path 1]" -i "[input path 2]" -map 0:0 -map 1:0 -n -t 00:00:10 "[output path]"
I will try to find the cause of this.
I have modified the title of this issue, because it applies to all pre-input parameters defined for a stream. I was able to fix the problem by doing the following:
- Remove
GetStreamPreInputs
method - Change the
GetInputs()
method to prepend Pre-Input parameters for the stream before the input value
With this change, pre-input parameters defined for individual streams are now put in the correct place, just before the input