[FFmpeg-user] Could not write header for output file #0 (incorrect codec parameters ?)

MrNice wxcvbn2006 at iol.ie
Sun Jul 19 20:21:18 CEST 2015


Hello everybody,

I want to record audio and video from a analogue to digital converter
Pinnacle Dazzle DVC100.

Command :
 ./ffmpeg -debug 1 -f pulse -i alsa_input.pci-0000_00_14.2.analog-stereo
-f v4l2 -i /dev/video0 /Store3/Test/copy_`date +%m%d_%H%M`.avi
ffmpeg version N-73517-g47d0773 Copyright (c) 2000-2015 the FFmpeg
developers
  built with gcc 5.1.1 (GCC) 20150618 (Red Hat 5.1.1-4)
  configuration: --enable-libpulse
  libavutil      54. 28.100 / 54. 28.100
  libavcodec     56. 47.100 / 56. 47.100
  libavformat    56. 40.100 / 56. 40.100
  libavdevice    56.  4.100 / 56.  4.100
  libavfilter     5. 21.100 /  5. 21.100
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  2.100 /  1.  2.100
 matched as AVOption 'debug' with argument '1'.
Reading option '-f' ... matched as option 'f' (force format) with
argument 'pulse'.
Reading option '-i' ... matched as input file with argument
'alsa_input.pci-0000_00_14.2.analog-stereo'.
Reading option '-f' ... matched as option 'f' (force format) with
argument 'v4l2'.
Reading option '-i' ... matched as input file with argument '/dev/video0'.
Reading option '/Store3/Test/copy_0719_1905.avi' ... matched as output file.
Finished splitting the commandline.
Parsing a group of options: global .
Successfully parsed a group of options.
Parsing a group of options: input file
alsa_input.pci-0000_00_14.2.analog-stereo.
Applying option f (force format) with argument pulse.
Successfully parsed a group of options.
Opening an input file: alsa_input.pci-0000_00_14.2.analog-stereo.
[pulse @ 0x2757ba0] All info found
Guessed Channel Layout for  Input Stream #0.0 : stereo
Input #0, pulse, from 'alsa_input.pci-0000_00_14.2.analog-stereo':
  Duration: N/A, start: 1437329119.928277, bitrate: 1536 kb/s
    Stream #0:0, 1, 1/1000000: Audio: pcm_s16le, 48000 Hz, 2 channels,
s16, 1536 kb/s
Successfully opened the file.
Parsing a group of options: input file /dev/video0.
Applying option f (force format) with argument v4l2.
Successfully parsed a group of options.
Opening an input file: /dev/video0.
[video4linux2,v4l2 @ 0x2770c40] fd:6 capabilities:85220001
[video4linux2,v4l2 @ 0x2770c40] Current input_channel: 1, input_name:
S-Video, input_std: ffffff
[video4linux2,v4l2 @ 0x2770c40] Querying the device for the current
frame size
[video4linux2,v4l2 @ 0x2770c40] Setting frame size to 720x576
[video4linux2,v4l2 @ 0x2770c40] Trying to set codec:rawvideo pix_fmt:yuv420p
    Last message repeated 1 times
[video4linux2,v4l2 @ 0x2770c40] Trying to set codec:rawvideo pix_fmt:yuv422p
[video4linux2,v4l2 @ 0x2770c40] Trying to set codec:rawvideo pix_fmt:yuyv422
[video4linux2,v4l2 @ 0x2770c40] The V4L2 driver is using the interlaced mode
[video4linux2,v4l2 @ 0x2770c40] Current standard: PAL, id: ff,
frameperiod: 1/25
[video4linux2,v4l2 @ 0x2770c40] interrupted
Input #1, video4linux2,v4l2, from '/dev/video0':
  Duration: N/A, bitrate: 165888 kb/s
    Stream #1:0, 0, 1/1000000: Video: rawvideo, 1 reference frame (YUY2
