[FFmpeg-user] Uploading video and audio data from USB devices to ffserver fails.

Takeshi Mizumoto ta.mizumoto at gmail.com
Mon Aug 11 07:00:56 CEST 2014


Hello all,
(I send this message again because I forgot to add the subject. Sorry.)

I am trying to
grab audio from a USB microphone device and video from a webcam,
and send it to ffserver.
The audio codec is flac, the video codec is theora,  and the container is ogg.

I succeeded this only when I store it to a ogg file.
However, I fail to send it to the ffserver.
The error message is
   av_interleaved_write_frame(): Connection reset by peer.
# I will put the whole error message below

This is the ffmpeg command I tried:
ffmpeg -f alsa -ac 7 -ar 16000 -i plughw:2,0 -f video4linux2 -i
/dev/video0 -f ogg -r 10 -s 640x240 -ac 7 -ar 16000 -acodec flac
-vcodec theora -loglevel debug http://localhost:8090/feed.ffm

Is it possible to grab audio and video from two USB devices and send
it to ffserver?
Is there any good way to inspect the problem?

Thank you
Takeshi


This is the error message:
ffmpeg version 2.3 Copyright (c) 2000-2014 the FFmpeg developers
  built on Aug  5 2014 17:13:34 with gcc 4.8 (Ubuntu/Linaro 4.8.1-10ubuntu9)
  configuration: --extra-libs=-ldl --enable-libass --enable-libfdk-aac
--enable-libfreetype --enable-libmp3lame --enable-libopus
--enable-libtheora --enable-libvorbis --enable-libvpx --enable-nonfree
--enable-librtmp
  libavutil      52. 92.100 / 52. 92.100
  libavcodec     55. 69.100 / 55. 69.100
  libavformat    55. 48.100 / 55. 48.100
  libavdevice    55. 13.102 / 55. 13.102
  libavfilter     4. 11.100 /  4. 11.100
  libswscale      2.  6.100 /  2.  6.100
  libswresample   0. 19.100 /  0. 19.100
Splitting the commandline.
Reading option '-f' ... matched as option 'f' (force format) with
argument 'alsa'.
Reading option '-ac' ... matched as option 'ac' (set number of audio
channels) with argument '7'.
Reading option '-ar' ... matched as option 'ar' (set audio sampling
rate (in Hz)) with argument '16000'.
Reading option '-i' ... matched as input file with argument 'plughw:2,0'.
Reading option '-f' ... matched as option 'f' (force format) with
argument 'video4linux2'.
Reading option '-i' ... matched as input file with argument '/dev/video0'.
Reading option '-f' ... matched as option 'f' (force format) with
argument 'ogg'.
Reading option '-r' ... matched as option 'r' (set frame rate (Hz
value, fraction or abbreviation)) with argument '10'.
Reading option '-s' ... matched as option 's' (set frame size (WxH or
abbreviation)) with argument '640x240'.
Reading option '-ac' ... matched as option 'ac' (set number of audio
channels) with argument '7'.
Reading option '-ar' ... matched as option 'ar' (set audio sampling
rate (in Hz)) with argument '16000'.
Reading option '-acodec' ... matched as option 'acodec' (force audio
codec ('copy' to copy stream)) with argument 'flac'.
Reading option '-vcodec' ... matched as option 'vcodec' (force video
codec ('copy' to copy stream)) with argument 'theora'.
Reading option '-loglevel' ... matched as option 'loglevel' (set
logging level) with argument 'debug'.
Reading option 'http://localhost:8090/feed.ffm' ... 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 plughw:2,0.
Applying option f (force format) with argument alsa.
Applying option ac (set number of audio channels) with argument 7.
Applying option ar (set audio sampling rate (in Hz)) with argument 16000.
Successfully parsed a group of options.
Opening an input file: plughw:2,0.
[alsa @ 0x1c33da0] All info found
Guessed Channel Layout for  Input Stream #0.0 : 6.1
Input #0, alsa, from 'plughw:2,0':
  Duration: N/A, start: 1407480570.146633, bitrate: 1792 kb/s
    Stream #0:0, 1, 1/1000000: Audio: pcm_s16le, 16000 Hz, 7 channels,
