Skip to content

Project about encoder video and uploading them to Google Cloud Provider

Notifications You must be signed in to change notification settings

CarlosEduardoGui/microsservice-encoder-video

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Video Encoder Microservice

Environment Setup

To run in development mode, follow these steps:

  • Duplicate the file .env.example to .env
  • Run the docker-compose up -d command
  • Access the RabbitMQ administration and create an exchange of type fanout. It will serve as a Dead Letter Exchange to receive messages that are not processed.
  • Create a Dead Letter Queue and bind it to the Dead Letter Exchange that was just created. There is no need for a routing_key.
  • In the .env file, specify the name of the Dead Letter Exchange in the parameter: RABBITMQ_DLX
  • Create a service account on GCP that has permission to write to Google Cloud Storage. Download the JSON file with the credentials and save it in the project's root exactly with the name: bucket-credential.json

Executing

To execute the encoder, run the make server command directly in the container. Example:

docker exec encoder-new2_app_1 make server

Where encoder-new2_app_1 is the name of the container generated by docker-compose.

Message Sending Pattern to the Encoder

For a message to be parsed by the encoder system, it must arrive in the following JSON format:

{
  "resource_id": "my-resource-id-can-be-a-uuid-type",
  "file_path": "convite.mp4"
}
  • resource_id: Represents the ID of the video you want to convert. It is of string type.
  • file_path: Is the full path of the mp4 video within the bucket.

Message Return Pattern by the Encoder

Success in processing

For each processed video, the encoder will send the processing result to an exchange (to be configured in .env).

If the processing has been completed successfully, the JSON return pattern will be:

{
    "id":"bbbdd123-ad05-4dc8-a74c-d63a0a2423d5",
    "output_bucket_path":"codeeducationtest",
    "status":"COMPLETED",
    "video":{
        "encoded_video_folder":"b3f2d41e-2c0a-4830-bd65-68227e97764f",
        "resource_id":"aadc5ff9-0b0d-13ab-4a40-a11b2eaa148c",
        "file_path":"invite.mp4"
    },
    "Error":"",
    "created_at":"2020-05-27T19:43:34.850479-04:00",
    "updated_at":"2020-05-27T19:43:38.081754-04:00"
}

Being that encoded_video_folder is the folder that contains the converted video.

Error in processing

If the processing has encountered any error, the JSON return pattern will be:

{
    "message": {
        "resource_id": "aadc5ff9-010d-a3ab-4a40-a11b2eaa148c",
        "file_path": "invite.mp4"
    },
    "error":"Reason for the error"
}

In addition, the encoder will send the original message that had a problem during processing to a dead letter exchange. Just configure the desired DLX in the .env file in the parameter: RABBITMQ_DLX

Complete application diagram.

PlantUML's solution

About

Project about encoder video and uploading them to Google Cloud Provider

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published