/ 0x32595559), yuyv422, 720x576 (0x0), 1/1000000, 165888 kb/s, 25 fps,
25 tbr, 1000k tbn, 1000k tbc
Successfully opened the file.
Parsing a group of options: output file /Store3/Test/copy_0719_1905.avi.
Successfully parsed a group of options.
Opening an output file: /Store3/Test/copy_0719_1905.avi.
Successfully opened the file.
detected 8 logical cores
[graph 0 input from stream 1:0 @ 0x2743dc0] Setting 'video_size' to
value '720x576'
[graph 0 input from stream 1:0 @ 0x2743dc0] Setting 'pix_fmt' to value '1'
[graph 0 input from stream 1:0 @ 0x2743dc0] Setting 'time_base' to value
'1/1000000'
[graph 0 input from stream 1:0 @ 0x2743dc0] Setting 'pixel_aspect' to
value '0/1'
[graph 0 input from stream 1:0 @ 0x2743dc0] Setting 'sws_param' to value
'flags=2'
[graph 0 input from stream 1:0 @ 0x2743dc0] Setting 'frame_rate' to
value '25/1'
[graph 0 input from stream 1:0 @ 0x2743dc0] w:720 h:576 pixfmt:yuyv422
tb:1/1000000 fr:25/1 sar:0/1 sws_param:flags=2
[format @ 0x274df00] compat: called with args=[yuv420p]
[format @ 0x274df00] Setting 'pix_fmts' to value 'yuv420p'
[auto-inserted scaler 0 @ 0x27324c0] Setting 'flags' to value '0x4'
[auto-inserted scaler 0 @ 0x27324c0] w:iw h:ih flags:'0x4' interl:0
[format @ 0x274df00] auto-inserting filter 'auto-inserted scaler 0'
between the filter 'Parsed_null_0' and the filter 'format'
[AVFilterGraph @ 0x2739a40] query_formats: 4 queried, 2 merged, 1
already done, 0 delayed
[auto-inserted scaler 0 @ 0x27324c0] w:720 h:576 fmt:yuyv422 sar:0/1 ->
w:720 h:576 fmt:yuv420p sar:0/1 flags:0x4
[graph 1 input from stream 0:0 @ 0x274d6e0] Setting 'time_base' to value
'1/48000'
[graph 1 input from stream 0:0 @ 0x274d6e0] Setting 'sample_rate' to
value '48000'
[graph 1 input from stream 0:0 @ 0x274d6e0] Setting 'sample_fmt' to
value 's16'
[graph 1 input from stream 0:0 @ 0x274d6e0] Setting 'channel_layout' to
value '0x3'
[graph 1 input from stream 0:0 @ 0x274d6e0] tb:1/48000 samplefmt:s16
samplerate:48000 chlayout:0x3
[audio format for output stream 0:1 @ 0x27437c0] Setting 'sample_fmts'
to value 'fltp'
[audio format for output stream 0:1 @ 0x27437c0] Setting
'channel_layouts' to value
'0x4|0x3|0x103|0x7|0x603|0x33|0x107|0x607|0x37|0xc|0xb|0x10b|0xf|0x60b|0x3b|0x10f|0x60f|0x3f'
[audio format for output stream 0:1 @ 0x27437c0] auto-inserting filter
'auto-inserted resampler 0' between the filter 'Parsed_anull_0' and the
filter 'audio format for output stream 0:1'
[AVFilterGraph @ 0x2743b80] query_formats: 4 queried, 6 merged, 3
already done, 0 delayed
[auto-inserted resampler 0 @ 0x27543e0] [SWR @ 0x27805a0] Using s16p
internally between filters
[auto-inserted resampler 0 @ 0x27543e0] ch:2 chl:stereo fmt:s16
r:48000Hz -> ch:2 chl:stereo fmt:fltp r:48000Hz
[mpeg4 @ 0x27736e0] intra_quant_bias = 0 inter_quant_bias = -64
Output #0, avi, to '/Store3/Test/copy_0719_1905.avi':
  Metadata:
    ISFT            : Lavf56.40.100
    Stream #0:0, 0, 1/25: Video: mpeg4, 1 reference frame (FMP4 /
0x34504D46), yuv420p, 720x576, 1/25, q=2-31, 200 kb/s, 25 fps, 25 tbn,
25 tbc
    Metadata:
      encoder         : Lavc56.47.100 mpeg4
    Stream #0:1, 0, 4/125: Audio: ac3 ([0] [0][0] / 0x2000), 48000 Hz,
stereo, fltp, 192 kb/s
    Metadata:
      encoder         : Lavc56.47.100 ac3
Stream mapping:
  Stream #1:0 -> #0:0 (rawvideo (native) -> mpeg4 (native))
  Stream #0:0 -> #0:1 (pcm_s16le (native) -> ac3 (native))
Could not write header for output file #0 (incorrect codec parameters
?): Immediate exit requested
[AVIOContext @ 0x27781e0] Statistics: 0 seeks, 1 writeouts
Exiting normally, received signal 2.

**************************************************************

 aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: SB [HDA ATI SB], device 0: ALC892 Analog [ALC892 Analog]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: SB [HDA ATI SB], device 1: ALC892 Digital [ALC892 Digital]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: NVidia [HDA NVidia], device 3: HDMI 0 [HDMI 0]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: NVidia [HDA NVidia], device 7: HDMI 1 [HDMI 1]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

arecord -l
**** List of CAPTURE Hardware Devices ****
card 0: SB [HDA ATI SB], device 0: ALC892 Analog [ALC892 Analog]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: SB [HDA ATI SB], device 2: ALC892 Alt Analog [ALC892 Alt Analog]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 2: DVC100 [DVC100], device 0: USB Audio [USB Audio]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

ls /dev/video*
/dev/video0
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

pacmd list-cards
…
index: 2
	name: <alsa_card.pci-0000_00_14.2>
	driver: <module-alsa-card.c>
…
	active profile: <output:analog-stereo+input:analog-stereo>
	sinks:
		alsa_output.pci-0000_00_14.2.analog-stereo/#0: Built-in Audio Analog
Stereo
	sources:
		alsa_output.pci-0000_00_14.2.analog-stereo.monitor/#0: Monitor of
Built-in Audio Analog Stereo
		alsa_input.pci-0000_00_14.2.analog-stereo/#1: Built-in Audio Analog Stereo
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Recording audio only works well with:

./ffmpeg -debug 1 -vn -f pulse -ar 44100 -ac 2 -channel_layout stereo -i
alsa_input.pci-0000_00_14.2.analog-stereo -ac 2 -channel_layout stereo
-c:a copy /Store3/Test/copy_`date +%m%d_%H%M`.wav

Moreover with alsa, this command was working few months ago and not
working now :
./ffmpeg -f alsa -i hw:0,0 -f v4l2 -channel 1 -i /dev/video0 -map 0:0
-map 1:0 -c:v ffvhuff /Store3/Test/test_`date +%Y%m%d_%H%M`.avi

Is there a mistake in the audio/video command line or is there something
else ?

Many thanks


More information about the ffmpeg-user mailing list