s16, 1792 kb/s
Successfully opened the file.
Parsing a group of options: input file /dev/video0.
Applying option f (force format) with argument video4linux2.
Successfully parsed a group of options.
Opening an input file: /dev/video0.
[video4linux2,v4l2 @ 0x1c4bf60] fd:3 capabilities:84000001
[video4linux2,v4l2 @ 0x1c4bf60] Current input_channel: 0, input_name:
Camera 1, input_std: 0
[video4linux2,v4l2 @ 0x1c4bf60] Querying the device for the current frame size
[video4linux2,v4l2 @ 0x1c4bf60] Setting frame size to 1280x480
[video4linux2,v4l2 @ 0x1c4bf60] The V4L2 driver changed the pixel
format from 0x32315559 to 0x56595559
[video4linux2,v4l2 @ 0x1c4bf60] Trying to set codec:rawvideo pix_fmt:yuv420p
[video4linux2,v4l2 @ 0x1c4bf60] The V4L2 driver changed the pixel
format from 0x32315559 to 0x56595559
[video4linux2,v4l2 @ 0x1c4bf60] Trying to set codec:rawvideo pix_fmt:yuv420p
[video4linux2,v4l2 @ 0x1c4bf60] The V4L2 driver changed the pixel
format from 0x32315659 to 0x56595559
[video4linux2,v4l2 @ 0x1c4bf60] Trying to set codec:rawvideo pix_fmt:yuv422p
[video4linux2,v4l2 @ 0x1c4bf60] The V4L2 driver changed the pixel
format from 0x50323234 to 0x56595559
[video4linux2,v4l2 @ 0x1c4bf60] Trying to set codec:rawvideo pix_fmt:yuyv422
[video4linux2,v4l2 @ 0x1c4bf60] All info found
Input #1, video4linux2,v4l2, from '/dev/video0':
  Duration: N/A, start: 70732.637869, bitrate: 36372 kb/s
    Stream #1:0, 1, 1/1000000: Video: rawvideo (YUY2 / 0x32595559),
