[FFmpeg-trac] #2410(avdevice:open): ffmpeg down with video4linux2.

FFmpeg trac at avcodec.org
Fri Mar 29 13:27:14 CET 2013


#2410: ffmpeg down with video4linux2.
------------------------------------+------------------------------------
             Reporter:  dinhka      |                    Owner:
                 Type:  defect      |                   Status:  open
             Priority:  normal      |                Component:  avdevice
              Version:  git-master  |               Resolution:
             Keywords:  v4l2        |               Blocked By:
             Blocking:              |  Reproduced by developer:  0
Analyzed by developer:  0           |
------------------------------------+------------------------------------

Comment (by dinhka):

 Replying to [comment:18 cehoyos]:

 Hi,

   I have a test case then ffmpeg work with stk1160 driver.

 1. reboot my pc
    the stk1160 driver inits ok:

    usb 2-2: New device Syntek Semiconductor USB 2.0 Video Capture
 Controller @ 480 Mbps (05e1:0408, interface 0, class 0)
 usb 2-2: video interface 0 found
 stk1160: driver ver 0.9.4 successfully loaded
 stk1160: registers to NTSC like standard
 AC'97 0 access is not valid [0x0], removing mixer.
 stk1160 2-2:1.0: V4L2 device registered as video0
 usbcore: registered new interface driver stk1160
 usbcore: registered new interface driver snd-usb-audio

 2. run command
    ffmpeg -f video4linux2 -pix_fmt yuv420p -i /dev/video0 -f alsa -ar
 22050 -ac 2 -acodec pcm_s16le -i hw:1 -vcodec mpeg4 -vtag DX50 -b 1200k -r
 25 -acodec libmp3lame -ar 44100 -ac 2 -ab 128k -y test.avi

 bug as:
 [video4linux2,v4l2 @ 0x964f400] The V4L2 driver changed the video from
 720x576 to 720x480
 [video4linux2,v4l2 @ 0x964f400] ioctl(VIDIOC_G_PARM): Inappropriate ioctl
 for device
 /dev/video0: Inappropriate ioctl for device

 3. I run next commandline

     mencoder tv:// -tv
 driver=v4l2:width=720:height=576:norm=PAL:outfmt=uyvy:device=/dev/video0:input=0:fps=25
 -o test.mp4
 MEncoder SVN-r31628-4.4.6 (C) 2000-2010 MPlayer Team

 WARNING: OUTPUT FILE FORMAT IS _AVI_. See -of help.
 success: format: 9  data: 0x0 - 0x0
 TV file format detected.
 Selected driver: v4l2
  name: Video 4 Linux 2 input
  author: Martin Olschewski <olschewski at zpr.uni-koeln.de>
  comment: first try, more to come ;-)
 Selected device: stk1160
  Capabilites:  video capture  read/write  streaming
  supported norms: 0 = NTSC; 1 = NTSC-M; 2 = NTSC-M-JP; 3 = NTSC-M-KR; 4 =
 NTSC-443; 5 = PAL; 6 = PAL-BG; 7 = PAL-H; 8 = PAL-I; 9 = PAL-DK; 10 =
 PAL-M; 11 = PAL-N; 12 = PAL-Nc; 13 = PAL-60; 14 = SECAM; 15 = SECAM-B; 16
 = SECAM-G; 17 = SECAM-H; 18 = SECAM-DK; 19 = SECAM-L; 20 = SECAM-Lc;
  inputs: 0 = Composite0; 1 = Composite1; 2 = Composite2; 3 = Composite3;
  Current input: 0
  Current format: UYVY
 Selected input hasn't got a tuner!
 Unable to open '/dev/dsp': No such file or directory
 v4l2: ioctl set mute failed: Invalid argument
 v4l2: 0 frames successfully processed, 0 frames dropped.
 ============ Sorry, this file format is not recognized/supported
 =============
 === If this file is an AVI, ASF or MPEG stream, please contact the author!
 ===
 Cannot open demuxer.

 Exiting...

 4. then I run again the commandline in step 2, ffmpeg work with stk1160
 driver.

    ffmpeg -loglevel 99 -f video4linux2  -i /dev/video0  -vcodec mpeg4 -b
 1200k -y test.avi
 ffmpeg version N-51426-gdd17843 Copyright (c) 2000-2013 the FFmpeg
 developers
   built on Mar 29 2013 00:22:28 with gcc 4.4.7 (GCC) 20120313 (Red Hat
 4.4.7-3)
   configuration: --enable-version3 --enable-libopencore-amrnb --enable-
 libopencore-amrwb --enable-avfilter --enable-nonfree --enable-libmp3lame
 --enable-gpl --enable-libfaac --enable-libx264 --enable-pthreads
 --disable-stripping --enable-libass --extra-cflags=-I/usr/local/include
 --disable-debug
   libavutil      52. 22.101 / 52. 22.101
   libavcodec     55.  2.100 / 55.  2.100
   libavformat    55.  0.100 / 55.  0.100
   libavdevice    55.  0.100 / 55.  0.100
   libavfilter     3. 48.105 /  3. 48.105
   libswscale      2.  2.100 /  2.  2.100
   libswresample   0. 17.102 /  0. 17.102
   libpostproc    52.  2.100 / 52.  2.100
 Splitting the commandline.
 Reading option '-loglevel' ... matched as option 'loglevel' (set libav*
 logging level) with argument '99'.
 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 '-vcodec' ... matched as option 'vcodec' (force video codec
 ('copy' to copy stream)) with argument 'mpeg4'.
 Reading option '-b' ... matched as option 'b' (video bitrate (please use
 -b:v)) with argument '1200k'.
 Reading option '-y' ... matched as option 'y' (overwrite output files)
 with argument '1'.
 Reading option 'test.avi' ... matched as output file.
 Finished splitting the commandline.
 Parsing a group of options: global .
 Applying option loglevel (set libav* logging level) with argument 99.
 Applying option y (overwrite output files) with argument 1.
 Successfully parsed a group of options.
 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 @ 0x9df4440] fd:3 capabilities:5000001
 [video4linux2,v4l2 @ 0x9df4440] Current input_channel: 0, input_name:
 Composite0
 [video4linux2,v4l2 @ 0x9df4440] Querying the device for the current frame
 size
 [video4linux2,v4l2 @ 0x9df4440] Setting frame size to 720x576
 [video4linux2,v4l2 @ 0x9df4440] Trying to set codec:rawvideo
 pix_fmt:yuv420p
     Last message repeated 1 times
 [video4linux2,v4l2 @ 0x9df4440] Trying to set codec:rawvideo
 pix_fmt:yuv422p
 [video4linux2,v4l2 @ 0x9df4440] Trying to set codec:rawvideo
 pix_fmt:yuyv422
 [video4linux2,v4l2 @ 0x9df4440] Trying to set codec:rawvideo
 pix_fmt:uyvy422
 [video4linux2,v4l2 @ 0x9df4440] The V4L2 driver is using the interlaced
 mode
 [video4linux2,v4l2 @ 0x9df4440] Current standard: PAL, id: 255,
 frameperiod: 1/25
 [video4linux2,v4l2 @ 0x9df4440] All info found
 [video4linux2,v4l2 @ 0x9df4440] Estimating duration from bitrate, this may
 be inaccurate
 Input #0, video4linux2,v4l2, from '/dev/video0':
   Duration: N/A, start: 1364559870.645412, bitrate: 165888 kb/s
     Stream #0:0, 1, 1/1000000: Video: rawvideo (UYVY / 0x59565955),
 uyvy422, 720x576, 1/1000000, 165888 kb/s, 25 fps, 25 tbr, 1000k tbn, 1000k
 tbc
 Successfully opened the file.
 Parsing a group of options: output file test.avi.
 Applying option vcodec (force video codec ('copy' to copy stream)) with
 argument mpeg4.
 Applying option b (video bitrate (please use -b:v)) with argument 1200k.
 Please use -b:a or -b:v, -b is ambiguous
 Successfully parsed a group of options.
 Opening an output file: test.avi.
 Successfully opened the file.
 [buffer @ 0x9de3380] Setting entry with key 'video_size' to value
 '720x576'
 [buffer @ 0x9de3380] Setting entry with key 'pix_fmt' to value '17'
 [buffer @ 0x9de3380] Setting entry with key 'time_base' to value
 '1/1000000'
 [buffer @ 0x9de3380] Setting entry with key 'pixel_aspect' to value '0/1'
 [buffer @ 0x9de3380] Setting entry with key 'sws_param' to value 'flags=2'
 [buffer @ 0x9de3380] Setting entry with key 'frame_rate' to value '25/1'
 [graph 0 input from stream 0:0 @ 0x9df5840] w:720 h:576 pixfmt:uyvy422
 tb:1/1000000 fr:25/1 sar:0/1 sws_param:flags=2
 [scale @ 0x9de3a20] Setting 'w' to value '0'
 [scale @ 0x9de3a20] Setting 'h' to value '0'
 [scale @ 0x9de3a20] Setting 'flags' to value '0x4'
 [auto-inserted scaler 0 @ 0x9de3960] w:0 h:0 flags:'0x4' interl:0
 [format @ 0x9de34c0] auto-inserting filter 'auto-inserted scaler 0'
 between the filter 'Parsed_null_0' and the filter 'format'
 [AVFilterGraph @ 0x9dee6e0] query_formats: 4 queried, 3 merged, 1 already
 done, 0 delayed
 [auto-inserted scaler 0 @ 0x9de3960] w:720 h:576 fmt:uyvy422 sar:0/1 ->
 w:720 h:576 fmt:yuv420p sar:0/1 flags:0x4
 [mpeg4 @ 0x9df6160] detected 2 logical cores
 [mpeg4 @ 0x9df6160] intra_quant_bias = 0 inter_quant_bias = -64
 Output #0, avi, to 'test.avi':
   Metadata:
     ISFT            : Lavf55.0.100
     Stream #0:0, 0, 1/25: Video: mpeg4 (FMP4 / 0x34504D46), yuv420p,
 720x576, 1/25, q=2-31, 1200 kb/s, 25 tbn, 25 tbc
 Stream mapping:
   Stream #0:0 -> #0:0 (rawvideo -> mpeg4)
 Press [q] to stop, [?] for help
 frame=   13 fps=0.0 q=2.0 size=     212kB time=00:00:00.52
 bitrate=3332.2kbits/sframe=   26 fps= 26 q=4.5 size=     322kB
 time=00:00:01.04 bitrate=2535.7kbits/sframe=   39 fps= 26 q=5.7 size=
 416kB time=00:00:01.56 bitrate=2182.1kbits/sframe=   51 fps= 25 q=4.7
 size=     502kB time=00:00:02.04 bitrate=2015.2kbits/sframe=   57 fps= 25
 q=4.3 Lsize=     523kB time=00:00:02.28 bitrate=1879.2kbits/s


 So I think ffmpeg or stk1160 driver has init wrong. After I set
 driver=v4l2:width=720:height=576:norm=PAL:outfmt=uyvy

   then it worked.

 Best regards.

-- 
Ticket URL: <https://ffmpeg.org/trac/ffmpeg/ticket/2410#comment:19>
FFmpeg <http://ffmpeg.org>
FFmpeg issue tracker


More information about the FFmpeg-trac mailing list