Post a new question



DVR to MP4

Joël 2016-01-04 21:49:20 UTC in Nimble Streamer

Has anyone experience to convert a recorded dvr stream to a single mp4 file with ffmpeg or some other tool?

I love the new dvr functionality as recording and live stream solution. And now a want to optimize some things for both

as you know a dvr folder contains a lot of subfolders with short m4v video, and audio m4a files. I'm looking for a script or command with ffmpeg to join them together to a single mp4 file for providing it for download in a archive folder.

Alex Pokotilo 2016-01-05 03:33:02 UTC

you can run ffmpeg like that
ffmpeg -i -codec copy result.mp4

you can and should use ranges to get exact video chunks you need as described here

joël 2016-01-06 12:15:56 UTC

Hi Alex thanks! To convert a complete dvr root folder works perfect and is very easy with this ffmpeg command.
Now i'm trying to convert the dvr video in parts of 2 hours to mp4 files.

Like this:
ffmpeg -i -bsf:a aac_adtstoasc-codec copy "/mnt/archive/Live-event-31dec15_video-01.mp4"

But ffmpeg gives me an error:

Empty playlist End of file

Do I something wrong with the "UTC-starttime" ?
I copy&paste it from the first dvr subfolder

Max 2016-01-06 12:18:41 UTC

Hi Joël,

DVR subfolder is having UTC time in milliseconds, so you need to remove last 3 digits if requesting the DVR archive fragment with the same timestamp (i.e. it will be

Joël 2016-01-06 16:10:20 UTC

Again perfect,
Now it converts 2 hours to an MP4 file
I get only a lot of "No trailing CRLF found in HTTP header" errors during the converting with ffmpeg, but the mp4 video looks fine.

I have another question too about DVR live streaming.
The live buffer gets not enough chunks in time, I think.
sound en video stutters many times when the buffer is empty
when you start 1 or 2 minutes in the past, than it is oke for a while, till to buffer is emty again. DVR path to local storage or a mounted samba share makes not a big difference, what I see.
but I will post a new topic about that: optimizing DVR live streaming.

Josh 2016-02-12 20:06:18 UTC


I am trying to to convert a DVRed stream to MP4 using the command from the second post:

ffmpeg -i -codec copy result.mp4

But replacing the source for the stream path copied from WMSpanel for DVR stuff.

When I run the command, though, I get "Invalid data found when processing input" as an error. I also tried to replace my servers IP to but I get the same error.

Right now I am making sure I have all the ffmpeg stuff I need installed, but is there anything else that could be causing this?

OS is Centos 6.7 on a VPS

Josh 2016-02-12 23:06:35 UTC

Just wanted to pop in and say I fixed my issue, and to plop it here in case anyone runs into the case I did.

I had just the basic ffmpeg installed from yum, which was an old version (0.6.5).

I went and compiled/installed from ffmpeg's latest git, and I am encoding as I type this :D

Yury Udovichenko 2016-02-13 09:11:18 UTC

Josh, thanks for the update!

Joël 2016-02-13 13:32:42 UTC

Hi Josh, thank you also for your comments about recording from dvr to mp4 with ffmpeg.

I have still some issue's with dvr live streaming. The audio stops from time to time. The video keeps running while the audio is silent for about 1 or 2 sec. This have only when playing live the dvr stream, not later when he is recorded
I send nimble support a email about this today.

Joël 2016-02-25 21:59:05 UTC

the audio problem is solved now, during dvr live streaming, with the 2.14.0-10 update version of nimble.
Thanks al lot Nimble Team!!

Joompe team 2016-03-01 04:53:31 UTC

hi supporter ! how to convert dvr to mp4 after stream end ?
i am using wowza, it auto save stream to mp4 after live stream end, can we do like on nimble ?

Yury Udovichenko 2016-03-01 05:33:40 UTC


Please use the ffmpeg-based procedure described above.

chubros 2016-09-21 05:05:50 UTC

Why i m getting an continuos error when i converting my streams to mp4? The error says "Non-monotonous DTS in output stream 0:0; previous: 410145306, current: 410145306; changing to 410145307. This may result in incorrect timestamps in the output file."
And i m getting an mp4 that cannot seek to the end...

Mike 2016-09-24 02:27:04 UTC

the dvr function is crazy logic why put everything in tiny folders, madness!. pointless function whole idea of dvr is to make things easy but instead some geek king has to be clever so it cant be used properly

Alex Pokotilo 2016-09-24 03:57:07 UTC

Hi Mike,
we tried to implement dvr storage based on typical case it should be used in and care more on performance, robust and storage utilization then how it looks like from folder/files perspective.

MIKE 2016-09-25 21:09:47 UTC

Unable to find a suitable output format for 'copy'
copy: Invalid argument

have tried ffmpeg command and getting error message above
is their no facility to convert these files into mp4 through the gui?

ffmpeg -i -bsf:a aac_adtstoasc-codec copy "/media/Live-event-250_video-01.mp4"

MIKE 2016-09-25 21:16:14 UTC

fixed it there was no space between -codec was too close to previous command. please gui;)

