How to use ffmpeg for segmentation of rtsp-stream into mov files

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP



How to use ffmpeg for segmentation of rtsp-stream into mov files



I have a webcam that gives a RTSP-stream and I want to save it into MOV-chunks of lets say 5 sec. The stream is:


rtsp://user:pwd@192.168.1.90:10554/tcp/av0_0



I can open the stream and play it in VLC. I run ffmpeg as below, which looks sane, but the output is black video only. Where did I go wrong?


ffmpeg -rtsp_transport tcp -i "rtsp://user:pwd@192.168.1.90:10554/tcp/av0_0" -f segment -segment_time 5 -segment_format mov -c copy -map 0 video%d.mov
ffmpeg version 3.1.1 Copyright (c) 2000-2016 the FFmpeg developers
built with Apple LLVM version 7.3.0 (clang-703.0.31)
configuration: --prefix=/usr/local/Cellar/ffmpeg/3.1.1 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-opencl --enable-libx264 --enable-libmp3lame --enable-libxvid --enable-ffplay --disable-lzma --enable-vda
libavutil 55. 28.100 / 55. 28.100
libavcodec 57. 48.101 / 57. 48.101
libavformat 57. 41.100 / 57. 41.100
libavdevice 57. 0.101 / 57. 0.101
libavfilter 6. 47.100 / 6. 47.100
libavresample 3. 0. 0 / 3. 0. 0
libswscale 4. 1.100 / 4. 1.100
libswresample 2. 1.100 / 2. 1.100
libpostproc 54. 0.100 / 54. 0.100
Guessed Channel Layout for Input Stream #0.1 : mono
Input #0, rtsp, from 'rtsp://user:pwd@192.168.1.90:10554/tcp/av0_0':
Metadata:
title : streamed by the RTSP server
Duration: N/A, start: 0.230000, bitrate: N/A
Stream #0:0: Video: h264 (High), yuv420p, 1280x720, 20 fps, 25 tbr, 90k tbn, 40 tbc
Stream #0:1: Audio: pcm_alaw, 8000 Hz, 1 channels, s16, 64 kb/s
[segment @ 0x7fda5e012400] Using AVStream.codec to pass codec parameters to muxers is deprecated, use AVStream.codecpar instead.
Last message repeated 1 times
Output #0, segment, to 'video%d.mov':
Metadata:
title : streamed by the RTSP server
encoder : Lavf57.41.100
Stream #0:0: Video: h264, yuv420p, 1280x720, q=2-31, 20 fps, 25 tbr, 10240 tbn, 40 tbc
Stream #0:1: Audio: pcm_alaw, 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
[segment @ 0x7fda5e012400] Non-monotonous DTS in output stream 0:0; previous: 0, current: -1946; changing to 1. This may result in incorrect timestamps in the output file.
[segment @ 0x7fda5e012400] Non-monotonous DTS in output stream 0:0; previous: 1, current: -1536; changing to 2. This may result in incorrect timestamps in the output file.
[segment @ 0x7fda5e012400] Non-monotonous DTS in output stream 0:0; previous: 2, current: -1126; changing to 3. This may result in incorrect timestamps in the output file.
[segment @ 0x7fda5e012400] Non-monotonous DTS in output stream 0:0; previous: 3, current: -717; changing to 4. This may result in incorrect timestamps in the output file.
[segment @ 0x7fda5e012400] Non-monotonous DTS in output stream 0:0; previous: 4, current: -307; changing to 5. This may result in incorrect timestamps in the output file.
frame= 204 fps= 24 q=-1.0 Lsize=N/A time=00:00:07.89 bitrate=N/A speed=0.937x
video:2057kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
Exiting normally, received signal 2.





Does ffplay play the output?
– Gyan
Aug 12 at 5:04





It does play the file, but not QuickTime...
– user331244
Aug 12 at 7:52





Probably due to the audio. Change -c copy to -c:v copy
– Gyan
Aug 12 at 8:17


-c copy


-c:v copy





Doesn't help. The output says: <br/> Output #0, segment, to 'video%d.mov': Metadata: title : streamed by the RTSP server encoder : Lavf57.41.100 Stream #0:0: Video: h264, yuv420p, 1280x720, q=2-31, 20 fps, 25 tbr, 10240 tbn, 40 tbc Stream #0:1: Audio: aac (LC), 8000 Hz, mono, fltp, 48 kb/s Metadata: encoder : Lavc57.48.101 aac Stream mapping: Stream #0:0 -> #0:0 (copy) Stream #0:1 -> #0:1 (pcm_alaw (native) -> aac (native)) <br/> if that helps
– user331244
Aug 12 at 10:20



Output #0, segment, to 'video%d.mov': Metadata: title : streamed by the RTSP server encoder : Lavf57.41.100 Stream #0:0: Video: h264, yuv420p, 1280x720, q=2-31, 20 fps, 25 tbr, 10240 tbn, 40 tbc Stream #0:1: Audio: aac (LC), 8000 Hz, mono, fltp, 48 kb/s Metadata: encoder : Lavc57.48.101 aac Stream mapping: Stream #0:0 -> #0:0 (copy) Stream #0:1 -> #0:1 (pcm_alaw (native) -> aac (native))









By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

make 2 or more post in bootsrap

Store custom data using WC_Cart add_to_cart() method in Woocommerce 3

Firebase Auth - with Email and Password - Check user already registered