Question

How to merge a abc.mp4.tmp swap file with actual abc.mp4 file. I was trying to recording a live event using Wowza Media server 3.6 and the recorded file was not muxed properly at final moment. The abc.mp4.tmp swap file was not merged with actual abc.mp4 file. So could someone tell me how to merge the abc.mp4.tmp and abc.mp4 file and creates a new file and I can able to play with vlc

Here is the mediainfo of the files

[root@ip-ss-21-98-2 content]# mediainfo 03_03_2014_12_03_08.mp4
General
Complete name                            : 03_03_2014_12_03_08.mp4
Format                                   : MPEG-4
Format profile                           : Adobe Flash
Codec ID                                 : f4v 
File size                                : 5.20 GiB


[root@ip-ss-21-98-2 content]# mediainfo 03_03_2014_12_03_08.mp4.tmp
General
Complete name                            : 03_03_2014_12_03_08.mp4.tmp
File size                                : 38.3 MiB

No correct solution

OTHER TIPS

While recording is in progress, the .mp4 file contains ftyp and wide atoms, followed by an mdat atom where video/audio data are appended. The mdat atom does not yet have its size or type fields set.

The .mp4.tmp file contains a Wowza-specific format used to store stbl (sample table) entries that can be appended to while recording. Each entry in this file has a 4-byte type field (stsz, stts, stsc, stco or stss), followed by a 4-byte size field, followed by size bytes of data (the bytes used by the type/size fields are not included in the value of the size field). This format is based on files I created with Wowza 4.1.2, and may change with new Wowza versions.

I also had a known good .mp4 file created by Wowza from the same input source to use as a reference.

To create a working .mp4 file, I set the size field of the mdat atom to the number of bytes remaining in the .mp4 file and the type field to mdat, then appended a moov atom built from atoms in the known good file and the sample table entries in the .mp4.tmp file.

The sample table entries in the .mp4.tmp file don't indicate whether they apply to the video or audio tracks, so it took some guesswork based on average sample size, average samples per chunk, and order written into the .mp4.tmp file to determine how to map these entries to tracks. Since the recording was interrupted, not all of the sample tables indicated the same number of samples were present, so I truncated the longer ones.

Apple's QuickTime File Format docs provided a good reference for the structure of the atoms I needed to recreate to get a working file.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top