Xabe.FFmpeg icon indicating copy to clipboard operation
Xabe.FFmpeg copied to clipboard

IMediaInfo.Path put some extra quotes at the start and end of path string for version 4.4.1 and beyond

Open alex6dj opened this issue 3 years ago • 6 comments

After upgrading from Xabe.FFmpeg v4.4.0 to v4.4.1

If I use the IMediaInfo.Path property to obtain the address of the original file, I find that it has been modified by adding quotes at the beginning and end. So this address becomes invalid. In the latest version v5.0.0 this behavior also occurs. In previous versions up to v4.4.0 the value obtained is valid.

            var path = @"z:\AMD is NOT Ripping Off Intel - WAN Show April 30, 2021.mp4";

            IMediaInfo? info = null;

            try
            {
                info = await FFmpeg.GetMediaInfo(path).ConfigureAwait(false);

                var video = info.VideoStreams.First();

                var file = new FileInfo(video.Path); // This throw, because an invalid path
            }
            catch (ArgumentException e)
            {
                throw;
            }

alex6dj avatar May 16 '21 01:05 alex6dj

Hey, It's strange because Path is not changed anywhere. I've wrote tests for that and they look fine #357 Can you run these tests in your PC? I've checked var path = @"c:\AMD is NOT Ripping Off Intel - WAN Show April 30, 2021.mp4"; too

tomaszzmuda avatar May 16 '21 11:05 tomaszzmuda

I will try to run the tests locally.

alex6dj avatar May 16 '21 15:05 alex6dj

Failed to run the test locally. But I think it have something to do with this: https://github.com/tomaszzmuda/Xabe.FFmpeg/blob/b2985ea116e3b252dfa9a566733de9f9a8408e23/src/Xabe.FFmpeg/Probe/FFprobeWrapper.cs#L139

alex6dj avatar May 16 '21 15:05 alex6dj

That was my first guess but the original value is not changed there nor in the whole project. Have you check tests I have wrotten? Are they correct?

tomaszzmuda avatar May 16 '21 16:05 tomaszzmuda

Yes they look correct. Any way I can just trim both quotes from path, this is not hard and is just used in one place. I just build a simple console app and the behaviour is the same in my Win10 machine and in a server 2019 machine without VS.

alex6dj avatar May 16 '21 20:05 alex6dj

Hey, It's strange because Path is not changed anywhere. I've wrote tests for that and they look fine #357 Can you run these tests in your PC? I've checked var path = @"c:\AMD is NOT Ripping Off Intel - WAN Show April 30, 2021.mp4"; too

Hey! Seems like I found he is talking about

Take a look: I have a Media Info with path https://psv4.vkuseraudio.net/audio/ee/Jy9sTYRuhRME0j1iOHNEpftCcXu-fdDsun9MiQ/dbMj0_OT8yMDky/19TE1acFBKYHFDUEU/index.m3u8?extra=LWTx2MkSXplcx0aTclwVfYgJSfliqOhIk14LyzlfNzRsLeWENB9H-8GqxjqVbUghdMVb5cuXYJbKAj4FWvKBVEq-TlTx-p66OS4xX24hL5PwLZwn02-toDx1DZ_s4ji9kAqR_DkoMHCmy1p4UTpi_RUkiQ

That's fine. Next:

var conversion = await FFmpeg.Conversions.FromSnippet.ExtractAudio(mediaInfo.Path, "test.mp3"); And if I go to quickwatch in Debug I can see the following: Conversion > Streams > [0] Path is ""https://psv4.vkuseraudio.net/audio/ee/Jy9sTYRuhRME0j1iOHNEpftCcXu-fdDsun9MiQ/dbMj0_OT8yMDky/19TE1acFBKYHFDUEU/index.m3u8?extra=LWTx2MkSXplcx0aTclwVfYgJSfliqOhIk14LyzlfNzRsLeWENB9H-8GqxjqVbUghdMVb5cuXYJbKAj4FWvKBVEq-TlTx-p66OS4xX24hL5PwLZwn02-toDx1DZ_s4ji9kAqR_DkoMHCmy1p4UTpi_RUkiQ""

So if I leave it as it is I'll catch the following exception:

"Path cannot be the empty string or all whitespace. (Parameter 'path')" And here is a top part of its stacktrace: " at System.IO.Directory.CreateDirectory(String path)\r\n at Xabe.FFmpeg.Conversion.CreateOutputDirectoryIfNotExists()\r\n at Xabe.FFmpeg.Conversion.<Start>d__28.MoveNext()\r\n

In versions < 4.4.1 it works great and doesn't add excess quotes / escape characters. Give it a try and have a nice day! 😉

ShadowOfPhantom avatar Aug 30 '21 20:08 ShadowOfPhantom

It was fixed recently.

tomaszzmuda avatar Dec 21 '22 16:12 tomaszzmuda