D-Link Forums

D-Link Network Video Recorders => DNR-202L => Topic started by: ReverendTed on February 27, 2014, 07:12:47 PM

Title: Export as AVI Audio plays at half speed
Post by: ReverendTed on February 27, 2014, 07:12:47 PM
I used the Cue-in\Cue-Out and Save As AVI feature on the Playback page and the resulting video had audio that played at what seemed like half speed, so that it was out of sync with the video and pitched down (with slow and deep sound as if played in slow motion).
My exported video was originally 36 seconds of video, but the file shows a total length of 1:12.  The video portion plays with slow-motion audio until 36 seconds and freezes, and then the slow-motion audio continues until the end.
I tried with both the "AVI (Microsoft video 1)" and "Original format" export options.
It behaves this way on playback in VLC and Windows Media Player.

The resulting AVI file identifies its audio as such:
Codec: PCM S16 LE (araw)
Sample rate : 8000 Hz
Bits per sample: 16
Title: Re: Export as AVI Audio plays at half speed
Post by: ReverendTed on February 27, 2014, 08:40:07 PM
It seems this has to do with the sample rate. 
I managed to correct the issue on a single .avi by hex-editing the file and changing a couple of values in the header. 
One of them I'm pretty sure I knew what it was - I changed an 8000 to 16000  ("40 1F" to  "80 3E") which I presumed to be the sample rate.  That made the audio play at the correct pitch, but it was chopped up. 
A little more fiddling and changing a 2 to a 4 ("02" to "04") made the audio play correctly.
Is this a problem with the unit, or a problem with my PC's AVI\MJPG codecs?

Edit: After a bit more research on .avi headers, I downloaded a RIFF Tree viewer.  It turns out the two settings I changed were nSamplesPerSec (from 8000 to 16000) and "dwBlockAlign" (from 2 to 4).  I put the block align back to 02 and changed dwRate to 16000 and that also seems to work correctly.