Incorrect video playback from some Hikvision IP cameras (related to audio codec?) + workaround
I have a setup with a few Hikvision IP cameras (various models) all recorded by a Hikvision NVR. The issue is with mp4 files downloaded from the NVR, but only those from one specific camera, the DS-2DE7184-AE PTZ camera. When any file (from this camera only) is played, time progress bar goes normally but the picture is still, a frame from the start of the video. The same file is played correctly with Hikvision VSPlayer on Windows, and mplayer on Linux. I can play it in VLC too after processing with this simple command:
ffmpeg -i input.mp4 -c:v copy -an output.mp4
I can provide samples of the files before and after the above command for analysis if necessary, but they are large (~1GB). It seems simply removing audio (which I don't care about anyway - camera has no microphone connected) and copying video unchanged results in the video playing correctly! If I try to copy the audio instead:
ffmpeg -i input.mp4 -c:v copy -c:a copy output.mp4
then ffmpeg fails with this error message:
Stream #0:1[0x1c0]: Audio: pcm_mulaw, 8000 Hz, mono, s16, 64 kb/s
[mp4 @ 0000000002b87dc0] Could not find tag for codec pcm_mulaw in stream #1, co
dec not currently supported in container
Could not write header for output file #0 (incorrect codec parameters ?): Invali
d argument
Error initializing output stream 0:1 --
I've seen this issue in VLC that was current 3 years ago, as well as version 3.0.16 just downloaded, on various computers all running Windows 7 Professional x86-64. So it is nothing new. Hopefully the workaround above will give some hints to a possible fix in VLC. Actually it was not me who discovered it, but the workarounds described by other people also include ffmpeg option "-err_detect ignore_err" which is not really necessary. Converting audio to different format with "-c:a aac" also seems to do the trick.