Samsung RE4 and VFS4 Files

Samsung gives you a few options – but which one is best?

This was a bit of a coincidence! I had been working on a Samsung export article on and off for a few weeks and then Jim mentions them over on his great site at FORENSIC PHOTOSHOP.
He actually mentions the ease of processing these files from within the Amped FIVE software. It’s very true that FIVE does deal with a lot of files very well and its interface, being standalone, gives a user some considerable flexibility. The fantastic quality of the software comes at a price though. If you are unlucky enough not to have a copy of FIVE then you are not out of options…….

A large number of Samsung DVR’s, that use MPEG4 encoding, are able to export in a variety of container files:
The .VSF4 container is used when exporting to optical disk (CD/DVD).
The .RE4 (and .RE3) container is used when exporting via Flash Media (USB) or Network. The DVR’s refer to these as .REC’s.
The .AVI container is used whenever required, over Network or Flash Media.
I suppose at this point the question has to be asked – why all the differences? Well, to be honest I don’t know. It would have been far easier to just have one single container for their recording format and then any splitting, de-muxing, re-wrapping and transcoding completed within their playback software.
Anyway, I digress….

Lets look at the single .AVI container first.

It plays fine but with no timecode. It can be analysed fully within any standard media tool (MediaInfo,Gspot, AVInaptic, FFprobe etc). All tools report that it has been encoded using Xvid.

Gspot-avi

The Gspot VGS (Visual GOP Structure) result causes some concern though. The non-uniformity of the structure, linked with the frame count, identifies that something has happened in the rewrapping. The Stream is shown as having a substantial amount of duplicate frames. This is explained when analysing the settings on the DVR and identifying that it was recording at a lower frame rate. The DVR has added duplicate frames to meet the PAL standard of 25 Frames per Second. The file can be dealt with easily, but due to the duplicates and non- standard GOP, it may be simpler to avoid this re-encoded option unless that’s all you have to deal with.

Moving onto .VFS4, the CD/DVD Option….
In my experience, both the .VFS4 and .REC exports usually arrive with the Samsung MiniPlayer included.

vfs4-miniplayer

This is a handy little playback tool that is suitable for people who need to quickly view and assess the footage. There is not much to it, but it does allow you to quickly export stills and navigating around the clip is very easy. The big bonus is that it displays the timecode which is on an overlay. This timecode is also placed onto exported stills.
Both VFS4 and the RE files are wrapped mpeg4 streams, so what’s with the different extensions? It would appear that the VFS4 is always one single file. So a 1hr period of time would sit entirely within the one file. The RECS (RE4 and RE3 etc) however are split. A 1hr period of time for a single camera would be split into approx. 14 different segments.
Sticking with the single camera VFS4, let’s take a closer look…..

It’s not recognised when dropped into MediaInfo but it will play when using ffplay and forcing the mpeg4 input:

ffplay –f m4v inputfile.vfs4

You may find that FFplay will ‘stutter’ a bit at a few sections of the video. If so, then you may need to extract the mpeg4 chunks using Defraser first before any rewrapping. I believe this is down to the file containing other, non-video, data.

Defraser1

Defraser2

If your analysis requires it, Defraser is very good for verifying your frame type findings against other software. For this case though, we are going to extract all the mpeg chunks by selecting them all and choosing ‘Save Selected as Contiguous File’. You will now have a new raw mpeg4 file, ready for post processing.
To place this inside an AVI container using FFmpeg:

ffmpeg –i defraserout.m4v –vcodec copy –fflags genpts –f avi fileout.avi

If you have not needed to use Defraser then you will probably need to force the file to be read as an mpeg4 video by FFmpeg:

 ffmpeg –f m4v –i originalfile.vfs4 –vcodec copy –fflags genpts –f avi fileout.avi

Whichever method, your end result will be exactly the same. Your new mpeg4 avi file will be scrubable and editable in all the usual software.
Obviously, if you require to sort out the frame rate, increase the resolution and then transcode directly from FFmpeg – that’s also pretty easy to do. I do not like doing this though. I prefer to do that bit within a visual environment, such as Virtualdub.

So, what about the RE4 files then?
Rather than a single camera, let’s look at a multicam file, an RE4 which contains a number of camera streams.
Initial playback is not a problem through the miniplayer. It detects all the streams and the timecode is shown on the overlay.

re4-multicam-miniplayer

When its analysed however, the file only is shown to contain a single stream. The reason is that Samsung have not followed the standard for muxing multiple mpeg4 streams into a single file. This means that it is not a simple answer of adding in the stream id within ffmeg and just extracting that stream. See stream mapping.
How are we going to do it then?

Experience has taught me that in many situations, the player or utility supplied with the video is often lacking in important tools. Those tools are often left on the install disk next to the DVR or, if they are installed on an owners computer, they are never used or understood.
The Samsung Network Client SNM-128S is primarily designed to connect to remote DVR’s and view data, but it also acts as a player. It gives you a bit more information as well, especially on Motion Detection. (It’s available in my shared BOX on the right!)

SNMplayer

The install and all included software is able to be virtualised into a standalone ‘app’ that does not require installation. Check out Cameyo for this task.

The big bonus though is that it has the ability to split your RE4 files into camera specific files. You will end up with a new RE4 file containing just the camera selected. From here you can use FFmpeg as detailed above in order to rewrap into a clean file for further analysis / processing.

SNM-Backup

If you then had to join a number of these together in order to make a single, continuous stream, all you would need is the concat filter in FFmpeg. See more on Concat.

When dealing with these files you will see that their GOP structure is much neater compared to that on the .avi option. This makes things easier to identify what is going on in the file.

vfs4-newGOP

Lastly – Timings. From reviewing frame rate settings on the DVRs, and then frame counting within the player, I have found some considerable differences. The DVR may be set to record at a rate of 21FPS but in reality can be as low as 14 and go higher than the figure set. Depending on your requirements, it may be worth reviewing these.

These are very common files. By understanding each export option and ensuring a structured workflow, you are able to show that the data is unchanged through the entire process. Although new files are created, the raw video data inside is exactly what you started off with – just neater and easier to deal with!

What have we learnt from all of this:
These files are easy to deal with for every scenario – once you know about the little ‘issues’!
Manufacturers should stick with standardised formats – If they are going to mux a number of streams together – give us the ability to demux them!
The miniplayer is a good idea but needs a hyperlink directing users to other tools that may be of use.
And on that note – look what’s hidden away in the installation path of the SNM-128S Software…

fileconverter

Enough said…..
I hope this helps you in your battle with proprietary video!

Advertisements
By Spreadys Posted in EEPIP

2 comments on “Samsung RE4 and VFS4 Files

  1. Thanks so much for this post! Very helpful information indeed. I’ve been successful in getting individual videos from a .re4 file via the methods you outlined, but I’ve had some issues getting them to playback perfectly in sync – I need to get all of the videos out of the .re4 container, then be able to composite them back together in Final Cut. The .re4 files play back perfectly in sync within the Player app, but when they are exported to .avi they aren’t all exactly the same length. It seems as though videos with audio end up being shorter than videos without audio. This problem is exacerbated even further the longer the exported video. This has been driving me bananas! Any suggestions?

  2. Adam, Apologies – only just noticed your comment! Synching of rewrapped streams is always going to be problematic due to frame rate but hopefully you figured out a solution.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s