LINUX.ORG.RU

ffmpeg фризы в начале видео файла

 ,


0

2

ffmpeg забирает поток с ip камеры через rtsp и пишет в файл. Результирующий файл воспроизводится но почему то в самом начале секунд 30 картинка не меняется. ffmpeg -rtsp_transport tcp -i rtsp://ip:554/blablaa.sdp -c:v copy -c:a copy /bla/blabl/date.avi Так ни на что не ругается, ни каких ошибок не выдает. Единственное что подозрительно и в чем кстати возможно и дело это битрейт: какой то он эпически низкий в начале записи всего 14 кбит и это для hd видео, потом правда увеличивается до 300 кбит но все равно как то мало. Я как то не совсем понимаю откуда ffmpeg берет такой битрейт ведь я просто копирую поток? по идее он должен быть такой какой выставлен в профиле камеры.


Дай полный лог ffmpeg c -loglevel debug.

Что за камера? Любое дуркование вполне может быть её «спецификой поведения».

Попробуй ещё добавить -analyzeduration 0 -probesize 32

Krieger_Od ★★
()

Ну какой avi! Серьезно, вы что, в 2002? У avi куча проблем с муксингом h264. Попробуйте mp4.

ValdikSS ★★★★★
()
Ответ на: комментарий от Krieger_Od

Это как есть с той строкой что в загаловке

ffmpeg version 1.2.6-7:1.2.6-1~trusty1 Copyright (c) 2000-2014 the FFmpeg developers
  built on Apr 26 2014 18:52:58 with gcc 4.8 (Ubuntu 4.8.2-19ubuntu1)
  configuration: --arch=amd64 --disable-stripping --enable-avresample --enable-pthreads --enable-runtime-cpudetect --extra-version='7:1.2.6-1~trusty1' --libdir=/usr/lib/x86_64-linux-gnu --prefix=/usr --enable-bzlib --enable-libdc1394 --enable-libfreetype --enable-frei0r --enable-gnutls --enable-libgsm --enable-libmp3lame --enable-librtmp --enable-libopencv --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-vaapi --enable-vdpau --enable-libvorbis --enable-libvpx --enable-zlib --enable-gpl --enable-postproc --enable-libcdio --enable-x11grab --enable-libx264 --shlibdir=/usr/lib/x86_64-linux-gnu --enable-shared --disable-static
  libavutil      52. 18.100 / 52. 18.100
  libavcodec     54. 92.100 / 54. 92.100
  libavformat    54. 63.104 / 54. 63.104
  libavdevice    53.  5.103 / 53.  5.103
  libavfilter     3. 42.103 /  3. 42.103
  libswscale      2.  2.100 /  2.  2.100
  libswresample   0. 17.102 /  0. 17.102
  libpostproc    52.  2.100 / 52.  2.100
Splitting the commandline.
Reading option '-rtsp_transport' ... matched as AVOption 'rtsp_transport' with argument 'tcp'.
Reading option '-i' ... matched as input file with argument 'rtsp://ip:554/live1.sdp'.
Reading option '-c:v' ... matched as option 'c' (codec name) with argument 'copy'.
Reading option '-c:a' ... matched as option 'c' (codec name) with argument 'copy'.
Reading option '/mnt/12-02-05.avi' ... matched as output file.
Reading option '-loglevel' ... matched as option 'loglevel' (set libav* logging level) with argument 'debug'.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option loglevel (set libav* logging level) with argument debug.
Successfully parsed a group of options.
Parsing a group of options: input file rtsp://ip:554/live1.sdp.
Successfully parsed a group of options.
Opening an input file: rtsp://ip:554/live1.sdp.
[rtsp @ 0xb4b6e0] SDP:
v=0
o=- 1404547237098474 1 IN IP4 ip
s=RTSP/RTP stream 1 from DCS-2132L
i=live1.sdp with v2.0
t=0 0
a=type:broadcast
a=control:*
a=range:npt=0-
a=x-qt-text-nam:RTSP/RTP stream 1 from DCS-2132L
a=x-qt-text-inf:live1.sdp
m=video 0 RTP/AVP 96
c=IN IP4 0.0.0.0
b=AS:1500
a=rtpmap:96 MP4V-ES/90000
a=fmtp:96 profile-level-id=1;config=000001B001000001B509000001010000012000845D4C29402320A21F
a=control:track1
m=audio 0 RTP/AVP 0
c=IN IP4 0.0.0.0
b=AS:64
a=control:track2

