TCP connection refused with FFMPEG - tcp

OFFICIAL EDIT:
I thank you so much for your help but I am still encountering problems.
My ffserver.conf file is like this:
# Port on which the server is listening. You must select a different
# port from your standard HTTP web server if it is running on the same
# computer.
HTTPPort 8090
# Address on which the server is bound. Only useful if you have
# several network interfaces.
HTTPBindAddress 0.0.0.0
# Number of simultaneous HTTP connections that can be handled. It has
# to be defined *before* the MaxClients parameter, since it defines the
# MaxClients maximum limit.
MaxHTTPConnections 2000
# Number of simultaneous requests that can be handled. Since FFServer
# is very fast, it is more likely that you will want to leave this high
# and use MaxBandwidth, below.
MaxClients 1000
# This the maximum amount of kbit/sec that you are prepared to
# consume when streaming to clients.
MaxBandwidth 1000
# Access log file (uses standard Apache log file format)
# '-' is the standard output.
CustomLog -
##################################################################
# Definition of the live feeds. Each live feed contains one video
# and/or audio sequence coming from an ffmpeg encoder or another
# ffserver. This sequence may be encoded simultaneously with several
# codecs at several resolutions.
<Feed feed1.ffm>
# You must use 'ffmpeg' to send a live feed to ffserver. In this
# example, you can type:
#
# ffmpeg http://localhost:8090/feed1.ffm
# ffserver can also do time shifting. It means that it can stream any
# previously recorded live stream. The request should contain:
# "http://xxxx?date=[YYYY-MM-DDT][[HH:]MM:]SS[.m...]".You must specify
# a path where the feed is stored on disk. You also specify the
# maximum size of the feed, where zero means unlimited. Default:
# File=/tmp/feed_name.ffm FileMaxSize=5M
File /tmp/feed1.ffm
FileMaxSize 200K
# You could specify
# ReadOnlyFile /saved/specialvideo.ffm
# This marks the file as readonly and it will not be deleted or updated.
# Specify launch in order to start ffmpeg automatically.
# First ffmpeg must be defined with an appropriate path if needed,
# after that options can follow, but avoid adding the http:// field
#Launch ffmpeg
# Only allow connections from localhost to the feed.
#ACL allow 127.0.0.1
#ACL allow 189.34.0.158
</Feed>
##################################################################
# Now you can define each stream which will be generated from the
# original audio and video stream. Each format has a filename (here
# 'test1.mpg'). FFServer will send this stream when answering a
# request containing this filename.
<Stream test1.mpg>
# coming from live feed 'feed1'
Feed feed1.ffm
# Format of the stream : you can choose among:
# mpeg : MPEG-1 multiplexed video and audio
# mpegvideo : only MPEG-1 video
# mp2 : MPEG-2 audio (use AudioCodec to select layer 2 and 3 codec)
# ogg : Ogg format (Vorbis audio codec)
# rm : RealNetworks-compatible stream. Multiplexed audio and video.
# ra : RealNetworks-compatible stream. Audio only.
# mpjpeg : Multipart JPEG (works with Netscape without any plugin)
# jpeg : Generate a single JPEG image.
# asf : ASF compatible streaming (Windows Media Player format).
# swf : Macromedia Flash compatible stream
# avi : AVI format (MPEG-4 video, MPEG audio sound)
Format mpeg
# Bitrate for the audio stream. Codecs usually support only a few
# different bitrates.
AudioBitRate 32
# Number of audio channels: 1 = mono, 2 = stereo
AudioChannels 1
# Sampling frequency for audio. When using low bitrates, you should
# lower this frequency to 22050 or 11025. The supported frequencies
# depend on the selected audio codec.
AudioSampleRate 44100
# Bitrate for the video stream
VideoBitRate 64
# Ratecontrol buffer size
VideoBufferSize 40
# Number of frames per second
VideoFrameRate 3
# Size of the video frame: WxH (default: 160x128)
# The following abbreviations are defined: sqcif, qcif, cif, 4cif, qqvga,
# qvga, vga, svga, xga, uxga, qxga, sxga, qsxga, hsxga, wvga, wxga, wsxga,
# wuxga, woxga, wqsxga, wquxga, whsxga, whuxga, cga, ega, hd480, hd720,
# hd1080
VideoSize 160x128
# Transmit only intra frames (useful for low bitrates, but kills frame rate).
#VideoIntraOnly
# If non-intra only, an intra frame is transmitted every VideoGopSize
# frames. Video synchronization can only begin at an intra frame.
VideoGopSize 12
# More MPEG-4 parameters
# VideoHighQuality
# Video4MotionVector
# Choose your codecs:
#AudioCodec mp2
#VideoCodec mpeg1video
# Suppress audio
#NoAudio
# Suppress video
#NoVideo
#VideoQMin 3
#VideoQMax 31
# Set this to the number of seconds backwards in time to start. Note that
# most players will buffer 5-10 seconds of video, and also you need to allow
# for a keyframe to appear in the data stream.
#Preroll 15
# ACL:
# You can allow ranges of addresses (or single addresses)
#ACL ALLOW <first address> <last address>
# You can deny ranges of addresses (or single addresses)
#ACL DENY <first address> <last address>
# You can repeat the ACL allow/deny as often as you like. It is on a per
# stream basis. The first match defines the action. If there are no matches,
# then the default is the inverse of the last ACL statement.
#
# Thus 'ACL allow localhost' only allows access from localhost.
# 'ACL deny 1.0.0.0 1.255.255.255' would deny the whole of network 1 and
# allow everybody else.
</Stream>
##################################################################
# Example streams
# Multipart JPEG
#<Stream test.mjpg>
#Feed feed1.ffm
#Format mpjpeg
#VideoFrameRate 2
#VideoIntraOnly
#NoAudio
#Strict -1
#</Stream>
# Single JPEG
#<Stream test.jpg>
#Feed feed1.ffm
#Format jpeg
#VideoFrameRate 2
#VideoIntraOnly
##VideoSize 352x240
#NoAudio
#Strict -1
#</Stream>
# Flash
#<Stream test.swf>
#Feed feed1.ffm
#Format swf
#VideoFrameRate 2
#VideoIntraOnly
#NoAudio
#</Stream>
# ASF compatible
<Stream test.asf>
Feed feed1.ffm
Format asf
VideoFrameRate 15
VideoSize 352x240
VideoBitRate 256
VideoBufferSize 40
VideoGopSize 30
AudioBitRate 64
StartSendOnKey
</Stream>
# MP3 audio
#<Stream test.mp3>
#Feed feed1.ffm
#Format mp2
#AudioCodec mp3
#AudioBitRate 64
#AudioChannels 1
#AudioSampleRate 44100
#NoVideo
#</Stream>
# Ogg Vorbis audio
#<Stream test.ogg>
#Feed feed1.ffm
#Metadata title "Stream title"
#AudioBitRate 64
#AudioChannels 2
#AudioSampleRate 44100
#NoVideo
#</Stream>
# Real with audio only at 32 kbits
#<Stream test.ra>
#Feed feed1.ffm
#Format rm
#AudioBitRate 32
#NoVideo
#NoAudio
#</Stream>
# Real with audio and video at 64 kbits
#<Stream test.rm>
#Feed feed1.ffm
#Format rm
#AudioBitRate 32
#VideoBitRate 128
#VideoFrameRate 25
#VideoGopSize 25
#NoAudio
#</Stream>
##################################################################
# A stream coming from a file: you only need to set the input
# filename and optionally a new format. Supported conversions:
# AVI -> ASF
#<Stream file.rm>
#File "/usr/local/httpd/htdocs/tlive.rm"
#NoAudio
#</Stream>
#<Stream file.asf>
#File "/usr/local/httpd/htdocs/test.asf"
#NoAudio
#Metadata author "Me"
#Metadata copyright "Super MegaCorp"
#Metadata title "Test stream from disk"
#Metadata comment "Test comment"
#</Stream>
##################################################################
# RTSP examples
#
# You can access this stream with the RTSP URL:
# rtsp://localhost:5454/test1-rtsp.mpg
#
# A non-standard RTSP redirector is also created. Its URL is:
# http://localhost:8090/test1-rtsp.rtsp
#<Stream test1-rtsp.mpg>
#Format rtp
#File "/usr/local/httpd/htdocs/test1.mpg"
#</Stream>
# Transcode an incoming live feed to another live feed,
# using libx264 and video presets
#<Stream live.h264>
#Format rtp
#Feed feed1.ffm
#VideoCodec libx264
#VideoFrameRate 24
#VideoBitRate 100
#VideoSize 480x272
#AVPresetVideo default
#AVPresetVideo baseline
#AVOptionVideo flags +global_header
#
#AudioCodec libfaac
#AudioBitRate 32
#AudioChannels 2
#AudioSampleRate 22050
#AVOptionAudio flags +global_header
#</Stream>
##################################################################
# SDP/multicast examples
#
# If you want to send your stream in multicast, you must set the
# multicast address with MulticastAddress. The port and the TTL can
# also be set.
#
# An SDP file is automatically generated by ffserver by adding the
# 'sdp' extension to the stream name (here
# http://localhost:8090/test1-sdp.sdp). You should usually give this
# file to your player to play the stream.
#
# The 'NoLoop' option can be used to avoid looping when the stream is
# terminated.
#<Stream test1-sdp.mpg>
#Format rtp
#File "/usr/local/httpd/htdocs/test1.mpg"
#MulticastAddress 224.124.0.1
#MulticastPort 5000
#MulticastTTL 16
#NoLoop
#</Stream>
##################################################################
# Special streams
# Server status
<Stream stat.html>
Format status
# Only allow local people to get the status
ACL allow localhost
ACL allow 192.168.0.0 192.168.255.255
#FaviconURL http://pond1.gladstonefamily.net:8080/favicon.ico
</Stream>
# Redirect index.html to the appropriate site
<Redirect index.html>
URL http://www.ffmpeg.org/
</Redirect>
I started my server and executed:
ffserver -d -f /usr/share/doc/ffmpeg-2.6.8/ffserver.conf
No error message and everything looks fine.
After that I execute this (in your answer, I think you forgot the port number):
ffmpeg -i "rtsp://200.180.90.95:554/onvif1" -r 25 -s 640x480 -c:v libx264 -flags +global_header -f flv "http://45.79.207.38:8090/feed1.ffm"
Then I get this log:
libavutil 54. 20.100 / 54. 20.100
libavcodec 56. 26.100 / 56. 26.100
libavformat 56. 25.101 / 56. 25.101
libavdevice 56. 4.100 / 56. 4.100
libavfilter 5. 11.102 / 5. 11.102
libavresample 2. 1. 0 / 2. 1. 0
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 1.100 / 1. 1.100
libpostproc 53. 3.100 / 53. 3.100
[h264 # 0x1a23580] RTP: missed 1 packets
[pcm_alaw # 0x1a24360] RTP: missed 2 packets
[h264 # 0x1a23580] RTP: missed 1 packets
Invalid UE golomb code
[h264 # 0x1a23580] cbp too large (3199971767) at 76 33
[h264 # 0x1a23580] error while decoding MB 76 33
[h264 # 0x1a23580] Cannot use next picture in error concealment
[h264 # 0x1a23580] concealing 933 DC, 933 AC, 933 MV errors in P frame
[h264 # 0x1a23580] RTP: missed 1 packets
[h264 # 0x1a23580] cbp too large (62) at 50 24
[h264 # 0x1a23580] error while decoding MB 50 24
[h264 # 0x1a23580] Cannot use next picture in error concealment
[h264 # 0x1a23580] concealing 1679 DC, 1679 AC, 1679 MV errors in P frame
[h264 # 0x1a23580] RTP: missed 2 packets
[h264 # 0x1a23580] Cannot use next picture in error concealment
[h264 # 0x1a23580] concealing 1965 DC, 1965 AC, 1965 MV errors in P frame
[pcm_alaw # 0x1a24360] RTP: missed 1 packets
Last message repeated 1 times
[h264 # 0x1a23580] RTP: missed 3 packets
[h264 # 0x1a23580] mb_type 49 in P slice too large at 74 25
[h264 # 0x1a23580] error while decoding MB 74 25
[h264 # 0x1a23580] Cannot use next picture in error concealment
[h264 # 0x1a23580] concealing 1575 DC, 1575 AC, 1575 MV errors in P frame
[h264 # 0x1a23580] RTP: missed 2 packets
[h264 # 0x1a23580] P sub_mb_type 29 out of range at 30 26
[h264 # 0x1a23580] error while decoding MB 30 26
[h264 # 0x1a23580] Cannot use next picture in error concealment
[h264 # 0x1a23580] concealing 1539 DC, 1539 AC, 1539 MV errors in P frame
[h264 # 0x1a23580] RTP: missed 1 packets
[h264 # 0x1a23580] out of range intra chroma pred mode at 72 29
[h264 # 0x1a23580] error while decoding MB 72 29
[h264 # 0x1a23580] Cannot use next picture in error concealment
[h264 # 0x1a23580] concealing 1257 DC, 1257 AC, 1257 MV errors in P frame
[h264 # 0x1a23580] RTP: missed 3 packets
[h264 # 0x1a23580] negative number of zero coeffs at 48 5
[h264 # 0x1a23580] error while decoding MB 48 5
[h264 # 0x1a23580] Cannot use next picture in error concealment
[h264 # 0x1a23580] concealing 3201 DC, 3201 AC, 3201 MV errors in P frame
[pcm_alaw # 0x1a24360] RTP: missed 1 packets
[rtsp # 0x1a20ee0] decoding for stream 0 failed
Guessed Channel Layout for Input Stream #0.1 : mono
Input #0, rtsp, from 'rtsp://200.180.90.95:554/onvif1':
Metadata:
title : H.264 Video, RtspServer_0.0.0.2
Duration: N/A, start: 0.000000, bitrate: N/A
Stream #0:0: Video: h264 (Baseline), yuv420p, 1280x720, 90k tbr, 90k tbn, 180k tbc
Stream #0:1: Audio: pcm_alaw, 8000 Hz, 1 channels, s16, 64 kb/s
[libx264 # 0x1b728a0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX AVX2 FMA3 LZCNT BMI2
[libx264 # 0x1b728a0] profile High, level 3.0
[libx264 # 0x1b728a0] 264 - core 142 r2495 6a301b6 - H.264/MPEG-4 AVC codec - Copyleft 2003-2014 - 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=1 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=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
[flv # 0x1a66300] FLV does not support sample rate 8000, choose from (44100, 22050, 11025)
[flv # 0x1a66300] Audio codec mp3 not compatible with flv
Output #0, flv, to 'http://45.79.207.38:8090/feed1.ffm':
Metadata:
title : H.264 Video, RtspServer_0.0.0.2
encoder : Lavf56.25.101
Stream #0:0: Video: h264 (libx264) ([7][0][0][0] / 0x0007), yuv420p, 640x480, q=-1--1, 25 fps, 1k tbn, 25 tbc
Metadata:
encoder : Lavc56.26.100 libx264
Stream #0:1: Audio: mp3 (libmp3lame) ([2][0][0][0] / 0x0002), 8000 Hz, mono, s16p
Metadata:
encoder : Lavc56.26.100 libmp3lame
Stream mapping:
Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
Stream #0:1 -> #0:1 (pcm_alaw (native) -> mp3 (libmp3lame))
Could not write header for output file #0 (incorrect codec parameters ?): Function not implemented
I am doing this in a clean install of CENTOS, no customization. Could you please helpe me?

When you installed ffmpeg (yum install ffmpeg), along with ffmpeg,ffserver is also installed.
Step 1: Configure ffserver (config file located in /etc/ffserver.conf), configure HTTPPort to any available port. <Feed feed1.ffm> .... </Feed> this block describes the input point for server feed. and <Stream test1.mpg> .. </Stream> block in output. Final output stream is decided by this block.
Step 2: Start ffserver by typing ffserver in command line (if you want to run it in background then 'nohup ffserver &')
Step 3: ffmpeg -i "rtsp://200.180.90.95:554/onvif1" -r 25 -s 640x480 -c:v libx264 -flags +global_header -f flv "http://45.79.207.38:/feed1.ffm"
NOTE: Streaming video requires higher internet bandwidth.

Related

Extracting RIFF data from both .wav and .flac files

Wave files can contain unofficial metadata, such as Sampler Chunk - "smpl":
https://sites.google.com/site/musicgapi/technical-documents/wav-file-format#smpl
These are used for audio looping players and samplers avoiding to loading multiple samples.
I have one such file here:
https://github.com/studiorack/basic-harmonica/blob/bf42d5bab7470cc201e3c4b6dee7925b19db6bff/samples/harmonica_1.wav
and a flac file converted using the official flac command line tool:
flac harmonica_1.wav --keep-foreign-metadata
https://github.com/studiorack/basic-harmonica/blob/main/samples/harmonica_1.flac
When running these tools I can confirm the metadata exists in each file:
https://hexfiend.com
However I do see a different in the number of bytes (I believe as flac has riff inserted in multiple places)
I can also convert the .flac file back to .wav and it is the same size, and contains the metadata: flac harmonica_1.flac --keep-foreign-metadata
When using other tools I can read the data:
$ sndfile-info har.wav
smpl : 60
Manufacturer : 0
Product : 0
Period : 20833 nsec
Midi Note : 64
Pitch Fract. : 0
SMPTE Format : 0
SMPTE Offset : 00:00:00 00
Loop Count : 1
Cue ID : 131072 Type : 0 Start : 12707 End : 47221 Fraction : 0 Count : 0
Sampler Data : 0
https://linux.die.net/man/1/sndfile-info
This only works for .wav files. There is a feature request for libsndfile to support 'smpl' in flac files:
https://github.com/libsndfile/libsndfile/issues/59
$ metaflac ./har.flac --list
smpl<aQ#�1u�METADATA block #7
type: 2 (APPLICATION)
is last: false
length: 20
application ID: 72696666
data contents:
https://xiph.org/flac
However as you can see the result returned are different. I would like a both .wav and .flac RIFF 'smpl' data to be returned in the same format, so I can verify the results match.
https://exiftool.org appears to be tool to do that. But it also produced inconsistent results between .wav and .flac:
$ exiftool -a -G1 -s ./har.wav
[ExifTool] ExifToolVersion : 12.42
[System] FileName : har.wav
[System] Directory : .
[System] FileSize : 95 kB
[System] FileModifyDate : 2022:10:11 21:16:37-07:00
[System] FileAccessDate : 2022:10:15 14:39:46-07:00
[System] FileInodeChangeDate : 2022:10:15 14:39:50-07:00
[System] FilePermissions : -rw-r--r--
[File] FileType : WAV
[File] FileTypeExtension : wav
[File] MIMEType : audio/x-wav
[RIFF] Encoding : Microsoft PCM
[RIFF] NumChannels : 1
[RIFF] SampleRate : 48000
[RIFF] AvgBytesPerSec : 96000
[RIFF] BitsPerSample : 16
[RIFF] Manufacturer : 0
[RIFF] Product : 0
[RIFF] SamplePeriod : 20833
[RIFF] MIDIUnityNote : 64
[RIFF] MIDIPitchFraction : 0
[RIFF] SMPTEFormat : none
[RIFF] SMPTEOffset : 00:00:00:00
[RIFF] NumSampleLoops : 1
[RIFF] SamplerDataLen : 0
[RIFF] SamplerData : (Binary data 20 bytes, use -b option to extract)
[RIFF] UnshiftedNote : 64
[RIFF] FineTune : 0
[RIFF] Gain : 0
[RIFF] LowNote : 0
[RIFF] HighNote : 127
[RIFF] LowVelocity : 0
[RIFF] HighVelocity : 127
[RIFF] Comment : Recorded on 7/10/2022 in Edison.
[RIFF] Software : FL Studio 20
[Composite] Duration : 0.99 s
and for flac
$ exiftool -a -G1 -s ./har.flac
[ExifTool] ExifToolVersion : 12.42
[System] FileName : har.flac
[System] Directory : .
[System] FileSize : 83 kB
[System] FileModifyDate : 2022:10:11 20:59:37-07:00
[System] FileAccessDate : 2022:10:15 14:44:12-07:00
[System] FileInodeChangeDate : 2022:10:15 14:42:26-07:00
[System] FilePermissions : -rw-r--r--
[File] FileType : FLAC
[File] FileTypeExtension : flac
[File] MIMEType : audio/flac
[FLAC] BlockSizeMin : 4096
[FLAC] BlockSizeMax : 4096
[FLAC] FrameSizeMin : 3442
[FLAC] FrameSizeMax : 6514
[FLAC] SampleRate : 48000
[FLAC] Channels : 1
[FLAC] BitsPerSample : 16
[FLAC] TotalSamples : 47222
[FLAC] MD5Signature : f89646c0d3056ec38c3e33ca79299253
[Vorbis] Vendor : reference libFLAC 1.4.1 20220922
[Composite] Duration : 0.98 s
How can I read this data consistently regardless of .flac or .wav file?
I was helped by the creator of exiftool here:
https://exiftool.org/forum/index.php?topic=14064.0
In short flac riff blocks were stored in a custom metadata format which exiftool could parse but needed a custom .ExifTool_config file
The creator added the necessary changes in a commit:
https://github.com/exiftool/exiftool/commit/5c2467fa6cdb38233793884e80cee9abf4da48e6#diff-0c24c6846e8207ad8d090e564fdc366dad6386f2ef7c51eea5aa0d72d970ff11
The latest release of ExifTool 12.49 now parses .wav and .flac loop data!
"Decode 'riff' metadata blocks in FLAC audio files"
https://exiftool.org/history.html
Usage:
exiftool ./har.wav
exiftool ./har.flac
Output:
Encoding : Microsoft PCM
Num Channels : 1
Sample Rate : 48000
Avg Bytes Per Sec : 96000
Bits Per Sample : 16
Manufacturer : 0
Product : 0
Sample Period : 20833
MIDI Unity Note : 64
MIDI Pitch Fraction : 0
SMPTE Format : none
SMPTE Offset : 00:00:00:00
Num Sample Loops : 1
Sampler Data Len : 0
Sampler Data : (Binary data 20 bytes, use -b option to extract)
Unshifted Note : 64
Fine Tune : 0
Gain : 0
Low Note : 0
High Note : 127
Low Velocity : 0
High Velocity : 127
Acidizer Flags : One shot
Root Note : High C
Beats : 2
Meter : 4/4
Tempo : 0
Comment : Recorded on 7/10/2022 in Edison.
Software : FL Studio 20
Duration : 0.87 s

iperf3 - Meaning of Retr column in TCP measurement

Sorry for asking this topic, but after reading the tool's documentation and the similar ticket to my question (https://github.com/esnet/iperf/issues/343), I still don't really understand/know the meaning of the Retr column in a TCP measurement, and I do not get how to "use" it :-(
Let's say there is a result, like below, where are 5 retries. I got, these are the number of TCP segments retransmitted, but
were these retransmitted successfully, or they were just retried to send and not know about the result of that?
If I would like to see some kind of summa at the end in percentage (%), can the tool print it, similar to the UDP measurement? If not, how can I get the summa sent/received segments for compute the failure ratio?
Version of the tool:
>batman#bat-image:~$ iperf3 -v
iperf 3.8.1 (cJSON 1.7.13)
Linux bat-image 4.15.0-106-generic #107-Ubuntu SMP Thu Jun 4 11:27:52 UTC 2020 x86_64
Optional features available: CPU affinity setting, IPv6 flow label, TCP congestion algorithm setting, sendfile / zerocopy, socket pacing
batman#bat-image:~$
OS:
Ubuntu-18.04
batman#bat-image:~$ uname -aLinux bat-image 4.15.0-106-generic #107-Ubuntu SMP Thu Jun 4 11:27:52 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
batman#bat-image:~$
The log:
batman#bat-image:~$iperf3 -c 192.168.122.1 -f K -B 192.168.122.141 -b 10m -t 10
Connecting to host 192.168.122.1, port 5201
[ 5] local 192.168.122.141 port 34665 connected to 192.168.122.1 port 5201
[ ID] Interval Transfer Bitrate Retr Cwnd
[ 5] 0.00-1.00 sec 1.25 MBytes 10.5 Mbits/sec 0 297 KBytes
[ 5] 1.00-2.00 sec 1.25 MBytes 10.5 Mbits/sec 0 297 KBytes
[ 5] 2.00-3.00 sec 1.12 MBytes 9.43 Mbits/sec 0 297 KBytes
[ 5] 3.00-4.00 sec 1.25 MBytes 10.5 Mbits/sec 0 297 KBytes
[ 5] 4.00-5.00 sec 1.12 MBytes 9.43 Mbits/sec 0 297 KBytes
[ 5] 5.00-6.00 sec 1.25 MBytes 10.5 Mbits/sec 0 297 KBytes
[ 5] 6.00-7.00 sec 1.12 MBytes 9.44 Mbits/sec 2 1.41 KBytes
[ 5] 7.00-8.00 sec 512 KBytes 4.19 Mbits/sec 1 1.41 KBytes
[ 5] 8.00-9.00 sec 0.00 Bytes 0.00 Mbits/sec 1 1.41 KBytes
[ 5] 9.00-10.00 sec 0.00 Bytes 0.00 Mbits/sec 1 1.41 KBytes
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval Transfer Bitrate Retr
[ 5] 0.00-10.00 sec 8.87 MBytes 7.44 Mbits/sec 5 sender
[ 5] 0.00-16.91 sec 7.62 MBytes 3.78 Mbits/sec receiver
iperf Done.
thanks for your help,
/Robi
In iperf3 the column Retr stands for Retransmitted TCP packets and indicates the number of TCP packets that had to be sent again (=retransmitted).
The lower the value in Retr the better. An optimal value would be 0, meaning that no matter how many TCP packets have been sent, not a single one had to be resent. A value greater than zero indicates packet losses which might arise from network congestion (too much traffic) or corruption due to faulty hardware.
Your original issue on Github has also been answered (source): https://github.com/esnet/iperf/issues/343
You are asking about the different outputs of iperf3 based on whether you test UDP or TCP.
When using UDP it's acceptable for packets to not arrive at the destination. To indicate the quality of the connection/ data transfer you get a percentage of how many packets did not arrive at the destination.
When using TCP all packets are supposed to reach the destination and are checked for missing or corrupted ones (hence Transmission Control Protocol). If a packet is missing it get's retransmitted. To indicate the quality of the connection you get a number of how many packets had to be retransmitted.
So both the percentage with UDP and the Retr count with TCP are quality indicators that are adjusted to the specifics of each protocol.
If you are wondering what the Cwnd column means, it stands for Congestion Window. The Congestion Window is a TCP state variable that limits the amount of data the TCP can send into the network before receiving an ACK.
Source: https://blog.stackpath.com/glossary-cwnd-and-rwnd/

Incorrect wav header generated by sox

I was using sox to convert a 2 channels, 48000Hz, 24bits wav file (new.wav) to a mono wav file (post.wav).
Here are the related commands and outputs:
[Farmer#Ubuntu recording]$ soxi new.wav
Input File : 'new.wav'
Channels : 2
Sample Rate : 48000
Precision : 24-bit
Duration : 00:00:01.52 = 72901 samples ~ 113.908 CDDA sectors
File Size : 447k
Bit Rate : 2.35M
Sample Encoding: 24-bit Signed Integer PCM
[Farmer#Ubuntu recording]$ sox new.wav -c 1 post.wav
[Farmer#Ubuntu recording]$ soxi post.wav
Input File : 'post.wav'
Channels : 1
Sample Rate : 48000
Precision : 24-bit
Duration : 00:00:01.52 = 72901 samples ~ 113.908 CDDA sectors
File Size : 219k
Bit Rate : 1.15M
Sample Encoding: 24-bit Signed Integer PCM
It looks fine. But let us check the header of post.wav:
[Farmer#Ubuntu recording]$ xxd post.wav | head -10
00000000: 5249 4646 9856 0300 5741 5645 666d 7420 RIFF.V..WAVEfmt
00000010: 2800 0000 feff 0100 80bb 0000 8032 0200 (............2..
00000020: 0300 1800 1600 1800 0400 0000 0100 0000 ................
00000030: 0000 1000 8000 00aa 0038 9b71 6661 6374 .........8.qfact
00000040: 0400 0000 c51c 0100 6461 7461 4f56 0300 ........dataOV..
This is the standard wav file header structure.
The first line is no problem.
The second line "2800 0000" shows the size of sub chunk "fmt ", it should be 0x00000028 (as this is little endian) = 40 bytes. But there are 54 bytes (before sub chunk "fmt " and sub chunk "data").
The third line shows "ExtraParamSize" is 0x0018 = 22 bytes. But actually it is 36 bytes (from third line's "1600" to 5th line's "0100"). The previous 16 bytes are standard.
So what's the extra 36 bytes?
Ok,I found out the answer.
Look at the second line, we can found that audio format is "feff", actual value is 0xFFFE, so this is not a PCM standard wave format, but a extensible format.
Wav head detailed introduction can refer to this link. The article is well written and thanks to the author.
So as this is a Non-PCM format wav, "fmt " chunk space occupied 40 bytes is no problem, and followed by a "fact" chunk, and then is "data" chunk, So everything makes sense.

FFserver: cannot connect via rtsp

so im currrently trying to stream my windows desktop using ffmpeg into a raspberry pi running ffserver.
The client software im using needs to use RTSP, however i cannot connect to the stream no matter what i try.
I even used VLC in the messages it just says it cannot connect to the stream.
Any help would be greatly appreciated!
Im attempting to access the stream with rtsp :// 169.254.70.227 :8544/test.flv, as soon as i do it stops the ffmpeg feed
FFserver conf
`RTSPPort 8544
HTTPPort 8090 # Port to bind the server to
HTTPBindAddress 0.0.0.0
MaxHTTPConnections 2000
MaxClients 1000
MaxBandwidth 10000 # Maximum bandwidth per client
# set this high enough to exceed stream bitrate
CustomLog - # Remove this if you want FFserver to daemoni$
<Feed feed1.ffm> # This is the input feed where FFmpeg will send
File ./feed1.ffm # video stream.
FileMaxSize 100000K # Maximum file size for buffering video
ACL allow 192 .168.0.8
ACL allow 192 .168.0.17
ACL allow 169 .254.70.227
ACL allow 169 .254.9.29
ACL allow 169 .254.165.231
ACL allow 10 .14.2.197
ACL allow 192 .168.0.13
ACL allow 10 .14.2.197
ACL allow 192.16 8.0.13
ACL allow 192.1 68.1.3
ACL allow 192. 168.1.4
ACL allow 192 .168.1.2
</Feed>
<Stream test.flv> # Output stream URL definition
Format rtp
Feed feed1.ffm
NoAudio
# Video settings
VideoCodec libx264
VideoSize 720x576 # Video resolution
VideoBufferSize 2000
VideoFrameRate 30 # Video FPS
# Parameters passed to encoder
AVOptionVideo qmin 10
AVOptionVideo qmax 42
PreRoll 15
StartSendOnKey
MulticastAddress 224 .124.0.1
MulticastPort 5000
MulticastTTL 16
VideoBitRate 450 # Video bitrate
</Stream>
<Stream status.html> # Server status URL
Format status
# Only allow local people to get the status
ACL allow localhost
# Only allow local people to get the status
ACL allow localhost
ACL allow 192.168. 0.0 192.168. 255.255
</Stream>
<Redirect index. html> # Just an URL redirect for index
# Redirect index.html to the appropriate site
URL http ://www. ffmpeg .org/
</Redirect>`
FFmpeg feed
ffmpeg -rtbufsize 2100M -f dshow -r 29.970 -i video=screen-capture-recorder -c video=screen-capture-recorder.flv http :// 169 .254.70.227:8090/ feed1.ffm
FFserver output
configuration: --arch=armel --target-os=linux --enable-gpl --enable-libx264 --enable-nonfree
libavutil 55. 22.101 / 55. 22.101
libavcodec 57. 35.100 / 57. 35.100
libavformat 57. 34.103 / 57. 34.103
libavdevice 57. 0.101 / 57. 0.101
libavfilter 6. 44.100 / 6. 44.100
libswscale 4. 1.100 / 4. 1.100
libswresample 2. 0.101 / 2. 0.101
libpostproc 54. 0.100 / 54. 0.100
/etc/ffserver.conf:48: Setting default value for video bit rate tolerance = 112500. Use NoDefaults to disable it.
/etc/ffserver.conf:48: Setting default value for video rate control equation = tex^qComp. Use NoDefaults to disable it.
/etc/ffserver.conf:48: Setting default value for video max rate = 20744848. Use NoDefaults to disable it.
Wed Apr 27 10:33:46 2016 FFserver started.
Wed Apr 27 10:33:46 2016 224.124.0.1:5000 - - "PLAY test.flv/streamid=0 RTP/MCAST"
Wed Apr 27 10:33:46 2016 [rtp # 0x13d4660]Using AVStream.codec to pass codec parameters to muxers is deprecated, use AVStream.codecpar instead.
Wed Apr 27 10:33:49 2016 169.254.165.231 - - [GET] "/feed1. ffm HTTP/1.1" 200 4175
FFMpeg output
Stream mapping:
Stream #0:0 -> #0:0 (rawvideo (native) -> h264 (libx264))
Press [q] to stop, [?] for help
[swscaler # 000000000252f5e0] Warning: data is not aligned! This can lead to a speedloss
av_interleaved_write_frame(): Unknown errortime=00:00:05.00 bitrate= 249.0kbits/s speed=0.393x
Error writing trailer of http: //169. 254.70.227:8090/feed1.ffm: Error number -10053 occurredframe= 204 fps= 15 q=26.0 Lsize= 164kB time=00:00:05.03 bitrate= 266.9kbits/s speed=0.365x
video:155kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 5.475512%
[libx264 # 00000000025187e0] frame I:1 Avg QP:34.24 size: 32151
[libx264 # 00000000025187e0] frame P:59 Avg QP:27.14 size: 1807
[libx264 # 00000000025187e0] frame B:144 Avg QP:32.16 size: 168
[libx264 # 00000000025187e0] consecutive B-frames: 4.9% 2.0% 2.9% 90.2%
[libx264 # 00000000025187e0] mb I I16..4: 26.0% 23.1% 50.9%
[libx264 # 00000000025187e0] mb P I16..4: 1.9% 1.6% 1.1% P16..4: 4.3% 0.6% 0.4% 0.0% 0.0% skip:90.2%
[libx264 # 00000000025187e0] mb B I16..4: 0.2% 0.1% 0.1% B16..8: 3.1% 0.1% 0.0% direct: 0.1% skip:96.3% L0:26.0% L1:73.5% BI: 0.5%
[libx264 # 00000000025187e0] final ratefactor: 24.13
[libx264 # 00000000025187e0] 8x8 transform intra:31.8% inter:47.1%
[libx264 # 00000000025187e0] coded y,u,v intra: 28.1% 8.2% 6.3% inter: 0.6% 0.2% 0.1%
[libx264 # 00000000025187e0] i16 v,h,dc,p: 30% 63% 6% 1%
[libx264 # 00000000025187e0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 16% 16% 63% 1% 0% 0% 1% 0% 3%
[libx264 # 00000000025187e0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 28% 39% 15% 2% 2% 3% 4% 3% 4%
[libx264 # 00000000025187e0] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 # 00000000025187e0] ref P L0: 66.3% 13.1% 16.9% 3.6%
[libx264 # 00000000025187e0] ref B L0: 66.6% 29.7% 3.8%
[libx264 # 00000000025187e0] ref B L1: 91.7% 8.3%
[libx264 # 00000000025187e0] kb/s:191.78
Conversion failed!

What are the specifications of Flex usable FLV videos?

I have a server which streams FLV files to a Flex client.
In this flex client, the video timeline advances incoherently, and no video can be seen on screen (only the sound can be heard).
My FLV file has been generated using ffmpeg, which says (about this generated file)
FFmpeg version 0.6, Copyright (c) 2000-2010 the FFmpeg developers
built on Aug 8 2010 04:24:04 with gcc 4.3.2
configuration: --prefix=/home/marpada/ffmpegfull --enable-gpl --enable-version3 --enable-nonfree --disable-ffplay --disable-ffserver --enable-libmp3lame --enable-libfaac --enable-libvpx --enable-libfaad --enable-libvorbis --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libxvid --enable-libx264 --enable-libtheora --extra-ldflags=-static --extra-libs='-lvorbis -logg -lxvidcore -lx264 -lopencore-amrnb -lopencore-amrwb -lfaad -lfaac -lvpx -ltheora -lm -lpthread' --enable-small --enable-runtime-cpudetect
libavutil 50.15. 1 / 50.15. 1
libavcodec 52.72. 2 / 52.72. 2
libavformat 52.64. 2 / 52.64. 2
libavdevice 52. 2. 0 / 52. 2. 0
libswscale 0.11. 0 / 0.11. 0
[flv # 0x95c6aa0]Estimating duration from bitrate, this may be inaccurate
Seems stream 0 codec frame rate differs from container frame rate: 1000.00 (1000/1) -> 25.00 (25/1)
Input #0, flv, from '/appli/perigee_70ri/data/files/ged_bur%0/Imagettes/70ri/279/2/8/20_109021138o.70ri_FLV_preview_.flv':
Metadata:
hasMetadata : true
hasVideo : true
hasAudio : true
duration : 589
lasttimestamp : 589
lastkeyframetimestamp: 589
width : 352
height : 288
videodatarate : 199
framerate : 25
audiodatarate : 125
audiosamplerate : 44100
audiosamplesize : 16
stereo : true
filesize : 25058444
videosize : 15195503
audiosize : 9690850
datasize : 23027
metadatacreator : flvmeta 1.1-r202
audiocodecid : 2
videocodecid : 2
audiodelay : 0
canSeekToEnd : false
hasCuePoints : false
hasKeyframes : true
Duration: 00:09:48.78, start: 0.000000, bitrate: 332 kb/s
Stream #0.0: Video: flv, yuv420p, 352x288, 204 kb/s, 25 tbr, 1k tbn, 1k tbc
Stream #0.1: Audio: mp3, 44100 Hz, 2 channels, s16, 128 kb/s
At least one output file must be specified
Which, as far as it seems to me, is OK.
Furthermore, the video plays nice in VLC.
Use H.264 for the video stream.

Resources