Home/News | About | Download | Documentation | Forum | Bug Reports | Contact | Donations | Consulting | Projects | Legal | Security | FATE


This forum has not been maintained for a long time and will probably get deleted in the near future.
For faster responses to your questions, please use StackOverflow instead and tag your questions with "FFmpeg".
If you need a backup of the posts from this forum, please contact me directly.

FFmpeg Tee muxer fail if network disconnected

Discussions about problems encountered using ffmpeg.
Forum rules
FFmpeg is in a state of perpetual development and we do not currently have the person power to backport fixes to official releases. As such, if you wish to query or report a bug, you must try with the latest development branch revision of FFmpeg to confirm the issue still exists. The latest FFmpeg can be downloaded from here: http://www.ffmpeg.org/download.html

FFmpeg Tee muxer fail if network disconnected

Postby w.wijnia » Tue May 30, 2017 8:51 am

Hello,

I need to record and stream an input (live signal) at the same time, if the stream destination fails the local recording always needs to continu recording. For this I use the tee muxer with ignore on fail option which works if the destination is not reachable but fails if on the source computer (where ffmpeg runs) the network is disconnected.

I scouted the ffmpeg documentation and they hinted at combining tee with the fifo mixer but I failed to get a working cmdline with that.

What is the best way to be sure that always the local recording will be made ignoring all network conditions ?

Code: Select all
ffmpeg.exe -report -y -r 25 -i %PIPE% -c:v libx264 -vf scale=640:360 -aspect 16:9 -c:a aac -b:a 128k -ac 2 -f tee -map 0:v -map 0:a  "[f=mpegts:onfail=ignore]udp://10.0.0.105:5001|[f=mp4:onfail=ignore]d:/recordings/capture.mp4"


Code: Select all
ffmpeg started on 2017-05-30 at 09:59:55
Report written to "ffmpeg-20170530-095955.log"
Command line:
ffmpeg.exe -report -y -r 25 -i "d:\\test\\1.mp4" -c:v libx264 -vf "scale=640:360" -aspect 16:9 -c:a aac -b:a 128k -ac 2 -f tee -map 0:v -map 0:a "[f=mpegts:onfail=ignore]udp://10.0.0.105:5001|[f=mp4:onfail=ignore]d:/recordings/capture.mp4"
ffmpeg version N-86310-g220b24c Copyright (c) 2000-2017 the FFmpeg developers
  built with gcc 7.1.0 (GCC)
  configuration: --enable-gpl --enable-version3 --enable-cuda --enable-cuvid --enable-d3d11va --enable-dxva2 --enable-libmfx --enable-nvenc --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzimg --enable-lzma --enable-zlib
  libavutil      55. 63.100 / 55. 63.100
  libavcodec     57. 96.101 / 57. 96.101
  libavformat    57. 72.101 / 57. 72.101
  libavdevice    57.  7.100 / 57.  7.100
  libavfilter     6. 90.100 /  6. 90.100
  libswscale      4.  7.101 /  4.  7.101
  libswresample   2.  8.100 /  2.  8.100
  libpostproc    54.  6.100 / 54.  6.100
