# How to Create Dash manifest with ON\_DEMAND profile from MP4 representation?

**URL:** <https://community.bitmovin.com/t/how-to-create-dash-manifest-with-on-demand-profile-from-mp4-representation/2748>\
**Category:** Support\
**Tags:** dash, encoding\
**Created:** [March 26, 2024, 2:32am UTC](https://community.bitmovin.com/t/how-to-create-dash-manifest-with-on-demand-profile-from-mp4-representation/2748 "2024-03-26T02:32:46Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![yoshiyuki.kinjo](https://avatars.discourse-cdn.com/v4/letter/y/fbc32d/32.png) [@yoshiyuki.kinjo](https://community.bitmovin.com/u/yoshiyuki.kinjo)\
**Post date:** [March 26, 2024, 2:32am UTC](https://community.bitmovin.com/t/how-to-create-dash-manifest-with-on-demand-profile-from-mp4-representation/2748/1 "2024-03-26T02:32:46Z")

</div>

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

> <https://github.com/bitmovin/bitmovin-ruby/blob/develop/examples/simple_dash_with_http_input.rb>

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)

```ruby
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.

---

<div class="post-metadata">

**Author:** ![lucky.goyal](https://sea1.discourse-cdn.com/flex015/user_avatar/community.bitmovin.com/lucky.goyal/32/506_2.png) [@lucky.goyal](https://community.bitmovin.com/u/lucky.goyal)\
**Post date:** [April 8, 2024, 8:42am UTC](https://community.bitmovin.com/t/how-to-create-dash-manifest-with-on-demand-profile-from-mp4-representation/2748/2 "2024-04-08T08:42:43Z")

</div>

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](https://developer.bitmovin.com/encoding/reference/postencodingencodingsmuxingsmp4byencodingid) 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

> [@Which fragmented MP4 format would you use, and why?](https://community.bitmovin.com/t/which-fragmented-mp4-format-would-you-use-and-why/344):
>
> We all know and love MP4 files. Whether referred to as ISOBMFF, or CMAF, or other closely related terms that essentially refer to [variations of the same container format](https://bitmovin.com/fun-with-container-formats-2/), they are at the core of any modern streaming solution, and in particular adaptive streaming (or ABR) that relies on the fragmentation of the container into small and easily downloadable “segments” of content that the player can gradually obtain and render. But when it comes to fragmenting, there are 2 main flavours out there (…

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

---

<div class="post-metadata">

**Author:** ![yoshiyuki.kinjo](https://avatars.discourse-cdn.com/v4/letter/y/fbc32d/32.png) [@yoshiyuki.kinjo](https://community.bitmovin.com/u/yoshiyuki.kinjo)\
**Post date:** [April 9, 2024, 12:54am UTC](https://community.bitmovin.com/t/how-to-create-dash-manifest-with-on-demand-profile-from-mp4-representation/2748/3 "2024-04-09T00:54:32Z")

</div>

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