Sandip
Sandip

Reputation: 3

MediaConvert split video into multiple chunk but in different duration length

I have one video with 1 hr time.

i want to chunk in different part by specified range.

ex:

  1. 0 to 10 min
  2. 10 to 40 min
  3. 40 to 60 min

I know it is possible by ffmpeg but i want to do this with MediaConvert.

here is sample for ffmpeg but same thing i want do using MediaConvert

ffmpeg -i input.mp4 -c copy -f segment -segment_times 0,600,2400 output%d.mp4

Upvotes: 0

Views: 1803

Answers (1)

jjohn
jjohn

Reputation: 253

You can accomplish this by using Input Clipping in MediaConvert. You would need to create multiple jobs in order to get the input clipping range and outputs you desire.

In your job settings the input blocks would look something like the following.

Job 1

"Inputs": [
      {
        "AudioSelectors": {
          "Audio Selector 1": {
            "Offset": 0,
            "DefaultSelection": "DEFAULT",
            "ProgramSelection": 1
          }
        },
        "VideoSelector": {
          "ColorSpace": "FOLLOW",
          "Rotate": "DEGREE_0",
          "AlphaBehavior": "DISCARD"
        },
        "FilterEnable": "AUTO",
        "PsiControl": "USE_PSI",
        "FilterStrength": 0,
        "DeblockFilter": "DISABLED",
        "DenoiseFilter": "DISABLED",
        "InputScanType": "AUTO",
        "TimecodeSource": "ZEROBASED",
        "FileInput": "s3://bucket/media.mp4",
        "InputClippings": [
          {
            "StartTimecode": "00:00:00:00",
            "EndTimecode": "00:10:00:00"
          }
        ]
      }
    ]

Job 2

    "Inputs": [
      {
        "AudioSelectors": {
          "Audio Selector 1": {
            "Offset": 0,
            "DefaultSelection": "DEFAULT",
            "ProgramSelection": 1
          }
        },
        "VideoSelector": {
          "ColorSpace": "FOLLOW",
          "Rotate": "DEGREE_0",
          "AlphaBehavior": "DISCARD"
        },
        "FilterEnable": "AUTO",
        "PsiControl": "USE_PSI",
        "FilterStrength": 0,
        "DeblockFilter": "DISABLED",
        "DenoiseFilter": "DISABLED",
        "InputScanType": "AUTO",
        "TimecodeSource": "ZEROBASED",
        "FileInput": "s3://bucket/media.mp4",
        "InputClippings": [
          {
            "StartTimecode": "00:10:00:00",
            "EndTimecode": "00:40:00:00"
          }
        ]
      }
    ]

Job 3

    "Inputs": [
      {
        "AudioSelectors": {
          "Audio Selector 1": {
            "Offset": 0,
            "DefaultSelection": "DEFAULT",
            "ProgramSelection": 1
          }
        },
        "VideoSelector": {
          "ColorSpace": "FOLLOW",
          "Rotate": "DEGREE_0",
          "AlphaBehavior": "DISCARD"
        },
        "FilterEnable": "AUTO",
        "PsiControl": "USE_PSI",
        "FilterStrength": 0,
        "DeblockFilter": "DISABLED",
        "DenoiseFilter": "DISABLED",
        "InputScanType": "AUTO",
        "TimecodeSource": "ZEROBASED",
        "FileInput": "s3://bucket/media.mp4",
        "InputClippings": [
          {
            "StartTimecode": "00:40:00:00",
            "EndTimecode": "01:00:00:00"
          }
        ]
      }
    ]

Something to note here is that clipping regions are based off the timecode on the input source. In my example I set the timecode source to zerobased, this the means the service will start the timecode at 0 and tick up. You do have the option to specifying a start timecode or using embedded timecode on the file.

Note that timecode needs to be in the SMPTE syntax (HOURS:MINUTES:SECONDS:FRAMES) [2]

== Documentation ==

[1] https://docs.aws.amazon.com/mediaconvert/latest/ug/assembling-multiple-inputs-and-input-clips.html

[2] https://en.wikipedia.org/wiki/SMPTE_timecode

Upvotes: 1

Related Questions