[FFmpeg-user] Retry network for a live stream

basteon basteon at gmail.com
Sat Jun 29 14:41:39 CEST 2013


hi,
Do you use wowza on another size?
Well, tecticaly for make infinity output and not hangap you should use
-loop_output 0, but socket wasn't closed and ffmpeg still streaming with
skiping packets. Perhaps, that trouble with right pts, that loose
consecuence. After reconnect by hand that works again?


On 29 June 2013 06:46, Andrew Sinclair <ajsinclair at gmail.com> wrote:

> On 29 June 2013 13:25, Andrew Sinclair <ajsinclair at gmail.com> wrote:
>
> > Does anyone know if there is any inbuilt mechanism to get ffmpeg to retry
> > the connection to a server in the case the connection may be dropped for
> a
> > live stream?
> >
> > I am finding that ffmpeg is still running but the stream has stopped.
> >
>
> Here is some more info on where I am seeing things freeze.
>
> ./ffmpeg -loglevel debug -re -f v4l2 -r 25 -s 640x480 -i /dev/video0 -b:v
> 300k -c:v libx264 -g 15 -pix_fmt yuv420p -an -f flv
> rtmp://localhost/live/myStream
> ffmpeg version git-2013-06-29-53fd1ab Copyright (c) 2000-2013 the FFmpeg
> developers
>   built on Jun 29 2013 15:45:11 with gcc 4.6 (Ubuntu/Linaro 4.6.3-1ubuntu5)
>   configuration: --prefix=/root/ffmpeg_build
> --extra-cflags=-I/root/ffmpeg_build/include
> --extra-ldflags=-L/root/ffmpeg_build/lib --bindir=/root/bin
> --extra-libs=-ldl --enable-gpl --enable-libass --enable-libfdk-aac
> --enable-libmp3lame --enable-nonfree --enable-libx264
>   libavutil      52. 37.101 / 52. 37.101
>   libavcodec     55. 17.100 / 55. 17.100
>   libavformat    55. 10.100 / 55. 10.100
>   libavdevice    55.  2.100 / 55.  2.100
>   libavfilter     3. 77.101 /  3. 77.101
>   libswscale      2.  3.100 /  2.  3.100
>   libswresample   0. 17.102 /  0. 17.102
>   libpostproc    52.  3.100 / 52.  3.100
> Splitting the commandline.
> Reading option '-loglevel' ... matched as option 'loglevel' (set logging
> level) with argument 'debug'.
> Reading option '-re' ... matched as option 're' (read input at native frame
> rate) with argument '1'.
> Reading option '-f' ... matched as option 'f' (force format) with argument
> 'v4l2'.
> Reading option '-r' ... matched as option 'r' (set frame rate (Hz value,
> fraction or abbreviation)) with argument '25'.
> Reading option '-s' ... matched as option 's' (set frame size (WxH or
> abbreviation)) with argument '640x480'.
> Reading option '-i' ... matched as input file with argument '/dev/video0'.
> Reading option '-b:v' ... matched as option 'b' (video bitrate (please use
> -b:v)) with argument '300k'.
> Reading option '-c:v' ... matched as option 'c' (codec name) with argument
> 'libx264'.
> Reading option '-g' ... matched as AVOption 'g' with argument '15'.
> Reading option '-pix_fmt' ... matched as option 'pix_fmt' (set pixel
> format) with argument 'yuv420p'.
> Reading option '-an' ... matched as option 'an' (disable audio) with
> argument '1'.
> Reading option '-f' ... matched as option 'f' (force format) with argument
> 'flv'.
> Reading option 'rtmp://localhost/live/myStream' ... matched as output file.
> Finished splitting the commandline.
> Parsing a group of options: global .
> Applying option loglevel (set logging level) with argument debug.
> Successfully parsed a group of options.
> Parsing a group of options: input file /dev/video0.
> Applying option re (read input at native frame rate) with argument 1.
> Applying option f (force format) with argument v4l2.
> Applying option r (set frame rate (Hz value, fraction or abbreviation))
> with argument 25.
> Applying option s (set frame size (WxH or abbreviation)) with argument
> 640x480.
> Successfully parsed a group of options.
> Opening an input file: /dev/video0.
> [video4linux2,v4l2 @ 0x29e1c00] fd:3 capabilities:84000001
> [video4linux2,v4l2 @ 0x29e1c00] Current input_channel: 0, input_name:
> Camera 1
> [video4linux2,v4l2 @ 0x29e1c00] The V4L2 driver changed the pixel format
> from 0x32315559 to 0x56595559
> [video4linux2,v4l2 @ 0x29e1c00] Trying to set codec:rawvideo
> pix_fmt:yuv420p
> [video4linux2,v4l2 @ 0x29e1c00] The V4L2 driver changed the pixel format
> from 0x32315559 to 0x56595559
> [video4linux2,v4l2 @ 0x29e1c00] Trying to set codec:rawvideo
> pix_fmt:yuv420p
> [video4linux2,v4l2 @ 0x29e1c00] The V4L2 driver changed the pixel format
> from 0x32315659 to 0x56595559
> [video4linux2,v4l2 @ 0x29e1c00] Trying to set codec:rawvideo
> pix_fmt:yuv422p
> [video4linux2,v4l2 @ 0x29e1c00] The V4L2 driver changed the pixel format
> from 0x50323234 to 0x56595559
> [video4linux2,v4l2 @ 0x29e1c00] Trying to set codec:rawvideo
> pix_fmt:yuyv422
> [video4linux2,v4l2 @ 0x29e1c00] Setting time per frame to 1/25
> [video4linux2,v4l2 @ 0x29e1c00] The driver changed the time per frame from
> 1/25 to 1/24
> [video4linux2,v4l2 @ 0x29e1c00] All info found
> Input #0, video4linux2,v4l2, from '/dev/video0':
>   Duration: N/A, start: 3110.592899, bitrate: 117964 kb/s
>     Stream #0:0, 1, 1/1000000: Video: rawvideo (YUY2 / 0x32595559),
> yuyv422, 640x480, 1/1000000, 117964 kb/s, 24 fps, 24 tbr, 1000k tbn, 1000k
> tbc
> Successfully opened the file.
> Parsing a group of options: output file rtmp://localhost/live/myStream.
> Applying option b:v (video bitrate (please use -b:v)) with argument 300k.
> Applying option c:v (codec name) with argument libx264.
> Applying option pix_fmt (set pixel format) with argument yuv420p.
> Applying option an (disable audio) with argument 1.
> Applying option f (force format) with argument flv.
> Successfully parsed a group of options.
> Opening an output file: rtmp://localhost/live/myStream.
> [rtmp @ 0x29e7480] Handshaking...
> [rtmp @ 0x29e7480] Type answer 3
> [rtmp @ 0x29e7480] Server version 3.0.1.1
> [rtmp @ 0x29e7480] Proto = rtmp, path = /live/myStream, app = live, fname =
> myStream
> [rtmp @ 0x29e7480] Server bandwidth = 2500000
> [rtmp @ 0x29e7480] Client bandwidth = 2500000
> [rtmp @ 0x29e7480] New incoming chunk size = 4096
> [rtmp @ 0x29e7480] Releasing stream...
> [rtmp @ 0x29e7480] FCPublish stream...
> [rtmp @ 0x29e7480] Creating stream...
> [rtmp @ 0x29e7480] Sending publish command for 'myStream'
> Successfully opened the file.
> detected 2 logical cores
> [graph 0 input from stream 0:0 @ 0x29cb4a0] Setting 'video_size' to value
> '640x480'
> [graph 0 input from stream 0:0 @ 0x29cb4a0] Setting 'pix_fmt' to value '1'
> [graph 0 input from stream 0:0 @ 0x29cb4a0] Setting 'time_base' to value
> '1/25'
> [graph 0 input from stream 0:0 @ 0x29cb4a0] Setting 'pixel_aspect' to value
> '0/1'
> [graph 0 input from stream 0:0 @ 0x29cb4a0] Setting 'sws_param' to value
> 'flags=2'
> [graph 0 input from stream 0:0 @ 0x29cb4a0] Setting 'frame_rate' to value
> '25/1'
> [graph 0 input from stream 0:0 @ 0x29cb4a0] w:640 h:480 pixfmt:yuyv422
> tb:1/25 fr:25/1 sar:0/1 sws_param:flags=2
> [force CFR for input from stream 0:0 @ 0x29cd820] Setting 'expr' to value
> 'N'
> [format @ 0x29cdd20] compat: called with args=[yuv420p]
> [format @ 0x29cdd20] Setting 'pix_fmts' to value 'yuv420p'
> [auto-inserted scaler 0 @ 0x29cd6a0] Setting 'flags' to value '0x4'
> [auto-inserted scaler 0 @ 0x29cd6a0] w:iw h:ih flags:'0x4' interl:0
> [format @ 0x29cdd20] auto-inserting filter 'auto-inserted scaler 0' between
> the filter 'Parsed_null_0' and the filter 'format'
> [AVFilterGraph @ 0x29d2760] query_formats: 5 queried, 4 merged, 1 already
> done, 0 delayed
> [graph 0 input from stream 0:0 @ 0x29cb4a0] TB:0.040000
> FRAME_RATE:25.000000 SAMPLE_RATE:nan
> [auto-inserted scaler 0 @ 0x29cd6a0] w:640 h:480 fmt:yuyv422 sar:0/1 ->
> w:640 h:480 fmt:yuv420p sar:0/1 flags:0x4
> [libx264 @ 0x29e4660] using mv_range_thread = 72
> [libx264 @ 0x29e4660] using cpu capabilities: MMX2 SSE2Fast SSSE3 Cache64
> SlowShuffle
> [libx264 @ 0x29e4660] profile High, level 3.0
> [libx264 @ 0x29e4660] 264 - core 133 r2 a3ac64b - H.264/MPEG-4 AVC codec -
> Copyleft 2003-2013 - http://www.videolan.org/x264.html - options: cabac=1
> ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00
> mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11
> fast_pskip=1 chroma_qp_offset=-2 threads=3 lookahead_threads=1
> sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0
> constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1
> weightb=1 open_gop=0 weightp=2 keyint=15 keyint_min=1 scenecut=40
> intra_refresh=0 rc_lookahead=15 rc=abr mbtree=1 bitrate=300 ratetol=1.0
> qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
> Output #0, flv, to 'rtmp://localhost/live/myStream':
>   Metadata:
>     encoder         : Lavf55.10.100
>     Stream #0:0, 0, 1/1000: Video: h264 (libx264) ([7][0][0][0] / 0x0007),
> yuv420p, 640x480, 1/25, q=-1--1, 300 kb/s, 1k tbn, 25 tbc
> Stream mapping:
>   Stream #0:0 -> #0:0 (rawvideo -> libx264)
> Press [q] to stop, [?] for help
>
> Debug log when it freezes
>
> [libx264 @ 0x2cfb660] frame=32434 QP=42.00 NAL=0 Slice:B Poc:6   I:0    P:5
>    SKIP:1195 size=24 bytes
> [force CFR for input from stream 0:0 @ 0x2ce4820] N:32457 PTS:1811107902
> T:72444316.080000 POS:nan INTERLACED:0 -> PTS:32457 T:1298.280000
> [libx264 @ 0x2cfb660] frame=32435 QP=38.00 NAL=2 Slice:P Poc:16  I:0
>  P:28   SKIP:1172 size=69 bytes
> N:32458 PTS:1810768383 T:72430735.320000 POS:nan INTERLACED:0 -> PTS:32458
> T:1298.320000
> [libx264 @ 0x2cfb660] frame=32436 QP=40.00 NAL=2 Slice:B Poc:12  I:0    P:8
>    SKIP:1192 size=30 bytes
> [force CFR for input from stream 0:0 @ 0x2ce4820] N:32459 PTS:1810851735
> T:72434069.400000 POS:nan INTERLACED:0 -> PTS:32459 T:1298.360000
> [libx264 @ 0x2cfb660] frame=32437 QP=42.00 NAL=0 Slice:B Poc:10  I:0    P:5
>    SKIP:1195 size=23 bytes
> [force CFR for input from stream 0:0 @ 0x2ce4820] N:32460 PTS:1810893410
> T:72435736.400000 POS:nan INTERLACED:0 -> PTS:32460 T:1298.400000
> [libx264 @ 0x2cfb660] frame=32438 QP=42.00 NAL=0 Slice:B Poc:14  I:0    P:1
>    SKIP:1199 size=20 bytes
> [force CFR for input from stream 0:0 @ 0x2ce4820] N:32461 PTS:1811186985
> T:72447479.400000 POS:nan INTERLACED:0 -> PTS:32461 T:1298.440000
> [libx264 @ 0x2cfb660] frame=32439 QP=39.00 NAL=2 Slice:P Poc:24  I:0    P:6
>    SKIP:1194 size=36 bytes
> [force CFR for input from stream 0:0 @ 0x2ce4820] N:32462 PTS:1811355305
> T:72454212.200000 POS:nan INTERLACED:0 -> PTS:32462 T:1298.480000
> [libx264 @ 0x2cfb660] frame=32440 QP=41.00 NAL=2 Slice:B Poc:20  I:0    P:3
>    SKIP:1197 size=24 bytes
> [force CFR for input from stream 0:0 @ 0x2ce4820] N:32463 PTS:1811399399
> T:72455975.960000 POS:nan INTERLACED:0 -> PTS:32463 T:1298.520000
> [libx264 @ 0x2cfb660] frame=32441 QP=42.00 NAL=0 Slice:B Poc:18  I:0    P:2
>    SKIP:1198 size=20 bytes
> [force CFR for input from stream 0:0 @ 0x2ce4820] N:32464 PTS:1811522228
> T:72460889.120000 POS:nan INTERLACED:0 -> PTS:32464 T:1298.560000
> [libx264 @ 0x2cfb660] frame=32442 QP=42.00 NAL=0 Slice:B Poc:22  I:0    P:1
>    SKIP:1199 size=20 bytes
> N:32465 PTS:1811564322 T:72462572.880000 POS:nan INTERLACED:0 -> PTS:32465
> T:1298.600000
> [libx264 @ 0x2cfb660] frame=32443 QP=40.00 NAL=2 Slice:P Poc:28  I:0    P:0
>    SKIP:1200 size=26 bytes
> [force CFR for input from stream 0:0 @ 0x2ce4820] N:32466 PTS:1811688324
> T:72467532.960000 POS:nan INTERLACED:0 -> PTS:32466 T:1298.640000
> [libx264 @ 0x2cfb660] frame=32444 QP=42.00 NAL=0 Slice:B Poc:26  I:0    P:2
>    SKIP:1198 size=21 bytes
> [force CFR for input from stream 0:0 @ 0x2ce4820] N:32467 PTS:1825268493
> T:73010739.720000 POS:nan INTERLACED:0 -> PTS:32467 T:1298.680000
> [libx264 @ 0x2cfb660] frame=32445 QP=36.61 NAL=3 Slice:I Poc:0   I:1200 P:0
>    SKIP:0    size=20933 bytes
> frame=32468 fps= 18 q=44.0 size=   49134kB time=00:21:37.76 bitrate=
> 310.2kbits/s
> _______________________________________________
> ffmpeg-user mailing list
> ffmpeg-user at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-user
>


More information about the ffmpeg-user mailing list