[rtsp @ 0xb4b6e0] video codec set to: mpeg4
[rtsp @ 0xb4b6e0] hello state=0
[rtsp @ 0xb4b6e0] max_analyze_duration 5000000 reached at 5120000 microseconds
[rtsp @ 0xb4b6e0] Estimating duration from bitrate, this may be inaccurate
Guessed Channel Layout for  Input Stream #0.1 : mono
Input #0, rtsp, from 'rtsp://ip:554/live1.sdp':
  Metadata:
    title           : RTSP/RTP stream 1 from DCS-2132L
    comment         : live1.sdp with v2.0
  Duration: N/A, start: 0.000000, bitrate: 64 kb/s
    Stream #0:0, 1, 1/90000: Video: mpeg4 (Simple Profile), yuv420p, 1280x800 [SAR 1:1 DAR 8:5], 1/30000, 30k tbr, 90k tbn, 30k tbc
    Stream #0:1, 42, 1/8000: Audio: pcm_mulaw, 8000 Hz, mono, s16, 64 kb/s
Successfully opened the file.
Parsing a group of options: output file /mnt/12-02-05.avi.
Applying option c:v (codec name) with argument copy.
Applying option c:a (codec name) with argument copy.
Successfully parsed a group of options.
Opening an output file: /mnt/12-02-05.avi.
Successfully opened the file.
Output #0, avi, to '/mnt/12-02-05.avi':
  Metadata:
    INAM            : RTSP/RTP stream 1 from DCS-2132L
    ICMT            : live1.sdp with v2.0
    ISFT            : Lavf54.63.104
    Stream #0:0, 0, 1/600: Video: mpeg4 (FMP4 / 0x34504D46), yuv420p, 1280x800 [SAR 1:1 DAR 8:5], 1/60000, q=2-31, 600 tbn, 60k tbc
    Stream #0:1, 0, 1/8000: Audio: pcm_mulaw ([7][0][0][0] / 0x0007), 8000 Hz, mono, 64 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
frame=  966 fps=4.0 q=-1.0 Lsize=   17321kB time=00:04:07.64 bitrate= 573.0kbits/s
video:11853kB audio:1936kB subtitle:0 global headers:0kB muxing overhead 25.617546%

antech
() автор топика
Ответ на: комментарий от Krieger_Od

это с параметрами что вы указали

ffmpeg version 1.2.6-7:1.2.6-1~trusty1 Copyright (c) 2000-2014 the FFmpeg developers
  built on Apr 26 2014 18:52:58 with gcc 4.8 (Ubuntu 4.8.2-19ubuntu1)
  configuration: --arch=amd64 --disable-stripping --enable-avresample --enable-pthreads --enable-runtime-cpudetect --extra-version='7:1.2.6-1~trusty1' --libdir=/usr/lib/x86_64-linux-gnu --prefix=/usr --enable-bzlib --enable-libdc1394 --enable-libfreetype --enable-frei0r --enable-gnutls --enable-libgsm --enable-libmp3lame --enable-librtmp --enable-libopencv --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-vaapi --enable-vdpau --enable-libvorbis --enable-libvpx --enable-zlib --enable-gpl --enable-postproc --enable-libcdio --enable-x11grab --enable-libx264 --shlibdir=/usr/lib/x86_64-linux-gnu --enable-shared --disable-static
  libavutil      52. 18.100 / 52. 18.100
  libavcodec     54. 92.100 / 54. 92.100
  libavformat    54. 63.104 / 54. 63.104
  libavdevice    53.  5.103 / 53.  5.103
  libavfilter     3. 42.103 /  3. 42.103
  libswscale      2.  2.100 /  2.  2.100
  libswresample   0. 17.102 /  0. 17.102
  libpostproc    52.  2.100 / 52.  2.100
Splitting the commandline.
Reading option '-rtsp_transport' ... matched as AVOption 'rtsp_transport' with argument 'tcp'.
Reading option '-analyzeduration' ... matched as AVOption 'analyzeduration' with argument '0'.
Reading option '-probesize' ... matched as AVOption 'probesize' with argument '32'.
Reading option '-i' ... matched as input file with argument 'rtsp://ip:554/live1.sdp'.
Reading option '-c:v' ... matched as option 'c' (codec name) with argument 'copy'.
Reading option '-c:a' ... matched as option 'c' (codec name) with argument 'copy'.
Reading option '-r' ... matched as option 'r' (set frame rate (Hz value, fraction or abbreviation)) with argument '4'.
Reading option '/mnt/video/12-20-32.avi' ... matched as output file.
Reading option '-loglevel' ... matched as option 'loglevel' (set libav* logging level) with argument 'debug'.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option loglevel (set libav* logging level) with argument debug.
Successfully parsed a group of options.
Parsing a group of options: input file rtsp://ip:554/live1.sdp.
Successfully parsed a group of options.
Opening an input file: rtsp://ip:554/live1.sdp.
[rtsp @ 0xb58920] SDP:
v=0
o=- 1404547237098474 1 IN IP4 ip
s=RTSP/RTP stream 1 from DCS-2132L
i=live1.sdp with v2.0
t=0 0
a=type:broadcast
a=control:*
a=range:npt=0-
a=x-qt-text-nam:RTSP/RTP stream 1 from DCS-2132L
a=x-qt-text-inf:live1.sdp
m=video 0 RTP/AVP 96
c=IN IP4 0.0.0.0
b=AS:1500
a=rtpmap:96 MP4V-ES/90000
a=fmtp:96 profile-level-id=1;config=000001B001000001B509000001010000012000845D4C29402320A21F
a=control:track1
m=audio 0 RTP/AVP 0
c=IN IP4 0.0.0.0
b=AS:64
a=control:track2