Splitting the commandline.
Reading option '-report' ... matched as option 'report' (generate a report) with argument '1'.
Reading option '-y' ... matched as option 'y' (overwrite output files) with argument '1'.
Reading option '-r' ... matched as option 'r' (set frame rate (Hz value, fraction or abbreviation)) with argument '25'.
Reading option '-i' ... matched as input url with argument 'd:\test\1.mp4'.
Reading option '-c:v' ... matched as option 'c' (codec name) with argument 'libx264'.
Reading option '-vf' ... matched as option 'vf' (set video filters) with argument 'scale=640:360'.
Reading option '-aspect' ... matched as option 'aspect' (set aspect ratio (4:3, 16:9 or 1.3333, 1.7777)) with argument '16:9'.
Reading option '-c:a' ... matched as option 'c' (codec name) with argument 'aac'.
Reading option '-b:a' ... matched as option 'b' (video bitrate (please use -b:v)) with argument '128k'.
Reading option '-ac' ... matched as option 'ac' (set number of audio channels) with argument '2'.
Reading option '-f' ... matched as option 'f' (force format) with argument 'tee'.
Reading option '-map' ... matched as option 'map' (set input stream mapping) with argument '0:v'.
Reading option '-map' ... matched as option 'map' (set input stream mapping) with argument '0:a'.
Reading option '[f=mpegts:onfail=ignore]udp://10.0.0.105:5001|[f=mp4:onfail=ignore]d:/recordings/capture.mp4' ... matched as output url.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option report (generate a report) with argument 1.
Applying option y (overwrite output files) with argument 1.
Successfully parsed a group of options.
Parsing a group of options: input url d:\test\1.mp4.
Applying option r (set frame rate (Hz value, fraction or abbreviation)) with argument 25.
Successfully parsed a group of options.
Opening an input file: d:\test\1.mp4.
[file @ 0000000000319e80] Setting default whitelist 'file,crypto'
[mov,mp4,m4a,3gp,3g2,mj2 @ 0000000000318880] Format mov,mp4,m4a,3gp,3g2,mj2 probed with size=2048 and score=100
[mov,mp4,m4a,3gp,3g2,mj2 @ 0000000000318880] ISO: File Type Major Brand: isom
[mov,mp4,m4a,3gp,3g2,mj2 @ 0000000000318880] Unknown dref type 0x206c7275 size 12
[mov,mp4,m4a,3gp,3g2,mj2 @ 0000000000318880] Processing st: 0, edit list 0 - media time: 0, duration: 3833344
[mov,mp4,m4a,3gp,3g2,mj2 @ 0000000000318880] Unknown dref type 0x206c7275 size 12
[mov,mp4,m4a,3gp,3g2,mj2 @ 0000000000318880] Processing st: 1, edit list 0 - media time: 1024, duration: 14375904
[mov,mp4,m4a,3gp,3g2,mj2 @ 0000000000318880] drop a frame at curr_cts: 0 @ 0
[mov,mp4,m4a,3gp,3g2,mj2 @ 0000000000318880] Before avformat_find_stream_info() pos: 109901967 bytes read:205583 seeks:1 nb_streams:2
[h264 @ 000000000047bd40] nal_unit_type: 7, nal_ref_idc: 3
[h264 @ 000000000047bd40] nal_unit_type: 8, nal_ref_idc: 3
[mov,mp4,m4a,3gp,3g2,mj2 @ 0000000000318880] demuxer injecting skip 1024 / discard 0
[aac @ 00000000026c3b00] skip 1024 / discard 0 samples due to side data
[h264 @ 000000000047bd40] nal_unit_type: 6, nal_ref_idc: 0
[h264 @ 000000000047bd40] nal_unit_type: 6, nal_ref_idc: 0
[h264 @ 000000000047bd40] nal_unit_type: 6, nal_ref_idc: 0
[h264 @ 000000000047bd40] nal_unit_type: 5, nal_ref_idc: 3
[h264 @ 000000000047bd40] user data:"x264 - core 148 r2665 a01e339 - H.264/MPEG-4 AVC codec - Copyleft 2003-2016 -  options: cabac=1 ref=1 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=0 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=12 lookahead_threads=2 sliced_threads=0 nr=0 decimate=1 interlaced=tff bluray_compat=0 constrained_intra=0 bframes=0 weightp=0 keyint=1 keyint_min=1 scenecut=40 intra_refresh=0 rc_lookahead=2 rc=crf mbtree=0 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 vbv_maxrate=50000 vbv_bufsize=5000 crf_max=0.0 nal_hrd=vbr filler=0 ip_ratio=1.40 aq=1:1.00"
[h264 @ 000000000047bd40] ct_type:0 pic_struct:3
[h264 @ 000000000047bd40] Reinit context to 1280x736, pix_fmt: yuv420p
[mov,mp4,m4a,3gp,3g2,mj2 @ 0000000000318880] All info found
[mov,mp4,m4a,3gp,3g2,mj2 @ 0000000000318880] After avformat_find_stream_info() pos: 30468 bytes read:238351 seeks:2 frames:2
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'd:\test\1.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf57.26.100
  Duration: 00:04:59.52, start: 0.000000, bitrate: 2935 kb/s
    Stream #0:0(dut), 1, 1/12800: Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1280x720 [SAR 10:13 DAR 160:117], 2916 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(dut), 1, 1/48000: Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 15 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
