QNAP includes “Surveillance Station” as an application on their NAS devices, which allows you to setup security camera’s throughout your house or business. It supports numerous camera’s, motion detection, alert messages etc.
One problem I did run into however, was that the recordings of my Foscam IP-camera’s could not be played in any of the media players I had on my Mac, only to find out that Windows and Linux users can experience the same problems.
With a simple trick and free software you can either modify the AVI files (very quick!) or convert the videos to another format. The presented tricks work for MacOS X, Linux and Windows.
Playback of QNAP Surveillance Video Recordings
You probably already know this, the recordings of Surveillance Station can be found in the “Recordings” share on your QNAP, where you will find AVI files of the recordings that have been made, depending on your settings of course.
Note : QNAP got the annoying idea to request purchase of licenses for each camera connected to your QNAP. Previous versions did not require the expensive license, and the latest versions come with only one courtesy license.
The recording format capabilities strongly depends on your camera’s capabilities, since the QNAP does not transcode the video’s.
My Foscam 8910 camera’s seem to like Motion JPEG (MJPG), but other camera’s support h264 etc. In this article I’ll focus on the video’s from my Foscam, but as I have seen in numerous forums, this trick will work for most cheaper IP camera’s as well.
When you try to open one of the QNAP Surveillance Video Recordings, you will most likely get an error message, as for example in VideoLAN VLC as seen below. Notice the ‘VLC does not support the audio or video format “qIVG”.‘ message, where qIVG is the so called FourCC of the video stream.
Other media players will give error messages as well, or simply do nothing at all. Often they lack the detailed information we see with VideoLAN VLC.
QNAP Surveillance Video fails in VLC
Option 1 – Patching the AVI file
If you see the “qIVG” message, then changing the FourCC of the AVI file will fix the issue. It appears that “qIVG” can be played with a Motion JPEG (MJPEG or MJPG) codec.
Note that other camera’s might use different format, I unfortunately do not have any other camera’s to test other formats with.
For this we can use several applications like abcAVI and FourCC Changer, but both are only available for Windows. Instead I use a program I created my self: AVI FourCC Fix. You can download it below, or you can look at the article I wrote about how to use this free application.
Please note that the newer MPEG4 files from your QNAP (FourCC: q264) can be converted with AVI FourCC Fix v1.1 as well (to: H264).
Download - AVI FourCC Fix (Linux 32bit)
Download - AVI FourCC Fix (Linux 64bit)
Download - AVI FourCC Fix MacOSX (64 bits)
Download - AVI FourCC Fix (Windows)
AVI FourCC Fix – FourCC changer for most platforms
The procedure is simple:
- Add files to the list (Click “Select Video Files” or use Drag and Drop)
- Click “Make a Backup“, which is optional but recommended since the original files will be modified.
- Click the “Fix QNAP Recording” button to set the correct FourCC codes.
- Finally click “Change FourCC” which fixes all AVI’s in the list rather quickly, even for files on network shares.
After this procedure your AVI files will play just fine with for example VideoLAN VLC.
Option 2 – Convert the recording to a different Video Format
The second option is to convert the QNAP Surveillance Video Recordings to a different format, and here the free ffmpeg is very helpful. You can find ffmpeg for several platforms on the ffmpeg homepage. I did however find it rather confusing to find a pre-compiled versions for specific platforms. In short, you can find some builds here:
There are plenty other locations to find pre-compiled ffmpeg builds, some of them you can find on the ffmpeg downloads page.
For this we will use the command line and I’ll show you an example for one file and one for multiple files – conversion is relatively fast, but strongly depending on your computer speed.
ffmpeg Documentation
For more details, like supported audio and video codecs, quality settings, and other options, please read the ffmpeg Documentation.
One file conversion at a time with ffmpeg
With ffmpeg you can convert one file at a time with the following command line statement. The example below only converts the video, as most recordings do not have audio:
1
| ffmpeg -i qnaprecording.avi -vcodec libx264 -an qnaprecording.m4v |
If you do have recordings with audio then the following statement can be used (removed the “-an”):
1
| ffmpeg -i qnaprecording.avi -vcodec libx264 qnaprecording.mp4 |
In both examples, you of course have to replace “qnaprecording.avi” with the filename of the AVI file you’d like to convert. “qnaprecording.m4v” or “qnaprecording.mp4” will be the name of the newly created file.
Batch conversion with ffmpeg (Linux/MacOS X)
Below an example of a script (works under MacOS X and Linux) in which I used above statements to convert all AVI’s found in the mentioned directory. The example below uses conversion without audio, but removing the ” -an” (do not remove the double quotes) from the 3rd line will convert audio as well.
Save the code below in a plain text file, for example called “convert”, and use chmod +x convert
to make it executable. On the commandline type ./convert
to execute your script.
Don’t forget to change the “MOVIES” variable in line 2 to the location where your recordings are.
1 2 3 4
| #!/bin/bash
MOVIES=/Volumes/Recordings/
find "$MOVIES" -name '*.avi' -exec sh -c '~/Desktop/ffmpeg -i "$0" -vcodec libx264 -an "${0%%.mp4}.m4v"' {} \;
exit; |
Comments
There are 86 comments. You can read them below.
You can post your own comments by using the form below, or reply to existing comments by using the "Reply" button.
Brilliant! Thanks very much!!!!
Andy
Thanks Andy!
Glad it was helpful for you as well.
hans
Yep great, just need to fix the q264 playback now….
Andy
How do you mean?
hans
Your fix has fixed my file from the foscam 8904. My other camera is a foscam 9805. When I try to play those files back I get a similar error but q264 is mentioned. This is trying to play in vlc.
andy
Got it!
– H264
– h264
– X264
– x264
– DAVC
– LMP4
– SVQ3
hans
Hi Hans, I have the same issue as Andy: Qnap with a Foscam 9805. I tried the FourCC code’s you suggested but I can’t play the video file from VLC on OSX.
If you still don’t own an h264 cam I can share one of my AVI file so maybe you can help us to solve the issue:
You can download it from my website: http://www.consulentefidato.it/H264.avi
Franco
Did you try the FourCC’s from this list?
– AVC1
– H264
– h264
– X264
– x264
– DAVC
– LMP4
– SVQ3
I’m traveling right now, so I’m limited in what I can test and try ,… and I never heard from Andy if it worked or not.
hans
Yes, I tried all of them (please note that h264 and x264 options are not available) but the result is always the same: “VLC does not support the audio or video format “q264”.
Franco
During playback in VLC, VLC mentions that it can’t handle “q264“.
Change this to “H264” and your AVI plays just fine.
In the FourCC Fix, set in the “FourCC Change” box:
Current: q264
New: H264
and press the “Change FourCC” button …
The AVI now plays in VLC without a problem … (tested with the test file of Franco)
hans
I just read your reply haha … I ran into that too, since the h264 recordings do not use the “qIVG” as seen with MPEG recordings …
hans
Hans, in the “FourCC Change” box I can’t find the option “q264” for Current (I looked for it since the first try btw…)
Maybe I’m missing something?
Franco
Hi Hans,
please ignore my last reply, I’ve just found that I can simply enter the fourCC code “q264” with the keyboard in the Current field and your tool works like a charm!
thanks again!
Franco
Consider it ignored haha …
hans
Hi,
Just seen these replies. That works a treat for me! Thanks!
Andy
Andy
You’re most welcome!
hans
Hello, I tried manually inputting q264 for the current codec and change it to H264. The video plays without a hitch on the Mac VLC. The issue is I lost the audio to the video file. Is anyone else having the same issue? Thanks.
John
Hi John,
I apologize, I’ve never payed attention to the audio track …
If anyone runs into what 4CC needs to be changed to get the audio code right, then please post it here.
Once I’m back home (traveling at the moment), I’ll try to take a look as well.
hans
Thanks for your prompt response. I’m not a programmer myself, but if there’s anything I can do to help, please let me know.
John
I have to examine the audio track codec. The example from Franco (see link above) does not seem to have an audio track (after applying the FourCC trick), which I just tried …
@Franco: Can you confirm that there is no Audio in your example?
If anyone has a recording with audio, then please post a link here so I can check it out (with the limited resources I have at hand while traveling).
hans
Hans, Mediainfo for my H264.avi file reports:
Audio stream: 64.0 Kbps, 8000 Hz, 8 bits, 1 channel, ADPCM (CCIT) (U-Law)
But honestly I never care about the audio track for my purpose… O:-)
Franco
Reading the manual, I’ve just discovered that in order to get audio recording for 9805W you need to use and external mike connected to the yellow female rca connector (and I didn’t just because I don’t care about it…)
Franco
Thanks Franco … great info: that saves me digging through the file.
I do not record audio either, simply never bothered even looking into it.
hans
Dear Hans, please find below two files for your consideration. One is the original video file captured on my QNAP unit. The other is the altered file using your tool. The following is what’s happening:
1. VLC for Mac can play the altered file with no audio. VLC for Mac CANNOT play the original file.
2. VLC for PC can play the altered file with audio. VLC for PC CANNOT play the original file.
John
Oops, I forgot the link!
John
This would suggest that the audio codec might be missing under MacOS X – but I would expect VLC to complain about that (which it doesn’t seem to do) … I’ll take a look and see what I can do – thanks for posting the files!
hans
Checking the files with ffprobe gives me:
So, on a Mac that Audio format is not even recognized by ffProbe/ffMPEG which would explain why VLC does not see the stream even after doing a FourCC on the video stream … (codec is not defined ie: “none”)
As soon as I can lay my hands on a Windows machine, I’ll try ffProbe there to see what is says under Windows. Obviously Windows somehow knows what to do with it.
hans
Did you ever find a fix for the audio Hans? Still very interested, converting with ffmpeg (which does keep the audio) is very slow.
Quassum
Hi Quassum,
I have not found a proper solution for the audio (yet).
It seems that the used codec is “weird” or non-standard, or simply none existing (see comment of Franco).
When you convert with ffmpeg, I assume your recordings do have audio.
In the QNAP Forum I did see a post claiming that the latest (or beta) release of VLC should play the video’s without the need to convert them – it’s worth a try.
hans
Hi Hans,
after converting with ffmpeg the file does have audio, VLC identifies the codec as MPEG AAC Audio (mp4a). Maybe this helps?
Quassum
@Quassum:
So the original has Audio.
Can you see with ffmpeg what the original audio codec is?
If I recall correctly, ffprobe (which could be included with the ffmpeg you’re using) should be able to list the codecs of the original file:
hans
Sure, here you go:
Quassum
As far as I can find, that codec cannot be “swapped” by simply changing the 4CC.
Not to mention: I don’t know what the 4CC for “pcm_mulaw” is.
I’ve looked around with the help of Mr. Google – no dice so far.
To change the 4CC we would have to determine the 4CC to replace first, so we can experiment.
Maybe a program like GSpot or abcAVI Tag Editor (both Windows only) could provide an insight.
4CC though is more geared towards video, so my application might not be able to address this issue.
What kind of camera are you using? Foscam?
hans
Don’t have any Windows PC’s over here unfortunately. If you want I can provide you with a sample clip, I’m sure audio support would be an excellent additon to your briljant program !
This is coming from a Foscam yes.
Quassum
Thanks
Ehm, what model Foscam do you have?
Of course sharing a small example file would be great – can you share through DropBox (for example)?
hans
It’s a FI9826W and just shared a short one minute clip with audio via the contact form, sorry for the delay!
Quassum
Hi Quassum!
No worries!
I’ve downloaded the AVI and will look at it later this week – I’m abroad right now and will be traveling most of the week.
Once I get back home, I’ll take a peek
hans
Great stuff, many thanks in advance already. Enjoy your stay abroad!
Quassum
Since I got a couple of notifications again; did you already do anything with that test file I sent you last year Hans?
Quassum
Hi Quassum!
I recall your AVI file, and recall having looked at it. Since I didn’t have much time (moving around a lot), I didn’t find a proper for the “none” type Audio.
Now that I had another codec question, I wanted to look at yours again to see if there was a trick – but I have no idea where I left your AVI file (I was working with another computer).
Sounds though that these two might be related. Any chance you can send it again?
hans
Filled in your contact form just now, hope it helps, let me know!
Quassum
Awesome! That worked – downloading now …
hans
Great, many thanks again for your time!
Quassum
I made some progress (by accident) with your sample video with ffmpeg. It’s not yet perfect so I’ll be toying some more with it.
When I do this with ffmpeg (which goes relatively fast):
Then video and audio works! However … it seems to drop an awful lot of video frames.
By the way; audio quality is crappy (not surprising with only 8kbps).
I’ll keep playing with it some more.
hans
Yup, that was what I’m doing right now already, only with -vcodec libx264. Was hoping there was a more elegant and fast solution that just patched the files though.
Quassum
Just tested as well -vcodec h264 and -vcodec libx264 both result in the exact same file here.
Quassum
Well, I’m hoping to find where exactly to “patch” the file to get the file going …
Is the motion correct? I did see a lot of dropped frames during conversion.
I also tried just copying the video stream (-c:v copy), but ffmpeg simply fails on that one. Either it will not copy the video or it gives an error message.
hans
Would you be able to send a test file with a little bit more motion?
At times it’s very hard to see if the frames actually get dropped or if the video is supposed to be this way?
Right now I just see a window, and hear music.
hans
Frames are actually dropped I can tell you from experience, it’s very noticeable. I have to find a suitable scene if it’s really better to have something constantly moving.
Quassum
Well, you could just record a few seconds while moving the camera around a bit (just move it left/right – just enough to see that there is motion). And with some effort I can see that it’s dropping frames as well. Just not as obvious, since I cannot play the original file haha …
hans
I just tried this:
Which results in the same frame dropping, just seemed easier to type
hans
Just uploaded another sample with audio and a bit more movement, hope it helps.
Quassum
Awesome – I’ll start downloading it in a minute!
hans
I managed to convert the file with ffmpeg – but it really drops a lot of frames, although in the video (good thinking with the iPhone timer!! ) doesn’t show issues with the dropped frames after conversion.
The audio track however, remains a weirdo. I fear that there will be no way to make it playable without conversion.
When using ffmpeg and copy the video anc convert the audio, we only endup with audio, however …
After doing this:
It’s quick (seconds!) and converts audio, but copies video (no video transcoding), and after that apply the Avi FourCC Fix for the new MP4 format, then we suddenly have an AVI that does play!
So in short:
1) ffmpeg -i YourFoscam.avi -c:v copy YourFoscamWithAudioConverted.avi
2) Apply “Fix MP4 (new)” in “Avi FourCC Fix” on the “YourFoscamWithAudioConverted.avi“
And then you have, relatively quickly, a working AVI file!
I used ffmpeg 3.0, on a Mac, and playback with VLC. Please try this and see if it work for you.
If it does, then I could consider building this into Avi FourCC Fix.
hans
Tested that method and works beautifully for me as well. Although in al fairness I’m testing with almost the same setup, Mac with ffmpeg version 2.8.1. Would be really nice to have this build into your FourCC program.
Quassum
Do you have any large recordings? Just to see how slow conversion would be. Right now we’ve tested a small file, and on my MBP the conversion is very fast, so I have no clue about timing with larger recordings.
hans
I believe the maximum is 15 minutes, just a regular recording without movement?
Quassum
Would be nice to test:
1) ffmpeg -i YourFoscam.avi -c:v copy YourFoscamWithAudioConverted.avi
2) Apply “Fix MP4 (new)” in “Avi FourCC Fix” on the “YourFoscamWithAudioConverted.avi“
And see how “well” this trick works on longer recordings – I do not need such a recording myself of course.
Just wanted to know how “bad” things get, and if the result is acceptable, then I could include this in AVI FourCC Fix …
hans
Yup works perfect, ffmpeg command takes only 3 seconds on a 10 minute file here and “Fix MP4 (new)” is instant of course.
Quassum
I wish I could help, but I’m an idiot when it comes to video codecs. Thank you in advance!
John
No problem John …
I just tested ffprobe under Windows and it basically says the same:
Which means that audio under Windows appears to be working coincidentally? I might be concluding the wrong thing here, but if ffprobe cannot even find a codec, then I just assume that the stream has no [proper] codec definition.
Note:
1) I examined the file with GSpot as well, which returns the same result for the Audio codec (0xf726(unknown)). GSpot also indicates under Windows that the “codec” is installed and that the audio is 8000Hz 8 kb/s (1 channel).
2) Playback under Windows and Mac OS X, using VLC, indicates that there is either no supporting codec (original) or only one strea, (altered file). In the altered file only 4 bytes have been changed for the video codec FourCC, so the Audio stream is unaltered. Windows Media Player does still produce Audio when playing the altered file.
3) The FourCC Changer (only available for Windows, not from Tweaking4All.com) does not seem to be able to “fix” this either.
4) Other codec detection tools return the same result … oddly enough.
hans
Thank you so much for trying. It’s so frustrating to see QNAP releasing such a wonderful surveillance system only to find out that you can only properly use it on a PC. On top of that, there’s not a easy way to convert these files for viewing on iPads. I’ve tried Synology’s system. The clips work right out of the box on both Mac and PC VLC. The only downside is the UI, which I find quite confusing to use. I hope one day QNAP just sticks with the common codecs to save everyone time and effort.
John
Couldn’t agree more … it’s sooooo unnecessary to have crippled AVI files – as you can see with both the MPEG and H264 video codecs, changing 4 bytes fixes it. Shame on QNAP for that … not to mention the ridiculous license price for each camera we’d like to use.
hans
Thank You for Your hard work.
I was looking for this fix in The Internet for a while now. This solve my problem with qotdoor Ip camera called ‘coolcam nip-06’ and qnap server. I thought I would never find fix to this.
I appreciate Your work toward making Linux version of video decoder.
Thank You
Bipius
Bipius
Thanks Bipius!
You’re most welcome, and I’m glad to hear this little tool works well for you as well.
Thank you for taking the effort to leave a positive feedback – always a good motivator!
hans
Great Thanks !!
Jaga George
You’re welcome!
hans
i have a qnap nvr on my network , recently iv been receiving an error in the play back when i try to view previous recording it keeps saying “no recordings” however when i switch to low bandwith mode i can view the footage just fine …. please help me solve m problem the NVR is VS-4116U pro
Peter
Hi Peter,
I do not have an NVR, but I’ll just carefully assume it’s a QNAP NAS variant.
Could it be that your QNAP is removing old highres recordings for space (see if you can find the actual file on your QNAP).
Or maybe it didn’t record highres to begin with?
I’m just guessing …
hans
Hi Guys,
I followed every steps but doesn’t work for me. VLC continues to show up qIVC error.
Do you have any suggestion?
Dil
Did you try option 1: Avi FourCC Fix, or Option2: Converting?
If you still get the qIVC error, then something went wrong, as that FourCC code should not appear in the “new” file at all.
I created Avi FourCC Fix for that purpose. I actually replaces the FourCC code with a valid one.
Since you have the iQVC error, in the latest version of Avi FourCC Fix (1.1), simply click the “Fix MJPEG (old)” button after you’ve added the file(s).
hans
Thanks Hans!
It works using “Fix MJPEG” button!
Thank you very much!
Dil
Awesome!
hans
[…] updating the tag, I was able to play files on linux with VLC. This post pointed me in the right direction for fixing the […]
Great program for the newer files. Any idea for the qv6k codec ?
John
Thanks John,
I have not heard of the qv6k codec … do you have any info on it?
hans
As far as I could find info, QV6K is an MPEG4 variant? But what kind of MPEG4 variant?
I do not have any sample avi’s in that format to test with.
Did you try replacing “qv6k” with “h264” ? You can type the text “Current” and “New” fields.
If that didn’t work, try “QV6K” and “h264“? I’ve seen it spelled in all caps elsewhere.
Or if you can provide a short example file, then I’d be more than happy to test …
hans
Hi Hans ,
Thanks. I have both type of recordings , in capitals and without . When I type it in manually and I choose MP4V it works but i loose the audio.
I have tried others, without any success so far. Im happy with this , great program, but would love to have audio too.
Thanks !
John
Cool, so did you replace the “QV6K” or the “qv6k” with “MP4V”?
I’d have to analyze a video sample to know what’s happening to the Audio.
Any idea where I can get a short example AVI?
hans
Maybe I should say: is there a way you can make one available (ie. Through DropBox or something like that) ?
Just a few seconds is enough … no need for very large files haha …
hans
Hi hans,
Will send u a dropbox link with a file. Thanks !
John
Awesome! Thanks!
(sorry I lost the previous file)
hans
That works easily and quickly, thanks for that.
Damon
Thanks Damon, for taking the time to post a Thank-you!
It’s much appreciated!
hans
I have a security camera I’m trying to hook it up to my Wi-Fi router I have a A/V conkit4c interface box can I hook that up directly to my Wi-Fi router AT&T U-verse and if so how do I find the camera on my Samsung galaxy 7 thanks hope you can help
NICK NICHOLS
Hi Nick,
Your question is a little off topic for this article, so next time please post it in the forum.
I’m not familiar with your setup, but in general an IP based security camera can be connected to your router. For most brands there is a brand specific application to access you video from your phone, and some support accessing your camera over the Internet. I recommend consulting the manufacturers website.
hans