Hikvision DS-2CD2032 카메라의 표준 호환 비디오 저장

Hikvision DS-2CD2032 카메라의 표준 호환 비디오 저장

동영상을 저장하려고 합니다.하이크비전 DS-2CD2032 카메라(일명 Swann HD-820CAM, 일명 Lorex MCNB2151) ffmpeg를 통해. 기본적으로 다음과 같은 명령으로 작동합니다.

$ ffmpeg -rtsp_transport tcp -i rtsp://user:pass@ip/ -c copy -map 0:0 driveway.mp4
ffmpeg version N-73641-gb90b6af Copyright (c) 2000-2015 the FFmpeg developers
  built with gcc 4.9.1 (Ubuntu 4.9.1-16ubuntu6)
  configuration:
  libavutil      54. 28.100 / 54. 28.100
  libavcodec     56. 48.100 / 56. 48.100
  libavformat    56. 40.100 / 56. 40.100
  libavdevice    56.  4.100 / 56.  4.100
  libavfilter     5. 21.100 /  5. 21.100
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  2.100 /  1.  2.100
Input #0, rtsp, from 'rtsp://user:pass@ip/':
  Metadata:
    title           : Media Presentation
  Duration: N/A, start: 0.466078, bitrate: N/A
    Stream #0:0: Video: h264 (Main), yuv420p(tv, bt709), 1280x720, 15 fps, 15 tbr, 90k tbn, 30 tbc
    Stream #0:1: Data: none
[mp4 @ 0x24f6720] Codec for stream 0 does not use global headers but container format requires global headers
Output #0, mp4, to 'driveway.mp4':
  Metadata:
    title           : Media Presentation
    encoder         : Lavf56.40.100
    Stream #0:0: Video: h264 ([33][0][0][0] / 0x0021), yuv420p, 1280x720, q=2-31, 15 fps, 15 tbr, 90k tbn, 90k tbc
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
Press [q] to stop, [?] for help
[mp4 @ 0x24f6720] Non-monotonous DTS in output stream 0:0; previous: 0, current: -30013; changing to 1. This may result in incorrect timestamps in the output file.
[mp4 @ 0x24f6720] Non-monotonous DTS in output stream 0:0; previous: 1, current: -23990; changing to 2. This may result in incorrect timestamps in the output file.
[mp4 @ 0x24f6720] Non-monotonous DTS in output stream 0:0; previous: 2, current: -17996; changing to 3. This may result in incorrect timestamps in the output file.
[mp4 @ 0x24f6720] Non-monotonous DTS in output stream 0:0; previous: 3, current: -11994; changing to 4. This may result in incorrect timestamps in the output file.
[mp4 @ 0x24f6720] Non-monotonous DTS in output stream 0:0; previous: 4, current: -5992; changing to 5. This may result in incorrect timestamps in the output file.
[mp4 @ 0x24f6720] Non-monotonous DTS in output stream 0:0; previous: 5, current: -18; changing to 6. This may result in incorrect timestamps in the output file.
frame=  178 fps= 18 q=-1.0 Lsize=    1711kB time=00:00:11.39 bitrate=1229.3kbits/s
video:1708kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.177573%

하지만 경고 메시지가 걱정됩니다. 특히, 비디오가 원활하게 재생되지 않거나 일부 플레이어와 원활하게 상호 작용하지 않을 수 있는 문제를 해결하고 싶습니다. 그래서...

  1. "글로벌 헤더"란 무엇입니까? 그들이 실종된 결과는 무엇입니까? 다음에서 dump_extra에 대한 메모를 찾았습니다.ffmpeg 비트스트림 필터 문서. 설명된 "-flags:v +global_header -bsf:v dump_extra"를 추가하면 경고가 사라집니다. 정확히 무엇을 하고 있는 걸까요? 패킷당 헤더에서 글로벌 헤더로 무언가를 이동시키는 것 같아요. 어떻게 이것을 조사하고 차이점을 관찰할 수 있습니까?
  2. "단조롭지 않은 DTS" 경고에 대해 무엇을 할 수 있습니까?

fwiw, 나는 다음과 같이 각 프레임에서 DTS 정보를 덤프하는 libavformat을 사용하여 사용자 정의 프로그램을 작성했습니다.

while (av_read_frame(input_context, &packet) == 0) {
  if (packet.flags & AV_PKT_FLAG_KEY) {
    cout << "have key frame, dts: " << packet.dts << endl;
  } else {
    cout << "  have non-key frame, dts: " << packet.dts << endl;
  }
}

그러면 이것이 잘못된 dts를 가지고 있는 키 프레임인 것 같아요. 그걸로 무엇을 해야할지 모르겠습니다.

have key frame, dts: 41995
  have non-key frame, dts: 12033
  have non-key frame, dts: 17966
have key frame, dts: 23970
  have non-key frame, dts: 29992
  have non-key frame, dts: 35992
  have non-key frame, dts: 41995
  have non-key frame, dts: 47995
have key frame, dts: 53973
  have non-key frame, dts: 59994
  have non-key frame, dts: 65996
  have non-key frame, dts: 71995
  have non-key frame, dts: 77994
have key frame, dts: 83978
  have non-key frame, dts: 89993
  have non-key frame, dts: 95997
  have non-key frame, dts: 102035
  have non-key frame, dts: 107978
have key frame, dts: 113976
  have non-key frame, dts: 119998
  have non-key frame, dts: 126000
  have non-key frame, dts: 131997
  have non-key frame, dts: 138000

관련 정보