Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cant convert Stream on Linux container #485

Open
ValeriiInshyn opened this issue Nov 21, 2023 · 2 comments
Open

Cant convert Stream on Linux container #485

ValeriiInshyn opened this issue Nov 21, 2023 · 2 comments

Comments

@ValeriiInshyn
Copy link

ValeriiInshyn commented Nov 21, 2023

 private async Task<MemoryStream> ConvertWavToMp3Async(MemoryStream  input)
  {
      MemoryStream result = new MemoryStream();

      await FFMpegArguments
          .FromPipeInput(new StreamPipeSource(input))
          .OutputToPipe(new StreamPipeSink(result), options =>
          {
              options
                  .WithAudioCodec(AudioCodec.LibMp3Lame)
                  .WithAudioBitrate(AudioQuality.Low)
                  .ForceFormat("mp3");
          }).ProcessAsynchronously(ffMpegOptions: _ffOptions);
      result.Position = 0;

      return result;
  }

This is my function to convert media files. I am trying to convert from gsm610 to mp3 in general. But in this function I am trying only convert MemoryStream to another MemoryStream to get another format.

My problem:
When I run my app on windows - everything is good (i get right audio file - mp3), when i run it on linux - i get empty video file.
After converting my input buffer (pinned .csv file):

Windows:
Capacity: 317952
Length: 251757

Linux Container:
Capacity: 256
Length: 45

dockerrun.csv

@ValeriiInshyn ValeriiInshyn changed the title Cant convert Cant convert Stream on Linux container Nov 21, 2023
@ValeriiInshyn
Copy link
Author

Remark: I'm working with skype media resources and it has its own extra-parameters in header and i want to deal with them somehow.

@epgeroy
Copy link

epgeroy commented Dec 3, 2024

I'm having the exact same problem 1 year later. @ValeriiInshyn did you find a solution?

MemoryStream outputStream = new();
bool result = FFMpegArguments
  .FromPipeInput(new StreamPipeSource(inputStream))
  .OutputToPipe(new StreamPipeSink(outputStream), options => options
    .WithAudioBitrate(AudioQuality.Normal)
    .WithAudioCodec(AudioCodec.LibMp3Lame)
    .ForceFormat("mp3")
  )
  .ProcessSynchronously(throwOnError: true);
  
if (!result)
{
  _logger.LogError("Failed to convert audio to mp3");
}

The code is pretty much the same; I don't get any exceptions thrown, nor a false value in result

Any help is appreciated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants