# Export DVR video segment to MP4 file

**URL:** https://community.wowza.com/t/export-dvr-video-segment-to-mp4-file/38913
**Category:** Wowza Streaming Engine
**Created:** [July 4, 2012, 11:30am UTC](https://community.wowza.com/t/export-dvr-video-segment-to-mp4-file/38913 "2012-07-04T11:30:02Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![Matteo\_Tomasoni](https://avatars.discourse-cdn.com/v4/letter/m/91b2a8/32.png) [@Matteo\_Tomasoni](https://community.wowza.com/u/Matteo_Tomasoni)
#### Post date: [July 4, 2012, 11:30am UTC](https://community.wowza.com/t/export-dvr-video-segment-to-mp4-file/38913/1 "2012-07-04T11:30:02Z")

</div>

Hello,

in my wowza setup I have an application configured as live-record, with the dvr plugin which stores the latest n hours of video.

Now I need the ability to export arbitrary video segments recorded with the dvr plugin, such that they are viewable with a standard media player (such as windows media player, vlc, or others).

I searched for a way to recompose the thousands of files stored in the /dvr/ folder, but without any success.

I even tried the “LiveStreamRecord” example, successfully recording videos to MP4 files, but the problem is that the user should be able to get an MP4 file of something happened _before_, for example he may want to download the latest 5 minutes.

Is there anyone who can suggest a way to do this?

Should I write a custom module with Wowza IDE? And if so, any suggestion on where to start?

Please note that the DVR is still needed, and that I don’t want to waste disk space recording all the streams with the dvr _and_ in mp4!

Thanks!

Matteo

---

<div class="post-metadata">

### Author: ![Lisa\_Wong](https://avatars.discourse-cdn.com/v4/letter/l/34f0e0/32.png) [@Lisa\_Wong](https://community.wowza.com/u/Lisa_Wong)
#### Post date: [July 6, 2012, 5:05am UTC](https://community.wowza.com/t/export-dvr-video-segment-to-mp4-file/38913/2 "2012-07-06T05:05:04Z")

</div>

It is not currently possible to re-compose the .m4fa and .m4fv files into an MP4 file. It would require a custom module to parse and modify the atom structure of the fragmented MP4 file. I understand that additional disk space is used when you pair recording with both nDVR and live-record, but if you wish to have a final output in .MP4 format, you’ll need to continue to use StreamType live-record or the Live Stream Record module. This [How to plan your nDVR workflow article](https://www.wowza.com/docs/how-to-plan-your-wowza-ndvr-workflow#recordingOptions) describes the different recording options in Wowza Media Server.

-Lisa

---

<div class="post-metadata">

### Author: ![Richard\_Lanham](https://avatars.discourse-cdn.com/v4/letter/r/c68b51/32.png) [@Richard\_Lanham](https://community.wowza.com/u/Richard_Lanham)
#### Post date: [July 2, 2014, 3:24pm UTC](https://community.wowza.com/t/export-dvr-video-segment-to-mp4-file/38913/3 "2014-07-02T15:24:23Z")

</div>

Thanks for adding this. Engineering remarked that this is not guaranteed to work in future updates.

Richard

---

<div class="post-metadata">

### Author: ![Lisa\_Wong](https://avatars.discourse-cdn.com/v4/letter/l/34f0e0/32.png) [@Lisa\_Wong](https://community.wowza.com/u/Lisa_Wong)
#### Post date: [July 10, 2012, 5:02pm UTC](https://community.wowza.com/t/export-dvr-video-segment-to-mp4-file/38913/4 "2012-07-10T17:02:01Z")

</div>

We do not have any documentation specific to the .m4fa and .m4fv files. Re-composing the .m4f\* files isn’t currently supported.

-Lisa

---

<div class="post-metadata">

### Author: ![Lisa\_Wong](https://avatars.discourse-cdn.com/v4/letter/l/34f0e0/32.png) [@Lisa\_Wong](https://community.wowza.com/u/Lisa_Wong)
#### Post date: [July 10, 2012, 5:22pm UTC](https://community.wowza.com/t/export-dvr-video-segment-to-mp4-file/38913/5 "2012-07-10T17:22:49Z")

</div>

I’ll also add that the .m4fa and .m4fv files are an internal format. I don’t know of anything planned, but it is possible that the atom structure could change in the future. Since there is a possibility of change, it is not recommended to re-compose the .m4f\* files.

-Lisa

---

<div class="post-metadata">

### Author: ![Matteo\_Tomasoni](https://avatars.discourse-cdn.com/v4/letter/m/91b2a8/32.png) [@Matteo\_Tomasoni](https://community.wowza.com/u/Matteo_Tomasoni)
#### Post date: [July 10, 2012, 11:06am UTC](https://community.wowza.com/t/export-dvr-video-segment-to-mp4-file/38913/6 "2012-07-10T11:06:15Z")

</div>

Thanks Lisa,

You say that with a custom module I could parse the atom structure of m4fa and m4fv files, but is there some documentation on how these files are made?

If it is available, this could be the best solution to my problem.

For the moment I decided to go with nDVR for about an hour of recordings, plus liveStreamRecord for the remaining hours, and I’m writing a custom module based on LiveStreamRecord to integrate wowza with our existing application.

This module splits mp4 files every some minutes, and when an user request to download a video from X to Y I can merge these small pieces together in an unique mp4 file.

Thank you,

Matteo

---

<div class="post-metadata">

### Author: ![Ciprian\_Melian](https://avatars.discourse-cdn.com/v4/letter/c/ce73a5/32.png) [@Ciprian\_Melian](https://community.wowza.com/u/Ciprian_Melian)
#### Post date: [June 29, 2014, 3:27pm UTC](https://community.wowza.com/t/export-dvr-video-segment-to-mp4-file/38913/7 "2014-06-29T15:27:13Z")

</div>

I managed to export wowza recorded DVR chunks to one mp4 file using the following method :

Install on you local computer or on your server the following script :

AdobeHDS.php

[https://github.com/K-S-V/Scripts/blob/master/AdobeHDS.php](https://github.com/K-S-V/Scripts/blob/master/AdobeHDS.php)

Download all chunks, based on manifest file, using the command :

[PHP]php AdobeHDS.php --manifest “/manifest.f4m?DVR” --delete[/PHP]

more information here : [https://github.com/K-S-V/Scripts/wiki](https://github.com/K-S-V/Scripts/wiki)

This will produce a single mp4 file ( in flv container ).

Download the generated flv file and change flv container to mp4 using MP4tools.

[http://www.emmgunn.com/mp4tools/mp4toolshome.html](http://www.emmgunn.com/mp4tools/mp4toolshome.html)

Use the “MP4” tab and configure “passthrough” for video and audio track.

You can extract a specific segment of your video if needed with the same tool using the “Edit files” tab

The resulting file is proper mp4 file.

---

<div class="post-metadata">

### Author: ![Julio\_Royer](https://avatars.discourse-cdn.com/v4/letter/j/a9a28c/32.png) [@Julio\_Royer](https://community.wowza.com/u/Julio_Royer)
#### Post date: [October 23, 2014, 10:28am UTC](https://community.wowza.com/t/export-dvr-video-segment-to-mp4-file/38913/8 "2014-10-23T10:28:14Z")

</div>

Thanks livd3o.

With your tip I was able to join the fragments into a single .flv file, and after that, to a .mp4 file.

But in my case, the audio was missing. The video was ok, but the audio not.

I’m using ubuntu 14.04, PHP 5.5.9-1ubuntu4.4, and avconv.

I tried to play the .flv and .mp4 files, and both were video ok, but mute.

Does anybody know what could be wrong?

I’m new to wowza.

Thanks in advance for any help.
