question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[BUG] azure media services - crop issue

See original GitHub issue

I believe there is a bug with the encoder in azure media services.

this is my encoding code in C#

                 var aacAudio = new AacAudio(channels: 2, samplingRate: 48000, bitrate: 128000,
                        profile: AacAudioProfile.AacLc);
 
                               rectangle = new Rectangle("656", "0", "1079", "607");

                    var hd3600Kbps = new H264Layer(bitrate: 3600000, height:"640", width:"360");

                    var h264Video = new H264Video(keyFrameInterval: TimeSpan.FromSeconds(2),
                        layers: new[] {hd3600Kbps});
                    var pngLayer = new PngLayer("50%", "50%");
                    var pngImage = new PngImage("25%", step: "25%", range: "80%", layers: new[] {pngLayer});
                    var codecs = new Codec[] {aacAudio, h264Video, pngImage};
                    var mp4Format = new Mp4Format("Video.{Basename}.{Label}.{Bitrate}{Extension}");
                    var pngFormat = new PngFormat("Thumbnail-{Basename}-{Index}{Extension}");
                    var formats = new Format[] {mp4Format, pngFormat};
                    var filters = rectangle == null ? null : new Filters {Crop = rectangle};
                    var standardEncoderPreset = new StandardEncoderPreset(codecs, formats, filters);
                    var outputs = new TransformOutput[]
                        {new(standardEncoderPreset, OnErrorType.StopProcessingJob, Priority.Normal)};


                    await client.Transforms.CreateOrUpdateAsync(_azureMediaOption.ResourceGroup,
                        _azureMediaOption.AccountName,
                        transformName,
                        outputs,
                        cancellationToken: cancellationToken);

I am cropping the video with this info:

{Left: 656, Top: 0, Height: 1079, Width: 607}

The video I have is 1920x1080 using the C# code above, the video needs to get cropped and encoded.

azure media services gives me an output but the output video is not cropped properly.

if I manually change the bit rate of the video on my computer and then encode it again this time it will work. I uploaded both videos as attachments to this issue.

this one is the problematic video, the video that dose not encode based on the code https://user-images.githubusercontent.com/14353301/127079656-667419c0-2de2-45f6-850a-da03041e8e86.mp4

here is the exact same video but with different bit rate and it gets encoded based on the job input

https://user-images.githubusercontent.com/14353301/127079720-375c406b-e672-43df-a47b-6589fe93ff5c.mp4

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
jiayali-mscommented, Sep 20, 2021

Thanks for the feedback @dehghanfar, I’m sorry to hear that you moved to AWS. Our team will continue investigating this issue. In the meantime, it seems that you have found your own solution, so @jsquire can we close this issue?

1reaction
jsquirecommented, Jul 27, 2021

Thank you for your feedback. Tagging and routing to the team best able to assist.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Troubleshoot Media Services
Many issues can be resolved by migrating to the Media Services v3 API or by reading the live streaming best practices guide.
Read more >
Transforms - Create Or Update - REST API (Azure Media ...
Learn more about Media Services service - Create or Update Transform Creates or updates a new Transform.
Read more >
Jobs - Get - REST API (Azure Media Services)
While trying to download the input files, there was an issue during transfer (storage service, network errors), see details and check your ...
Read more >
Azure Media Services unavailable - Microsoft Q&A
Issue seems to be resolved late in the evening. ... A group of Azure services that includes encoding, format conversion, on-demand streaming, ...
Read more >
Azure Media Player Known Issues
Incorrectly configured encoders may cause issues with playback; Streams with timestamps greater than 2^53 may have playback issues.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found