[rtsp @ 0xb58920] video codec set to: mpeg4
[rtsp @ 0xb58920] hello state=0
[rtsp @ 0xb58920] Probe buffer size limit of 32 bytes reached
[rtsp @ 0xb58920] Stream #0: not enough frames to estimate rate; consider increasing probesize
[rtsp @ 0xb58920] Stream #1: not enough frames to estimate rate; consider increasing probesize
[rtsp @ 0xb58920] Could not find codec parameters for stream 0 (Video: mpeg4, yuv420p): unspecified size
Consider increasing the value for the 'analyzeduration' and 'probesize' options
[rtsp @ 0xb58920] Estimating duration from bitrate, this may be inaccurate
Guessed Channel Layout for  Input Stream #0.1 : mono
Input #0, rtsp, from 'rtsp://172.16.32.190:554/live1.sdp':
  Metadata:
    title           : RTSP/RTP stream 1 from DCS-2132L
    comment         : live1.sdp with v2.0
  Duration: N/A, start: 0.000000, bitrate: 64 kb/s
    Stream #0:0, 0, 1/90000: Video: mpeg4, yuv420p, 90k tbr, 90k tbn, 90k tbc
    Stream #0:1, 1, 1/8000: Audio: pcm_mulaw, 8000 Hz, mono, s16, 64 kb/s
Successfully opened the file.
Parsing a group of options: output file /mnt/video/12-20-32.avi.
Applying option c:v (codec name) with argument copy.
Applying option c:a (codec name) with argument copy.
Applying option r (set frame rate (Hz value, fraction or abbreviation)) with argument 4.
Successfully parsed a group of options.
Opening an output file: /mnt/video/12-20-32.avi.
Successfully opened the file.
Output #0, avi, to '/mnt/video/12-20-32.avi':
  Metadata:
    INAM            : RTSP/RTP stream 1 from DCS-2132L
    ICMT            : live1.sdp with v2.0
    ISFT            : Lavf54.63.104
    Stream #0:0, 0, 1/8000: Audio: pcm_mulaw ([7][0][0][0] / 0x0007), 8000 Hz, mono, 64 kb/s
Stream mapping:
  Stream #0:1 -> #0:0 (copy)
Press [q] to stop, [?] for help
size=    1124kB time=00:02:19.75 bitrate=  65.9kbits/s
video:0kB audio:1093kB subtitle:0 global headers:0kB muxing overhead 2.855708%
Received signal 2: terminating.

antech
() автор топика
Ответ на: комментарий от ValdikSS
[mp4 @ 0x12362c0] track 0: could not find tag, codec not currently supported in container
Output #0, mp4, to '/mnt/video/17-03-17.mp4':
  Metadata:
    title           : RTSP/RTP stream 1 from DCS-2132L
    comment         : live1.sdp with v2.0
    encoder         : Lavf54.63.104
    Stream #0:0, 0, 1/90000: Audio: pcm_mulaw, 8000 Hz, mono, 64 kb/s
Stream mapping:
  Stream #0:1 -> #0:0 (copy)
Could not write header for output file #0 (incorrect codec parameters ?): Operation not permitted

как бы это при попытки в mp4

antech
() автор топика
Ответ на: комментарий от ValdikSS

Вот, я кажись понял в чем дело! в mp4 не хочет писать от того что не может запихнуть туда аудио, т.е либо копирование в mkv либо вместо копирования ставить aac и тогда пишет в mp4. c этим разобрались. Что касается битрейта то теперь он очень большой 2 мбита и размер выхлопа тоже очень большой что-то около 10 мб на 1 минуту + появилась проблема номер два это время, суть в том что реально прошло 10 сек а ffmpeg рапортует о том что уже записал 30 сек. Причина кроется возможно в том что он рассчитывает длительность исходя из битрейта,о чем кстати сообщает, правда не очень понимаю механизм этого расчета. Analyzeduration и probesize они делают что? подкрутить их побольше пробовал - работало но в части озвученных выше проблем это ничего не изменило. Интересно еще и то что не смотря на то что в ffmpeg мы видим битрейт 2м по факту с камеры летит поток на 3.6м-4м т.е ровно в два раза и совпадение нет, но при конекте к rtsp он пишет информацию о видео потоке так вот там указано 2 fps, хотя при записи и в настройках камеры стоит 4 fps.

antech
() автор топика
Вы не можете добавлять комментарии в эту тему. Тема перемещена в архив.