Successfully opened the file.
Parsing a group of options: output url [f=mpegts:onfail=ignore]udp://10.0.0.105:5001|[f=mp4:onfail=ignore]d:/recordings/capture.mp4.
Applying option c:v (codec name) with argument libx264.
Applying option vf (set video filters) with argument scale=640:360.
Applying option aspect (set aspect ratio (4:3, 16:9 or 1.3333, 1.7777)) with argument 16:9.
Applying option c:a (codec name) with argument aac.
Applying option b:a (video bitrate (please use -b:v)) with argument 128k.
Applying option ac (set number of audio channels) with argument 2.
Applying option f (force format) with argument tee.
Applying option map (set input stream mapping) with argument 0:v.
Applying option map (set input stream mapping) with argument 0:a.
Successfully parsed a group of options.
Opening an output file: [f=mpegts:onfail=ignore]udp://10.0.0.105:5001|[f=mp4:onfail=ignore]d:/recordings/capture.mp4.
Successfully opened the file.
detected 4 logical cores
[h264 @ 000000000046a760] nal_unit_type: 7, nal_ref_idc: 3
[h264 @ 000000000046a760] nal_unit_type: 8, nal_ref_idc: 3
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
  Stream #0:1 -> #0:1 (aac (native) -> aac (native))
Press [q] to stop, [?] for help
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
[aac @ 000000000276b640] skip 1024 / discard 0 samples due to side data
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
[h264 @ 000000000046a760] nal_unit_type: 6, nal_ref_idc: 0
[h264 @ 000000000046a760] nal_unit_type: 6, nal_ref_idc: 0
[graph_1_in_0_1 @ 000000000283b6c0] Setting 'time_base' to value '1/48000'
[h264 @ 000000000046a760] nal_unit_type: 6, nal_ref_idc: 0
[graph_1_in_0_1 @ 000000000283b6c0] Setting 'sample_rate' to value '48000'
[graph_1_in_0_1 @ 000000000283b6c0] Setting 'sample_fmt' to value 'fltp'
[graph_1_in_0_1 @ 000000000283b6c0] Setting 'channel_layout' to value '0x3'
[graph_1_in_0_1 @ 000000000283b6c0] tb:1/48000 samplefmt:fltp samplerate:48000 chlayout:0x3
[format_out_0_1 @ 000000000283b520] Setting 'sample_fmts' to value 'fltp'
[format_out_0_1 @ 000000000283b520] Setting 'sample_rates' to value '96000|88200|64000|48000|44100|32000|24000|22050|16000|12000|11025|8000|7350'
[format_out_0_1 @ 000000000283b520] Setting 'channel_layouts' to value '0x3'
[h264 @ 000000000046a760] nal_unit_type: 5, nal_ref_idc: 3
[AVFilterGraph @ 000000000031e5c0] query_formats: 4 queried, 9 merged, 0 already done, 0 delayed
[h264 @ 000000000046a760] user data:"x264 - core 148 r2665 a01e339 - H.264/MPEG-4 AVC codec - Copyleft 2003-2016 - Link removed - options: cabac=1 ref=1 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=0 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=12 lookahead_threads=2 sliced_threads=0 nr=0 decimate=1 interlaced=tff bluray_compat=0 constrained_intra=0 bframes=0 weightp=0 keyint=1 keyint_min=1 scenecut=40 intra_refresh=0 rc_lookahead=2 rc=crf mbtree=0 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 vbv_maxrate=50000 vbv_bufsize=5000 crf_max=0.0 nal_hrd=vbr filler=0 ip_ratio=1.40 aq=1:1.00"
[h264 @ 000000000046a760] ct_type:0 pic_struct:3
[h264 @ 000000000046a760] Reinit context to 1280x736, pix_fmt: yuv420p
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
[h264 @ 00000000026cdba0] nal_unit_type: 6, nal_ref_idc: 0
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
[h264 @ 00000000026cdba0] nal_unit_type: 6, nal_ref_idc: 0
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
[h264 @ 00000000026cdba0] nal_unit_type: 5, nal_ref_idc: 3
[h264 @ 00000000026cdba0] ct_type:0 pic_struct:3
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
[h264 @ 00000000026ce060] nal_unit_type: 6, nal_ref_idc: 0
[h264 @ 00000000026ce060] nal_unit_type: 6, nal_ref_idc: 0
[h264 @ 00000000026ce060] nal_unit_type: 5, nal_ref_idc: 3
[h264 @ 00000000026ce060] ct_type:0 pic_struct:3
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
[h264 @ 00000000026d8f20] nal_unit_type: 6, nal_ref_idc: 0
[h264 @ 00000000026d8f20] nal_unit_type: 6, nal_ref_idc: 0
[h264 @ 00000000026d8f20] nal_unit_type: 5, nal_ref_idc: 3
[h264 @ 00000000026d8f20] ct_type:0 pic_struct:3
[h264 @ 00000000026d96c0] nal_unit_type: 6, nal_ref_idc: 0
[h264 @ 00000000026d96c0] nal_unit_type: 6, nal_ref_idc: 0
[h264 @ 00000000026d96c0] nal_unit_type: 5, nal_ref_idc: 3
[h264 @ 00000000026d96c0] ct_type:0 pic_struct:3
[Parsed_scale_0 @ 000000000486f880] Setting 'w' to value '640'
[Parsed_scale_0 @ 000000000486f880] Setting 'h' to value '360'
[Parsed_scale_0 @ 000000000486f880] Setting 'flags' to value 'bicubic'
[Parsed_scale_0 @ 000000000486f880] w:640 h:360 flags:'bicubic' interl:0
[graph 0 input from stream 0:0 @ 000000000486fa40] Setting 'video_size' to value '1280x720'
[graph 0 input from stream 0:0 @ 000000000486fa40] Setting 'pix_fmt' to value '0'
[graph 0 input from stream 0:0 @ 000000000486fa40] Setting 'time_base' to value '1/25'
[graph 0 input from stream 0:0 @ 000000000486fa40] Setting 'pixel_aspect' to value '10/13'
[graph 0 input from stream 0:0 @ 000000000486fa40] Setting 'sws_param' to value 'flags=2'
[graph 0 input from stream 0:0 @ 000000000486fa40] Setting 'frame_rate' to value '25/1'
[graph 0 input from stream 0:0 @ 000000000486fa40] w:1280 h:720 pixfmt:yuv420p tb:1/25 fr:25/1 sar:10/13 sws_param:flags=2
[format @ 000000000486fe00] compat: called with args=[yuv420p|yuvj420p|yuv422p|yuvj422p|yuv444p|yuvj444p|nv12|nv16|nv21]
[format @ 000000000486fe00] Setting 'pix_fmts' to value 'yuv420p|yuvj420p|yuv422p|yuvj422p|yuv444p|yuvj444p|nv12|nv16|nv21'
[AVFilterGraph @ 000000000031f4e0] query_formats: 4 queried, 3 merged, 0 already done, 0 delayed
[Parsed_scale_0 @ 000000000486f880] w:1280 h:720 fmt:yuv420p sar:10/13 -> w:640 h:360 fmt:yuv420p sar:10/13 flags:0x4
[libx264 @ 0000000002716460] using mv_range_thread = 24
[libx264 @ 0000000002716460] using SAR=1/1
[libx264 @ 0000000002716460] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
[libx264 @ 0000000002716460] profile High, level 3.0
[udp @ 0000000004dabfe0] No default whitelist set
[mpegts @ 00000000057b1140] muxrate VBR, pcr every 2 pkts, sdt every 200, pat/pmt every 40 pkts
[tee @ 00000000028700a0] filename:'udp://10.0.0.105:5001' format:mpegts
[tee @ 00000000028700a0]     stream:0 codec:h264 type:video bsfs: null
[tee @ 00000000028700a0]     stream:1 codec:aac type:audio bsfs: null
[file @ 0000000004dadfa0] Setting default whitelist 'file,crypto'
[tee @ 00000000028700a0] filename:'d:/recordings/capture.mp4' format:mp4
[tee @ 00000000028700a0]     stream:0 codec:h264 type:video bsfs: null
[tee @ 00000000028700a0]     stream:1 codec:aac type:audio bsfs: null
Output #0, tee, to '[f=mpegts:onfail=ignore]udp://10.0.0.105:5001|[f=mp4:onfail=ignore]d:/recordings/capture.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf57.72.101
    Stream #0:0(dut), 0, 1/25: Video: h264 (libx264), yuv420p, 640x360 [SAR 1:1 DAR 16:9], q=-1--1, 25 fps, 25 tbn, 25 tbc (default)
    Metadata:
      handler_name    : VideoHandler
      encoder         : Lavc57.96.101 libx264
    Side data:
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
    Stream #0:1(dut), 0, 1/48000: Audio: aac (LC), 48000 Hz, stereo, fltp, 128 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
      encoder         : Lavc57.96.101 aac
