How to Create Dash manifest with ON_DEMAND profile from MP4 representation?

I cannot manage createing DASH manifest with ON_DEMAND profile from MP4 representation.
I can create DASH manifest with LIVE profile from fMP4 representation while referencing

Getting status of failed manifest have little information to debug this issue.

Is there any example code that do this?

I tried the following Ruby code (omitted to relevant part)

concatenated_video_stream = enc.streams.build(name: "concatenated video stream")
concatenated_video_stream.codec_configuration = codec_config_720_700
concatenated_video_stream.build_input_stream(input_stream_id: response_hash.dig('data', 'result', 'id'))
concatenated_video_stream.save!

concatenated_audio_stream = enc.streams.build(name: "concatenated audio stream")
concatenated_audio_stream.codec_configuration = audio_config
concatenated_audio_stream.build_input_stream(input_stream_id: response_hash.dig('data', 'result', 'id'))
concatenated_audio_stream.save!


# Muxing configration
mp4_muxing_concatenated = enc.muxings.mp4.build(name: 'concatenated')
mp4_muxing_concatenated.build_output(output_id: OUTPUT_ID, output_path: "#{OUTPUT_DIR}/concatenated_mp4")
mp4_muxing_concatenated.streams << concatenated_video_stream.id
mp4_muxing_concatenated.streams << concatenated_audio_stream.id
mp4_muxing_concatenated.save!

enc.start!

# wait for completing encoding


# monkey-patched to support `profile`
manifest = Bitmovin::Encoding::Manifests::DashManifest.new(
  name: TEST_ID, manifest_name: "manifest.mpd", profile: "ON_DEMAND"
)

manifest.outputs << Bitmovin::Encoding::StreamOutput.new(
 output_id: OUTPUT_ID, output_path: "#{OUTPUT_DIR}/manifest"
)
manifest.save!

period = manifest.build_period()
period.save!

video_adaptationset = period.build_video_adaptationset()
video_adaptationset.save!

# audio_adaptationset = period.build_audio_adaptationset({lang: 'en'})
# audio_adaptationset.save!

# Ruby SDK does not have a method for adding MP4 representaton
Bitmovin.client.post do |post|
  post.url "/v1/encoding/manifests/dash/#{manifest.id}/periods/#{period.id}/adaptationsets/#{video_adaptationset.id}/representations/mp4"
  post.body = {
    encodingId: enc.id, muxingId: mp4_muxing_concatenated.id, filePath: "concatenated_mp4/concatenated.mp4"#, type: "TEMPLATE"
  }
end
manifest.start!

My use case for DASH manifest is to get duration of outputted MP4 by mediaPresentationDuration.
If there is any other measure to get duration, I also appreciate that.

Hello @yoshiyuki.kinjo , welcome to the Bitmovin community and thanks for reaching out with your question.

To create a DASH/HLS or SMOOTH manifest, you need to specific a fragment duration for the MP4 output and set following properties while creating MP4 muxing using API

  • fragmentDuration : Duration of fragments in milliseconds. Required for Fragmented MP4 Muxing (for Smooth Streaming or DASH On-Demand). Not setting this will result in unfragmented mp4.
  • fragmentedMP4MuxingManifestType : Manifest type to be generated for the Fragmented MP4 Muxing. Only significant if a valid fragmentDuration is passed. If this is not set, Smooth Streaming is assumed. For DASH manifest, this should be set to DASH_ON_DEMAND

But from your question, it seems that you are looking to create a un-fragmented MP4 output in which case creating DASH/HLS/SMOOTH manifests is not possible. Please be aware that progressive MP4 muxing, soft-parted MP4 mixing and hard-parted fMP4 muxing are different.

  • Progressive MP4 Muxing : A single MP4 file with MOOV box followed by a single MDAT.
  • Soft-parted MP4 Muxing : A single MP4 file with a MOOV followed by a series of MOOF + MDAT boxes.
  • Hard-parted fMP4 Muxing : Multiple segments/fragments each having a single MOOF+MDAT.

Creating an MPD/HLS/SMOOTH manifest is only possible for either soft-parted MP4 or hard-parted fMP4 muxing. It is not possible to create for a progressive MP4 muxing.

You can find more information about the different MP4 muxing types in this community thread

I hope above answer helps. Please let me know if there are any follow up questions.

1 Like

Thank you for detailed explanation.
Then, Is there way to get duration of the encoded video?