Wowza Community

how to split h.264 mp4 archives created by wowza live-record

I have our wowza on ec2 instance setup to live-record. It’s working perfectly, and I have a nice mp4 (h.264 & mp3) file I can download after the broadcast. If I play the file in VLC it plays fine and is perfectly synchronized all the way through. The goal here is to be able to quickly and losslessly split the mp4 file down to just the program that aired and not the pre and post roll stuff.

I have found that avidemux 2.5 will allow us to edit and copy out the part of the stream we need just fine into a new mp4 file. The problem appears when playing the new edited file. Over the course of about 10 minutes the synchronization starts to drift noticeably until it’s several seconds off by the end of the program (1.5 hours for this example)

Using FMLE 3.5 (h.264 & mp3).

Is there anything that will losslessly split this AND keep it synchronized so we can post an archive quickly? Our customers expect a quick edited archive to be available after the program. Editing the high quality local master recording and then rendering to h.264/aac takes too long. Thanks.

Could this synch issue be caused by the mp3 audio instead of aac? I’m not sure we can afford to try a $180 experiment.

You can try ffmpeg. Something like this:

ffmpeg -y -i c:\content\sample.mp4 -acodec copy -vcodec copy -ss 00:00:00 -t 00:00:30 c:\content\samp1.mp4

Richard

I tried it again, with the settings you are using, and the Wowza sample.mp4. It ran without error and produced a working slice of the original.

h:\ffmpeg\bin\ffmpeg -y -i h:\content\sample.mp4 -acodec copy -vcodec copy -ss 00:00:00 -t 01:00:30 h:\content\sampx.mp4

I am running ffmpeg on Windows 7 with this pre-built version:

http://ffmpeg.arrozcru.org/autobuilds/

Richard

I’ve got the same error trying to convert recoded by Wowza flv file (H264+MP3) via ffmpeg:

ffmpeg -y -i sobaka_5.flv -acodec copy -vcodec copy test.mp4

[mp4 @ 02410050] Application provided invalid, non monotonically increasing dts to muxer in stream 1: 16073436 >= 16072862

I used FMLE 3.1 as the RTMP encoder.

Actually I can’t find a way how to edit the files at all. I need to cut off some part of the files and merge them into one result flv file I’d like to put in the server as “recorded” event. I tried ffmped, RichFLV, Moeya FLV Editor, but nothing works with the files correctly. The weird thing is that Media Player Classic (with the latest K-Lite codec pack) plays the files perfectly.

Can anybody help me?

The file is here: http://files.olmisoft.com/sobaka/

Wow, I finally was able to split and join the files using Aone Ultra Video Splitter and Joiner. The only bad thing is what the joiner looks to recode the files (via intermediate AVI). On the other hand, with usual broadcasting quality I do not think I lost a lot.

I did not mean Wowza recodes anything, I meant the splitter. Anyway, it looks I have to convert the movie to AVI, cut/join it and then convert back to FLV. 2 conversions would take 4 hours each and I will lost some quality.

I was able to split/cut and then join the FLV (MPG?) files via the ultimate splitter/joiner, but the result file has audio out of sync. So I think I need to try some more combinations of tools

Is there anything I am doing wrong here? It’s giving an error message.

D:\downloads\ffmpeg-r26041-swscale-r32676-mingw32-static\bin>ffmpeg -y -i sample

.mp4 -acodec copy -vcodec copy -ss 00:00:00 -t 01:00:30 sample_fixed_1.mp4

FFmpeg version SVN-r26041, Copyright © 2000-2010 the FFmpeg developers

built on Dec 17 2010 04:07:17 with gcc 4.4.2

configuration: --enable-gpl --enable-version3 --enable-libgsm --enable-libvorb

is --enable-libtheora --enable-libspeex --enable-libmp3lame --enable-libopenjpeg

–enable-libschroedinger --enable-libopencore_amrwb --enable-libopencore_amrnb

–enable-libvpx --disable-decoder=libvpx --arch=x86 --enable-runtime-cpudetect -

-enable-libxvid --enable-libx264 --enable-librtmp --extra-libs=’-lrtmp -lpolarss

l -lws2_32 -lwinmm’ --target-os=mingw32 --enable-avisynth --enable-w32threads –

cross-prefix=i686-mingw32- --cc=‘ccache i686-mingw32-gcc’ --enable-memalign-hack

libavutil 50.34. 0 / 50.34. 0

libavcore 0.16. 0 / 0.16. 0

libavcodec 52.99. 1 / 52.99. 1

libavformat 52.88. 0 / 52.88. 0

libavdevice 52. 2. 2 / 52. 2. 2

