Video Streaming: MPEG-DASH , AWS cloudfront, dash.js - amazon-web-services

I am creating a video streaming application hosted on AWS. I have got mp4 which are hosted on AWS S3. To stream video files, I want to transcode mp4 to MPEG-DASH (mpd) format and store in a different AWS S3 bucket. I will be AWS cloudfront to stream above transcoded mpd files and use dash.js or videogular to stream on client side.
The problem I am facing is here how to transcode mp4 to mpd.(without using AWS transcoder, bit expensive). I was thinking to leverage AWS Lambda to listen the source S3 bucket and output to a different S3 bucket. But could not find a module to transcode programmatically(to convert it to Lambda function). Has anyone done it yet and would like to give some insight?

An mpd file is actually just a text based index file - it contains URLs to the video and audio steams but no media itself.
The media for MPEG DASH is stored in segments, for mp4 in a fragmented mp4 format.
If you want to create fragmented mp4 from mp4 yourself, then there are some tools which you can look at to do this, or even use as part of a batch process.
One example is mp4Dash (https://www.bento4.com/documentation/mp4dash/). You can see examples here on this link to convert a single mp4 file, or to convert multiple bit rate versions of a single file, which is more typical when using DASH for Adaptve Bit Rate Streaming (ABR - allows the client choose the bit rate of the next segment to download depending on the current network conditions):
Single MP4 input file
mp4dash video.mp4
Multi-bitrate set of MP4 files
mp4dash video_1000.mp4 video_2000.mp4 video_3000.mp4
Another example is mp4Box: https://gpac.wp.imt.fr/mp4box/dash/
Its worth nothing that there are actually multiple ways to stream DASH in AWS - Elastic Transcode can create MPEG DASH stream which you can stored and stream from S3, you can use cloud front and services like Unified Streaming or Wowza etc. Streaming is complicated so if this is for a high volume important service it may be worth looking at these and seeing if there is an option or combination which meets your needs without being too expensive.

Related

Convert VOB/BUP files to .mp4 and store them in S3 bucket

So as the title says, I have a couple of files in the VOB/BUP format that I need to convert first to .mp4 (I also have .IFO files and I don't know what that is) and then check for a public url to display them (S3 Bucket) But I don't know which one is the correct service.
I have read about MediaConvert, but I'm not quite sure this is the right service for my need.
Thanks in advance for any tips.
VOB/BUP/IFO files are typically found on a DVD where:
IFO files are an index and hold information about the disc contents
BUP files are backup versions of the IFO files
VOB files hold the video and audio content
AWS Elemental MediaConvert does not support these as an input (1).
To convert these, you can consider leveraging a different tool that is capable, for example FFMPeg.
Here is an example batch script you can reference that does this:
https://gist.github.com/andreasbotsikas/8bad3df5309dd0383f2e2c450b22481c
You can also potentially have this workflow run on AWS by using AWS Lambda to run FFMPeg (2).
References:
Supported input codecs and containers : https://docs.aws.amazon.com/mediaconvert/latest/ug/reference-codecs-containers-input.html
Processing user-generated content using AWS Lambda and FFmpeg : https://aws.amazon.com/blogs/media/processing-user-generated-content-using-aws-lambda-and-ffmpeg/

Why does my single part MP3 file fail to upload to AWS S3 due to an InvalidPart multipart file upload error?

I have a 121MB MP3 file I am trying to upload to my AWS S3 so I can process it via Amazon Transcribe.
The MP3 file comes from an MP4 file I stripped the audio from using FFmpeg.
When I try to upload the MP3, using the S3 object upload UI in the AWS console, I receive the below error:
InvalidPart
One or more of the specified parts could not be found. the part may not have been uploaded, or the specified entity tag may not match the part's entity tag
The error makes reference to the MP3 being a multipart file and how the "next" part is missing but it's not a multipart file.
I have re-run the MP4 file through FFmpeg 3 times in case the 1st file was corrupt, but that has not fixed anything.
I have searched a lot on Stackoverflow and have not found a similar case where anyone has uploaded a single 5MB+ file that has received the error I am.
I've also crossed out FFmpeg being the issue by saving the audio using VLC as an MP3 file but receive the exact same error.
What is the issue?
Here's the console in case it helps:
121MB is below the 160 GB S3 console single object upload limit, the 5GB single object upload limit using the REST API / AWS SDKs as well as the 5TB limit on multipart file upload so I really can't see the issue.
Considering the file exists & you have a stable internet-connected (no corrupted uploads), you may have incomplete multipart upload parts in your bucket somehow which may be conflicting with the upload for whatever reason so either follow this guide to remove them and try again or try creating a new folder/bucket and re-uploading again.
You may also have a browser caching issue/extension conflict so try incognito (with extensions disabled) or another browser if re-uploading to another bucket/folder doesn't work.
Alternatively, try the AWS CLI s3 cp command or a quick "S3 file upload" application in a supported SDK language to make sure that it's not a console UI issue.

Aws MediaConvert - Create one output video file with a single audio track and multiple video inputs

I’m working with Aws MediaConvert in order to create video-files concatenation.
I'm able for now to create concatenation of n videos in one output mpeg4 file, with or without audio "inside each video input".
What i'm looking to achieve is to create the same but with one single audio track for the whole video that i would import and muting each video inputs audio if there are.
I don't know if MediaConvert allows that (not found my case in Aws MediaConvert Documentation).
I made a small schema representing what i'm trying to achieve :
I figured out i can do that with two jobs, one that will concatenate all my video input and mute their audios if there are. And the second one merging the single audio track in the result of the previous one.
This solution however doesn't feel to be the best one.
Do you know if can achieve what i'm trying to do in one job with Aws MediaConvert and if yes, which settings have I to tweak ?
Many thanks in advance !
Maybe you can have look at this link, especially for the following part
If your audio is in a separate file from your video, choose the External file slider switch element and provide the URI to your audio input file that is stored in Amazon S3 ...
By choosing audio from external file and set proper timestamp offset, maybe you can combine your two jobs to one.

AWS Transcribe is not recognizing the media format of my file correctly

I'm using a lambda function to receive a bytes array of audio data, save it as mp3, store it in S3, and then use the S3 object to start a Transcribe job.
Everything's been processed correctly. I can see the .mp3 file in S3. I've also downloaded it to my local machine and played it, and it plays correctly as mp3.
However, when I start the transcription job I get back an error:
The media format that you specified doesn't match the detected media format. Check the media format and try your request again.
This is my call to start the AWS Transcribe job:
transcribe.start_transcription_job(
TranscriptionJobName=job_name,
Media={'MediaFileUri': job_uri},
MediaFormat='mp3',
LanguageCode='en-US'
)
Any idea what may be causing this?
Cheers!
mp3 requires compression, if you just save byte array, then it's not in .mp3 format. You can use soxi to validate audio files: http://sox.sourceforge.net/soxi.html

Alter the audio format for Amazon connect recordings

So the basic problem is that I am setting up an Amazon connect instance and have successfully started recording calls too but I want the recording audio file to be stored in the S3 bucket in some format(.mp3, .mp4, etc) other than the default that is provided by Amazon (.wav).
Since .wav is the default format and I am not getting any official documentation regarding the change in any format, Any leads would be welcome.
Rather than downloading the file and converting it to the target format, which I have already done, I need the file to be stored in the S3 in the target format itself(anything other than .wav).
Currently there is no capability to change audio format for Connect call recordings; it's fixed at 8 kHz, 16 bit WAV files. But you could set up a MediaConvert job to automatically convert to any format you'd like.
Alternatively you could have a trigger call a Lambda function to do the same thing. Here's a CloudFormation template that sets that up for you.
In both solutions, you might want to adjust the process a bit to delete the WAV file after conversion, to save on storage costs