yuyv422, 1280x480, 1/1000000, 36372 kb/s, 3.70 fps, 3.70 tbr, 1000k
tbn, 1000k tbc
Successfully opened the file.
Parsing a group of options: output file http://localhost:8090/feed.ffm.
Applying option f (force format) with argument ogg.
Applying option r (set frame rate (Hz value, fraction or
abbreviation)) with argument 10.
Applying option s (set frame size (WxH or abbreviation)) with argument 640x240.
Applying option ac (set number of audio channels) with argument 7.
Applying option ar (set audio sampling rate (in Hz)) with argument 16000.
Applying option acodec (force audio codec ('copy' to copy stream))
with argument flac.
Applying option vcodec (force video codec ('copy' to copy stream))
with argument theora.
Successfully parsed a group of options.
Opening an output file: http://localhost:8090/feed.ffm.
Matched encoder 'libtheora' for codec 'theora'.
[http @ 0x1c44e20] request: POST /feed.ffm HTTP/1.1
Transfer-Encoding: chunked
User-Agent: Lavf/55.48.100
Accept: */*
Connection: close
Host: localhost:8090


Successfully opened the file.
detected 4 logical cores
[graph 0 input from stream 1:0 @ 0x1c23a60] Setting 'video_size' to
value '1280x480'
[graph 0 input from stream 1:0 @ 0x1c23a60] Setting 'pix_fmt' to value '1'
[graph 0 input from stream 1:0 @ 0x1c23a60] Setting 'time_base' to
value '1/1000000'
[graph 0 input from stream 1:0 @ 0x1c23a60] Setting 'pixel_aspect' to
value '0/1'
[graph 0 input from stream 1:0 @ 0x1c23a60] Setting 'sws_param' to
value 'flags=2'
[graph 0 input from stream 1:0 @ 0x1c23a60] Setting 'frame_rate' to
value '37/10'
[graph 0 input from stream 1:0 @ 0x1c23a60] w:1280 h:480
pixfmt:yuyv422 tb:1/1000000 fr:37/10 sar:0/1 sws_param:flags=2
[scaler for output stream 0:0 @ 0x1c2b560] Setting 'w' to value '640'
[scaler for output stream 0:0 @ 0x1c2b560] Setting 'h' to value '240'
[scaler for output stream 0:0 @ 0x1c2b560] Setting 'flags' to value '0x4'
[scaler for output stream 0:0 @ 0x1c2b560] w:640 h:240 flags:'0x4' interl:0
[format @ 0x1c50440] compat: called with args=[yuv420p|yuv422p|yuv444p]
[format @ 0x1c50440] Setting 'pix_fmts' to value 'yuv420p|yuv422p|yuv444p'
[AVFilterGraph @ 0x1c1ae20] query_formats: 5 queried, 4 merged, 0
already done, 0 delayed
[scaler for output stream 0:0 @ 0x1c2b560] picking yuv422p out of 3
ref:yuyv422 alpha:0
[scaler for output stream 0:0 @ 0x1c2b560] w:1280 h:480 fmt:yuyv422
sar:0/1 -> w:640 h:240 fmt:yuv422p sar:0/1 flags:0x4
[graph 1 input from stream 0:0 @ 0x1c2b0a0] Setting 'time_base' to
value '1/16000'
[graph 1 input from stream 0:0 @ 0x1c2b0a0] Setting 'sample_rate' to
value '16000'
[graph 1 input from stream 0:0 @ 0x1c2b0a0] Setting 'sample_fmt' to value 's16'
[graph 1 input from stream 0:0 @ 0x1c2b0a0] Setting 'channel_layout'
to value '0x70f'
[graph 1 input from stream 0:0 @ 0x1c2b0a0] tb:1/16000 samplefmt:s16
samplerate:16000 chlayout:0x70f
[audio format for output stream 0:1 @ 0x1c21460] Setting 'sample_fmts'
to value 's16|s32'
[audio format for output stream 0:1 @ 0x1c21460] Setting
'sample_rates' to value '16000'
[audio format for output stream 0:1 @ 0x1c21460] Setting
'channel_layouts' to value '0x70f'
[AVFilterGraph @ 0x1c33380] query_formats: 4 queried, 9 merged, 0
already done, 0 delayed
[flac @ 0x1c4ef40]  compression: 5
[flac @ 0x1c4ef40]  lpc type: Levinson-Durbin recursion with Welch window
[flac @ 0x1c4ef40]  prediction order: 1, 8
[flac @ 0x1c4ef40]  order method: estimate
[flac @ 0x1c4ef40]  partition order: 0, 8
[flac @ 0x1c4ef40]  block size: 1152
[flac @ 0x1c4ef40]  lpc precision: 15
[ogg @ 0x1c4cf00] theora kfgshift 6, vrev 1
Output #0, ogg, to 'http://localhost:8090/feed.ffm':
  Metadata:
    encoder         : Lavf55.48.100
    Stream #0:0, 0, 1/10: Video: theora (libtheora), yuv422p, 640x240,
1/10, q=2-31, 200 kb/s, 10 fps, 10 tbn, 10 tbc
    Metadata:
      encoder         : Lavc55.69.100 libtheora
    Stream #0:1, 0, 1/16000: Audio: flac, 16000 Hz, 6.1, s16, 128 kb/s
    Metadata:
      encoder         : Lavc55.69.100 flac
Stream mapping:
  Stream #1:0 -> #0:0 (rawvideo (native) -> theora (libtheora))
  Stream #0:0 -> #0:1 (pcm_s16le (native) -> flac (native))
Press [q] to stop, [?] for help
*** 3 dup!
*** dropping frame 6 from stream 0 at ts 1
*** dropping frame 6 from stream 0 at ts 3
frame=    8 fps=0.0 q=0.0 size=       3kB time=00:00:02.66 bitrate=
10.6kbits/s*** dropping frame 9 from stream 0 at ts 6
*** 1 dup!
av_interleaved_write_frame(): Connection reset by peer
No more output streams to write to, finishing.
frame=   11 fps=0.0 q=0.0 Lsize=      13kB time=00:00:03.02 bitrate=
35.2kbits/s dup=4 drop=3
video:25kB audio:78kB subtitle:0kB other streams:0kB global
headers:3kB muxing overhead: unknown
Input file #0 (plughw:2,0):
  Input stream #0:0 (audio): 774 packets read (665154 bytes); 774
frames decoded (47511 samples);
  Total: 774 packets (665154 bytes) demuxed
Input file #1 (/dev/video0):
  Input stream #1:0 (video): 10 packets read (12288000 bytes); 10
frames decoded;
  Total: 10 packets (12288000 bytes) demuxed
Output file #0 (http://localhost:8090/feed.ffm):
  Output stream #0:0 (video): 11 frames encoded; 11 packets muxed (26072 bytes);
  Output stream #0:1 (audio): 41 frames encoded (47232 samples); 42
packets muxed (79941 bytes);
  Total: 53 packets (106013 bytes) muxed
784 frames successfully decoded, 0 decoding errors
[AVIOContext @ 0x1c52620] Statistics: 0 seeks, 5 writeouts


More information about the ffmpeg-user mailing list