libavfilter 1.69. 0 / 1.69. 0

libswscale 0.12. 0 / 0.12. 0

Seems stream 1 codec frame rate differs from container frame rate: 59.94 (60000/

  1. -> 1000.00 (1000/1)

Input #0, mov,mp4,m4a,3gp,3g2,mj2, from ‘sample.mp4’:

Metadata:

major_brand : f4v

minor_version : 0

compatible_brands: isommp42m4v

creation_time : 2010-12-17 21:06:29

Duration: 01:27:18.75, start: 0.000000, bitrate: 146 kb/s

Stream #0.0(eng): Audio: mp3, 22050 Hz, 2 channels, s16, 39 kb/s

Metadata:

creation_time : 2010-12-17 21:06:29

Stream #0.1(eng): Video: h264, yuv420p, 428x240 [PAR 1:1 DAR 107:60], 100 kb

/s, 29.96 fps, 1k tbr, 90k tbn, 59.94 tbc

Metadata:

creation_time : 2010-12-17 21:06:29

Output #0, mp4, to ‘sample_fixed_1.mp4’:

Metadata:

major_brand : f4v

minor_version : 0

compatible_brands: isommp42m4v

creation_time : 2010-12-17 21:06:29

encoder : Lavf52.88.0

Stream #0.0(eng): Video: libx264, yuv420p, 428x240 [PAR 1:1 DAR 107:60], q=2

-31, 100 kb/s, 30k tbn, 29.97 tbc

Metadata:

creation_time : 2010-12-17 21:06:29

Stream #0.1(eng): Audio: libmp3lame, 22050 Hz, 2 channels, 39 kb/s

Metadata:

creation_time : 2010-12-17 21:06:29

Stream mapping:

Stream #0.1 -> #0.0

Stream #0.0 -> #0.1

Press [q] to stop encoding

[mp4 @ 02df0080] st:0 error, non monotone timestamps 592950 >= 592950

av_interleaved_write_frame(): Operation not permitted

D:\downloads\ffmpeg-r26041-swscale-r32676-mingw32-static\bin>pause

Press any key to continue . . .

After much further testing with this issue we have discovered that this (non monotone timestamps) error occurs with all f4v (local) or mp4 (wowza) recordings when trying to split video made with FMLE. If we make the recording from Wirecast (local mp4) or Wowza (mp4) the files edit fine with ffmpeg. The only issue left to research is do Wowza mp4 recordings from FMLE using AAC audio exhibit this same error when attempting to split them with ffmpeg.

Can someone with FMLE and the AAC plugin create a simple video for us? We need to see if the video can be split properly with ffmpeg, and whether the mp3 encode is at fault in this or not.

We need a <15 minute recording (preferably about an hour so we can check for synch issues after splitting) created by FMLE with h.264 video and aac audio. Any settings will most likely do. For video we are using 428x240, 300k. Audio needs to be AAC, and preferably 32Khz x 40Kbps. It needs to be talking heads so we can check for synch issues. Please do not flatten the video with the adobe tool.

This issue only seems to appear in the FMLE recordings after about 12-15 minutes. Like I said wirecast seems to produce files that appear identical, but can actually be split by ffmpeg without the “non monotone” errors appearing after several minutes of recording.

If we can prove it’s just an mp3 vs aac audio issue in FMLE we will just buy the aac plugin from mainconcept and be happy. Otherwise we have to deal with wirecast, and we’ve run into a separate issue there that we haven’t been able to solve either. (Black is not black in wirecast for some reason, it’s more of a grey. Seems like a reduced color space compared to FMLE.)

Can someone please try to create a 15 minute h264 mp4 test file using aac for us as outlined above? We really need to find a way to produce non-corrupt mp4 archives from FMLE/Wowza. Alternative would be another simple editing solution that either ignores the non monotone errors, or just works anyway.

Yes, ffmpeg seems to work with anything not created by FMLE. For example anything produced by Wirecast through Wowza edits fine with ffmpeg.

But my problem is I need to be able to edit videos broadcast by FMLE. Something about mp4’s produced by FMLE is different. I can only theorize it has to do with aac because f4v video with aac audio from wirecast works.

The samples that come with Wowza probably weren’t created by FMLE.

That’s why I need someone with the aac plugin to try this. The error in editing does not show up until the video is at least several minutes long with mp3 audio.

Wowza does not recode, check your documentation. It just appears to because you need to use the proper streaming format type and name in FMLE. Use the following format to get mp4 instead of an incorrectly name flv. “mp4:streamnamehere”

We still have our problem with true loss-less splitting of h264 if anyone could help us.