Josh 2016-09-25 23:46:04 UTC

To use a GUI with ffmpeg, you should get a frontend for it. I've used Avanti in the past. There may be a better one out there now, but I remember it being a pretty good ffmpeg GUI frontend

Mike 2016-09-26 01:11:24 UTC

thanks josh, i mean nimble gui to convert. i got it to convert a selected range first time around but then second time i got error not sure why. with the mpeg4 i did convert ok, i hosted it with the vod streaming setup wizard. but now considering it seems error prone it puts me off fighting with it. need something straight forward like a gui feature in nimble that does it auto since i will be doing the process a lot


Joël Smit 2016-09-28 20:38:33 UTC

Hi, when you need a mp4 recording of a live stream, why not doing it by ffmpeg with "server-side-task manager of wmspanel, right away. and you can use date and time variables for your filenames.
Rather then converting dvr files to an MP4 file afterwards.
The recording will start automatically direct when the live feed is available. And the mp4 file is direct available when you stop the live stream.

I use dvr for only live streaming, so the people can rewind the video during the live stream and for direct playback after the live event.
And of course for extra backup if something went wrong during with the primary recording method by ffmpeg.
But for a vod archive, I don't use dvr content. Only when something went wrong.

Alex Pokotilo 2016-09-29 02:23:32 UTC

and probably this is the best you can do with Nimble streamer now.

It's obvious for us that mp4 export from DVR archive as well as mp4 recording for live stream is necessary but absent part of our server. And seeing a lot of request in this field we've hired cool engineer who will improve server in this area.
Thanks everyone for good feedback

Josh 2016-09-29 21:02:37 UTC

This would be awesome Alex. While I've gotten a bit used to server side tasks and doing things on the dedi box itself, having some more panel options for DVR functions like the ones you mentioned would be fantastic.

Thanks for always working to improve :D

Mike 2016-09-29 21:40:07 UTC

hi joel thanks, what ffmpeg command would you use to select a date and time eg i want to record and output to mp4 from 8 oclock to 9:30?

that would be much easier than looking for segments


Majama 2016-10-30 19:40:19 UTC

Hello there,
I am totally new to this, I had a live stream yesterday and my recording system failed me, but I have dvr and it is still available there, I want to download it. I followed the instructions above but I am get this: "Stream mapping:
Stream #0:0 -> #0:0 (copy)
Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
[mp4 @ 0x16905f60] Malformed AAC bitstream detected: use audio bitstream filter 'aac_adtstoasc' to fix it ('-bsf:a aac_adtstoasc' option with ffmpeg)
av_interleaved_write_frame(): Operation not permitted
[mp4 @ 0x16905f60] Malformed AAC bitstream detected: use audio bitstream filter 'aac_adtstoasc' to fix it ('-bsf:a aac_adtstoasc' option with ffmpeg)
frame= 2 fps=0.0 q=-1.0 Lsize= 35kB time=00:00:00.04 bitrate=5880.4kbits/s
video:39kB audio:1kB subtitle:0 data:0 global headers:0kB muxing overhead -10.724595%
root@secure [/home/admin]#"
I don't know what that means and where do I download the stream from if the copy works.

Josh 2016-10-30 21:59:15 UTC

You are on the right path. Go ahead and add:

-bsf:a aac_adtstoasc

between the DVR path, and the path where you are storing the converted file. So it'll look like:

ffmpeg -i [your DVR webpath]:8081/path/to/dvr.m3u8 -bsf:a aac_adtstoasc -codec copy /path/to/DVR.mp4

Majama 2016-10-30 22:31:50 UTC

Hello Josh!
Thanks very much for your able. The error I am getting is: /http:/ No such file or directory
I do not know if the path I provided is in the correct form or not.
the "xxxxx" is replaced with my domain in the actucal code that I put in

Josh 2016-10-30 22:40:35 UTC

For the right address to put in for the DVR path will be in your WMSpanel area on the site.

Login to the dashboard area, then go to Nimble Streamer at the top. In the menu go to DVR streams. Once there you should hopefully see your DVR thingy listed.

Where your DVR stuff is listed, on the right, there should be a little question mark box. Click that and in the popup you'll be able to see a preview of your DVR, and copy the address to it.

Click copy in the top area above the preview window and you will have the correct path to your streams DVR that you are converting :D

Here are some screenshots for the area I am talking about.

majama 2016-10-30 22:47:57 UTC

Thanks again Josh,
I did the DVR path from the area you described, where I am having problem is the "copy" path, as in where I am copying the dvr to .mp4 file.

Josh 2016-10-30 23:24:46 UTC

Ahhh gotcha. Assuming you are running on linux, you just need to specify a path that exists (IE make the directory if its not created already), and then the file name.

So something like:


And that will convert your stream to a file called file.mp4 inside /home/DVR/ directory

Majama 2016-10-30 23:47:48 UTC

Hey Josh, you are my hero, it is working right now, encoding the file to mp4. I will let you know when it completes.

Thanks a million!

Post a reply