Clipping frame in rate conversion by 0.000008
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
[h264 @ 000000000046a760] nal_unit_type: 6, nal_ref_idc: 0
[h264 @ 000000000046a760] nal_unit_type: 6, nal_ref_idc: 0
[h264 @ 000000000046a760] nal_unit_type: 5, nal_ref_idc: 3
[h264 @ 000000000046a760] ct_type:0 pic_struct:4

[h264 @ 00000000026d96c0] ct_type:0 pic_struct:4
[libx264 @ 0000000002716460] frame=   0 QP=16.02 NAL=3 Slice:I Poc:0   I:920  P:0    SKIP:0    size=13165 bytes
[h264 @ 000000000046a760] nal_unit_type: 6, nal_ref_idc: 0
[h264 @ 000000000046a760] nal_unit_type: 6, nal_ref_idc: 0
[h264 @ 000000000046a760] nal_unit_type: 5, nal_ref_idc: 3
[h264 @ 000000000046a760] ct_type:0 pic_struct:4
[libx264 @ 0000000002716460] frame=   1 QP=21.62 NAL=2 Slice:P Poc:8   I:31   P:164  SKIP:725  size=1200 bytes
[h264 @ 00000000026cdba0] nal_unit_type: 6, nal_ref_idc: 0
[h264 @ 00000000026cdba0] nal_unit_type: 6, nal_ref_idc: 0
[h264 @ 00000000026cdba0] nal_unit_type: 5, nal_ref_idc: 3
[h264 @ 00000000026cdba0] ct_type:0 pic_struct:4
[libx264 @ 0000000002716460] frame=   2 QP=26.82 NAL=2 Slice:B Poc:4   I:14   P:87   SKIP:818  size=255 bytes

Received windows signal 2
w.wijnia
 
Posts: 1
Joined: Tue May 30, 2017 7:20 am

Return to ffmpeg

Who is online

Users browsing this forum: Baidu [Spider], Bing [Bot], Google [Bot] and 2 guests