Hi, I’m record a stream from ip camera with H264 video encoding & PCMA audio encoding to m3u8 Ffmpeg version:3.2.4 OS:OSX Here is my command: ffmpeg -rtsp_transport tcp -i rtsp://192.168.0.40/1/h264major -vcodec copy -acodec aac -hls_init_time 2 -hls_time 60 -hls_list_size 0 -hls_flags +single_file+round_durations -hls_segment_filename test.ts -t 3600 test.m3u8 But in the m3u8 file,every segment entry’s duration is 2 seconds Which part did I do wrong? Thx in advance!
2017-04-14 10:46 GMT+02:00 ? ? <closezling@outlook.com>:
ffmpeg -rtsp_transport tcp -i rtsp://192.168.0.40/1/h264major -vcodec copy -acodec aac -hls_init_time 2 -hls_time 60 -hls_list_size 0 -hls_flags +single_file+round_durations -hls_segment_filename test.ts -t 3600 test.m3u8
Please test current FFmpeg git head and please provide the complete, uncut console output. Carl Eugen
Thx for reply. I use brew install the latest ffmpeg version 3.3 console log as below,rtsp stream without audio $ ffmpeg -rtsp_transport tcp -i rtsp://192.168.0.40/1/h264major -vcodec copy -acodec aac -hls_init_time 2 -hls_time 60 -hls_list_size 0 -hls_flags single_file+round_durations -hls_segment_filename test.ts -t 3600 test.m3u8 ffmpeg version 3.3 Copyright (c) 2000-2017 the FFmpeg developers built with Apple LLVM version 8.1.0 (clang-802.0.41) configuration: --prefix=/usr/local/Cellar/ffmpeg/3.3 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-libmp3lame --enable-libx264 --enable-libxvid --enable-opencl --disable-lzma --enable-vda libavutil 55. 58.100 / 55. 58.100 libavcodec 57. 89.100 / 57. 89.100 libavformat 57. 71.100 / 57. 71.100 libavdevice 57. 6.100 / 57. 6.100 libavfilter 6. 82.100 / 6. 82.100 libavresample 3. 5. 0 / 3. 5. 0 libswscale 4. 6.100 / 4. 6.100 libswresample 2. 7.100 / 2. 7.100 libpostproc 54. 5.100 / 54. 5.100 Input #0, rtsp, from 'rtsp://192.168.0.40/1/h264major': Metadata: title : 1/h264major comment : 1/h264major Duration: N/A, start: 0.238944, bitrate: N/A Stream #0:0: Video: h264 (Main), yuvj420p(pc, bt709, progressive), 1920x1080, 25 fps, 25 tbr, 90k tbn, 50 tbc Output #0, hls, to 'test.m3u8': Metadata: title : 1/h264major comment : 1/h264major encoder : Lavf57.71.100 Stream #0:0: Video: h264 (Main), yuvj420p(pc, bt709, progressive), 1920x1080, q=2-31, 25 fps, 25 tbr, 90k tbn, 25 tbc Stream mapping: Stream #0:0 -> #0:0 (copy) Press [q] to stop, [?] for help [hls @ 0x7f93e6800000] Non-monotonous DTS in output stream 0:0; previous: 0, current: -17706; changing to 1. This may result in incorrect timestamps in the output file. [hls @ 0x7f93e6800000] Non-monotonous DTS in output stream 0:0; previous: 1, current: -14322; changing to 2. This may result in incorrect timestamps in the output file. [hls @ 0x7f93e6800000] Non-monotonous DTS in output stream 0:0; previous: 2, current: -11675; changing to 3. This may result in incorrect timestamps in the output file. [hls @ 0x7f93e6800000] Non-monotonous DTS in output stream 0:0; previous: 3, current: -7183; changing to 4. This may result in incorrect timestamps in the output file. [hls @ 0x7f93e6800000] Non-monotonous DTS in output stream 0:0; previous: 4, current: -3596; changing to 5. This may result in incorrect timestamps in the output file. [hls @ 0x7f93e6800000] Non-monotonous DTS in output stream 0:0; previous: 5, current: 1; changing to 6. This may result in incorrect timestamps in the output file. [hls muxer @ 0x7f93e680e200] Duplicated segment filename detected: test.ts9x [hls muxer @ 0x7f93e680e200] Duplicated segment filename detected: test.ts3x [hls muxer @ 0x7f93e680e200] Duplicated segment filename detected: test.ts1x [hls muxer @ 0x7f93e680e200] Duplicated segment filename detected: test.ts8x [hls muxer @ 0x7f93e680e200] Duplicated segment filename detected: test.ts7x [hls muxer @ 0x7f93e680e200] Duplicated segment filename detected: test.ts6x [hls muxer @ 0x7f93e680e200] Duplicated segment filename detected: test.ts5x [hls muxer @ 0x7f93e680e200] Duplicated segment filename detected: test.ts5x [hls muxer @ 0x7f93e680e200] Duplicated segment filename detected: test.ts4x [hls muxer @ 0x7f93e680e200] Duplicated segment filename detected: test.ts4x [hls muxer @ 0x7f93e680e200] Duplicated segment filename detected: test.ts4x [hls muxer @ 0x7f93e680e200] Duplicated segment filename detected: test.ts3x [hls muxer @ 0x7f93e680e200] Duplicated segment filename detected: test.ts3x [hls muxer @ 0x7f93e680e200] Duplicated segment filename detected: test.ts3x [hls muxer @ 0x7f93e680e200] Duplicated segment filename detected: test.ts3x [hls muxer @ 0x7f93e680e200] Duplicated segment filename detected: test.ts3x [hls muxer @ 0x7f93e680e200] Duplicated segment filename detected: test.ts2x [hls muxer @ 0x7f93e680e200] Duplicated segment filename detected: test.ts2x [hls muxer @ 0x7f93e680e200] Duplicated segment filename detected: test.ts2x [hls muxer @ 0x7f93e680e200] Duplicated segment filename detected: test.ts2x [hls muxer @ 0x7f93e680e200] Duplicated segment filename detected: test.ts2x [hls muxer @ 0x7f93e680e200] Duplicated segment filename detected: test.ts2x test.m3u8 $ cat test.m3u8 #EXTM3U #EXT-X-VERSION:4 #EXT-X-TARGETDURATION:4 #EXT-X-MEDIA-SEQUENCE:0 #EXTINF:4, #EXT-X-BYTERANGE:812348@0 test.ts #EXTINF:2, #EXT-X-BYTERANGE:389912@812348 test.ts #EXTINF:2, #EXT-X-BYTERANGE:389724@1202260 test.ts #EXTINF:2, #EXT-X-BYTERANGE:392168@1591984 test.ts #EXTINF:2, #EXT-X-BYTERANGE:412472@1984152 test.ts #EXTINF:2, #EXT-X-BYTERANGE:395364@2396624 test.ts #EXTINF:2, #EXT-X-BYTERANGE:400816@2791988 test.ts #EXTINF:2, #EXT-X-BYTERANGE:397808@3192804 test.ts #EXTINF:2, #EXT-X-BYTERANGE:399312@3590612 test.ts #EXTINF:2, #EXT-X-BYTERANGE:393484@3989924 test.ts #EXTINF:2, #EXT-X-BYTERANGE:397432@4383408 test.ts #EXTINF:2, #EXT-X-BYTERANGE:397620@4780840 test.ts #EXTINF:2, #EXT-X-BYTERANGE:392544@5178460 test.ts #EXTINF:2, #EXT-X-BYTERANGE:393484@5571004 test.ts #EXTINF:2, #EXT-X-BYTERANGE:394048@5964488 test.ts #EXTINF:2, #EXT-X-BYTERANGE:389536@6358536 test.ts I did another test with rasp stream with video and audio console output: ffmpeg -rtsp_transport tcp -i "rtsp://admin:admin@192.168.0.103/cam/realmonitor?channel=1&subtype=0" -vcodec copy -acodec aac -hls_init_time 2 -hls_time 60 -hls_list_size 0 -hls_flags +single_file+round_durations -hls_segment_filename test.ts -t 3600 test.m3u8 ffmpeg version 3.3 Copyright (c) 2000-2017 the FFmpeg developers built with Apple LLVM version 8.1.0 (clang-802.0.41) configuration: --prefix=/usr/local/Cellar/ffmpeg/3.3 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-libmp3lame --enable-libx264 --enable-libxvid --enable-opencl --disable-lzma --enable-vda libavutil 55. 58.100 / 55. 58.100 libavcodec 57. 89.100 / 57. 89.100 libavformat 57. 71.100 / 57. 71.100 libavdevice 57. 6.100 / 57. 6.100 libavfilter 6. 82.100 / 6. 82.100 libavresample 3. 5. 0 / 3. 5. 0 libswscale 4. 6.100 / 4. 6.100 libswresample 2. 7.100 / 2. 7.100 libpostproc 54. 5.100 / 54. 5.100 Input #0, rtsp, from 'rtsp://admin:admin@192.168.0.103/cam/realmonitor?channel=1&subtype=0': Metadata: title : RTSP Session/2.0 Duration: N/A, start: 0.040000, bitrate: N/A Stream #0:0: Video: h264 (Main), yuv420p(progressive), 1280x720, 25.08 tbr, 90k tbn, 180k tbc Output #0, hls, to 'test.m3u8': Metadata: title : RTSP Session/2.0 encoder : Lavf57.71.100 Stream #0:0: Video: h264 (Main), yuv420p(progressive), 1280x720, q=2-31, 25.08 tbr, 90k tbn, 90k tbc Stream mapping: Stream #0:0 -> #0:0 (copy) Press [q] to stop, [?] for help [hls @ 0x7fa2f1800000] Timestamps are unset in a packet for stream 0. This is deprecated and will stop working in the future. Fix your code to set the timestamps properly [hls @ 0x7fa2f1800000] Non-monotonous DTS in output stream 0:0; previous: 0, current: 0; changing to 1. This may result in incorrect timestamps in the output file. [hls @ 0x7fa2f1800000] pkt->duration = 0, maybe the hls segment duration will not precise Last message repeated 41 times [hls @ 0x7fa2f1800000] pkt->duration = 0, maybe the hls segment duration will not precise Last message repeated 12 times [hls @ 0x7fa2f1800000] pkt->duration = 0, maybe the hls segment duration will not precise Last message repeated 12 times [hls @ 0x7fa2f1800000] pkt->duration = 0, maybe the hls segment duration will not precise Last message repeated 12 times [hls @ 0x7fa2f1800000] pkt->duration = 0, maybe the hls segment duration will not precise Last message repeated 12 times [hls @ 0x7fa2f1800000] pkt->duration = 0, maybe the hls segment duration will not precise Last message repeated 13 times [hls @ 0x7fa2f1800000] pkt->duration = 0, maybe the hls segment duration will not precise Last message repeated 12 times [hls @ 0x7fa2f1800000] pkt->duration = 0, maybe the hls segment duration will not precise Last message repeated 12 times [hls @ 0x7fa2f1800000] pkt->duration = 0, maybe the hls segment duration will not precise Last message repeated 13 times [hls @ 0x7fa2f1800000] pkt->duration = 0, maybe the hls segment duration will not precise Last message repeated 1 times [hls muxer @ 0x7fa2f1805200] Duplicated segment filename detected: test.ts [hls @ 0x7fa2f1800000] pkt->duration = 0, maybe the hls segment duration will not precise Last message repeated 10 times [hls @ 0x7fa2f1800000] pkt->duration = 0, maybe the hls segment duration will not precise Last message repeated 11 times [hls @ 0x7fa2f1800000] pkt->duration = 0, maybe the hls segment duration will not precise Last message repeated 13 times [hls @ 0x7fa2f1800000] pkt->duration = 0, maybe the hls segment duration will not precise Last message repeated 12 times [hls muxer @ 0x7fa2f1805200] Duplicated segment filename detected: test.ts [hls @ 0x7fa2f1800000] pkt->duration = 0, maybe the hls segment duration will not precise Last message repeated 14 times [hls @ 0x7fa2f1800000] pkt->duration = 0, maybe the hls segment duration will not precise Last message repeated 13 times [hls @ 0x7fa2f1800000] pkt->duration = 0, maybe the hls segment duration will not precise Last message repeated 12 times [hls @ 0x7fa2f1800000] pkt->duration = 0, maybe the hls segment duration will not precise Last message repeated 7 times [hls muxer @ 0x7fa2f1805200] Duplicated segment filename detected: test.ts [hls @ 0x7fa2f1800000] pkt->duration = 0, maybe the hls segment duration will not precise Last message repeated 4 times [hls @ 0x7fa2f1800000] pkt->duration = 0, maybe the hls segment duration will not precise Last message repeated 12 times [hls @ 0x7fa2f1800000] pkt->duration = 0, maybe the hls segment duration will not precise Last message repeated 13 times [hls @ 0x7fa2f1800000] pkt->duration = 0, maybe the hls segment duration will not precise Last message repeated 12 times [hls @ 0x7fa2f1800000] pkt->duration = 0, maybe the hls segment duration will not precise Last message repeated 4 times test.m3u8: $ cat test.m3u8 #EXTM3U #EXT-X-VERSION:4 #EXT-X-TARGETDURATION:4 #EXT-X-MEDIA-SEQUENCE:0 #EXTINF:4, #EXT-X-BYTERANGE:1009936@0 test.ts #EXTINF:2, #EXT-X-BYTERANGE:562120@1009936 test.ts #EXTINF:2, #EXT-X-BYTERANGE:539372@1572056 test.ts #EXTINF:2, #EXT-X-BYTERANGE:526212@2111428 test.ts #EXTINF:2, #EXT-X-BYTERANGE:531100@2637640 test.ts #EXTINF:2, #EXT-X-BYTERANGE:531664@3168740 test.ts #EXTINF:1, #EXT-X-BYTERANGE:397244@3700404 test.ts #EXT-X-ENDLIST btw, in version 3.2.4 there is no log like Duplicated segment filename detected: test.ts2x [hls @ 0x7fa2f1800000] pkt->duration = 0, maybe the hls segment duration will not precise Last message repeated 41 times when i use single_file flag
On 14 Apr 2017, at 6:11 PM, Carl Eugen Hoyos <ceffmpeg@gmail.com> wrote:
2017-04-14 10:46 GMT+02:00 ? ? <closezling@outlook.com>:
ffmpeg -rtsp_transport tcp -i rtsp://192.168.0.40/1/h264major -vcodec copy -acodec aac -hls_init_time 2 -hls_time 60 -hls_list_size 0 -hls_flags +single_file+round_durations -hls_segment_filename test.ts -t 3600 test.m3u8
Please test current FFmpeg git head and please provide the complete, uncut console output.
Carl Eugen _______________________________________________ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-user
To unsubscribe, visit link above, or email ffmpeg-user-request@ffmpeg.org with subject "unsubscribe".
? ? wrote
[hls @ 0x7fa2f1800000] pkt->duration = 0, maybe the hls segment duration will not precise
I had the same warnings when creating HLS with ffmpeg. The proble was that RTSP stream did not provide framerate information. Specifing framerate before "-i ..." will fix it. *-r 25* (-framerate 25) ffmpeg -r 25 -i rtsp://localhost:554/11 -vcodec copy -acodec aac -hls_time 5 -hls_list_size 5 -hls_flags delete_segments /tmp/hls/stream.m3u8 -- Sent from: http://www.ffmpeg-archive.org/
2017-04-14 16:46 GMT+08:00 ? ? <closezling@outlook.com>:
Hi,
I’m record a stream from ip camera with H264 video encoding & PCMA audio encoding to m3u8 Ffmpeg version:3.2.4 OS:OSX
Here is my command:
ffmpeg -rtsp_transport tcp -i rtsp://192.168.0.40/1/h264major -vcodec copy -acodec aac -hls_init_time 2 -hls_time 60 -hls_list_size 0 -hls_flags +single_file+round_durations -hls_segment_filename test.ts -t 3600 test.m3u8
But in the m3u8 file,every segment entry’s duration is 2 seconds
Which part did I do wrong?
you should not use both -hls_init_time 2 and -hls_list_size 0, -hls_init_time 2 is enabled on first hls m3u8 window(before sequence(# EXT-X-MEDIA-SEQUENCE) value change.)
Thx in advance! _______________________________________________ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-user
To unsubscribe, visit link above, or email ffmpeg-user-request@ffmpeg.org with subject "unsubscribe".
hmmm, i checked ffmpeg document again hls_init_time seconds Set the initial target segment length in seconds. Default value is 0. Segment will be cut on the next key frame after this time has passed on the first m3u8 list. After the initial playlist is filled ffmpeg will cut segments at duration equal to hls_time i think i find the problem, maybe hls_init_time is not what i want as you know, in order to open his video as fast as possible i need the first segment to be a small size so, i just need the first segment to be 2 seconds or 5 seconds and every segment after it can be 60 seconds (larger than the first one as the video play has always begun) does ffmpeg has some options like this? On 26 Apr 2017, at 7:53 AM, Steven Liu <lingjiujianke@gmail.com<mailto:lingjiujianke@gmail.com>> wrote: 2017-04-14 16:46 GMT+08:00 ? ? <closezling@outlook.com<mailto:closezling@outlook.com>>: Hi, I’m record a stream from ip camera with H264 video encoding & PCMA audio encoding to m3u8 Ffmpeg version:3.2.4 OS:OSX Here is my command: ffmpeg -rtsp_transport tcp -i rtsp://192.168.0.40/1/h264major -vcodec copy -acodec aac -hls_init_time 2 -hls_time 60 -hls_list_size 0 -hls_flags +single_file+round_durations -hls_segment_filename test.ts -t 3600 test.m3u8 But in the m3u8 file,every segment entry’s duration is 2 seconds Which part did I do wrong? you should not use both -hls_init_time 2 and -hls_list_size 0, -hls_init_time 2 is enabled on first hls m3u8 window(before sequence(# EXT-X-MEDIA-SEQUENCE) value change.) Thx in advance! _______________________________________________ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org<mailto:ffmpeg-user@ffmpeg.org> http://ffmpeg.org/mailman/listinfo/ffmpeg-user To unsubscribe, visit link above, or email ffmpeg-user-request@ffmpeg.org with subject "unsubscribe". _______________________________________________ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org<mailto:ffmpeg-user@ffmpeg.org> http://ffmpeg.org/mailman/listinfo/ffmpeg-user To unsubscribe, visit link above, or email ffmpeg-user-request@ffmpeg.org with subject "unsubscribe".
2017-04-27 15:05 GMT+08:00 白 桦 <closezling@outlook.com>:
hmmm, i checked ffmpeg document again
hls_init_time seconds
Set the initial target segment length in seconds. Default value is 0. Segment will be cut on the next key frame after this time has passed on the first m3u8 list. After the initial playlist is filled ffmpeg will cut segments at duration equal to hls_time
i think i find the problem, maybe hls_init_time is not what i want
as you know, in order to open his video as fast as possible i need the first segment to be a small size
so, i just need the first segment to be 2 seconds or 5 seconds and every segment after it can be 60 seconds (larger than the first one as the video play has always begun)
does ffmpeg has some options like this?
Not yet now, maybe you can try -f segment, maybe it can do that.
On 26 Apr 2017, at 7:53 AM, Steven Liu <lingjiujianke@gmail.com<mailto: lingjiujianke@gmail.com>> wrote:
2017-04-14 16:46 GMT+08:00 ? ? <closezling@outlook.com<mailto: closezling@outlook.com>>:
Hi,
I’m record a stream from ip camera with H264 video encoding & PCMA audio encoding to m3u8 Ffmpeg version:3.2.4 OS:OSX
Here is my command:
ffmpeg -rtsp_transport tcp -i rtsp://192.168.0.40/1/h264major -vcodec copy -acodec aac -hls_init_time 2 -hls_time 60 -hls_list_size 0 -hls_flags +single_file+round_durations -hls_segment_filename test.ts -t 3600 test.m3u8
But in the m3u8 file,every segment entry’s duration is 2 seconds
Which part did I do wrong?
you should not use both -hls_init_time 2 and -hls_list_size 0, -hls_init_time 2 is enabled on first hls m3u8 window(before sequence(# EXT-X-MEDIA-SEQUENCE) value change.)
Thx in advance! _______________________________________________ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org<mailto:ffmpeg-user@ffmpeg.org> http://ffmpeg.org/mailman/listinfo/ffmpeg-user
To unsubscribe, visit link above, or email ffmpeg-user-request@ffmpeg.org with subject "unsubscribe". _______________________________________________ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org<mailto:ffmpeg-user@ffmpeg.org> http://ffmpeg.org/mailman/listinfo/ffmpeg-user
To unsubscribe, visit link above, or email ffmpeg-user-request@ffmpeg.org with subject "unsubscribe".
_______________________________________________ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-user
To unsubscribe, visit link above, or email ffmpeg-user-request@ffmpeg.org with subject "unsubscribe".
participants (5)
-
? ? -
Carl Eugen Hoyos -
Steven Liu -
WebGlazok.com -
白 桦