Как решить проблему с зависанием ffmpeg при открытии входного файла

Я использую карту захвата для записи звука HDMI с другого устройства.

На моем хосте вывод arecord -l выглядит следующим образом:

**** List of CAPTURE Hardware Devices ****
Home directory not accessible: Permission denied
card 0: PCH [HDA Intel PCH], device 0: ALC283 Analog [ALC283 Analog]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: capture [ezcap U3 capture], device 0: USB Audio [USB Audio]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

Я использую команду:

sudo ffmpeg -f alsa -i hw:CARD=capture,DEV=0 -t 30 test.wav -loglevel debug

Когда я запускаю команду, журнал кажется чтобы заморозить при «Открытии входного файла», как показано ниже:

ffmpeg version 3.4.6-0ubuntu0.18.04.1 Copyright (c) 2000-2019 the FFmpeg developers
  built with gcc 7 (Ubuntu 7.3.0-16ubuntu3)
  configuration: --prefix=/usr --extra-version=0ubuntu0.18.04.1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --disable-stripping --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --enable-librsvg --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared
  libavutil      55. 78.100 / 55. 78.100
  libavcodec     57.107.100 / 57.107.100
  libavformat    57. 83.100 / 57. 83.100
  libavdevice    57. 10.100 / 57. 10.100
  libavfilter     6.107.100 /  6.107.100
  libavresample   3.  7.  0 /  3.  7.  0
  libswscale      4.  8.100 /  4.  8.100
  libswresample   2.  9.100 /  2.  9.100
  libpostproc    54.  7.100 / 54.  7.100
Splitting the commandline.

Reading option '-f' ... matched as option 'f' (force format) with argument 'alsa'.

Reading option '-i' ... matched as input url with argument 'hw:CARD=capture,DEV=0'.

Reading option '-t' ... matched as option 't' (record or transcode "duration" seconds of audio/video) with argument '30'.

Reading option 'test.wav' ... matched as output url.

Reading option '-loglevel' ... matched as option 'loglevel' (set logging level) with argument 'debug'.

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 url hw:CARD=capture,DEV=0.

Applying option f (force format) with argument alsa.

Successfully parsed a group of options.

Opening an input file: hw:CARD=capture,DEV=0.

Он просто застрянет там навсегда, пока я не нажму Ctrl + C, затем журнал продолжится следующим образом:

[alsa @ 0x55c9f0eee8c0] interrupted
Guessed Channel Layout for Input Stream #0.0 : stereo
Input #0, alsa, from 'hw:CARD=capture,DEV=0':
  Duration: N/A, bitrate: 1536 kb/s
    Stream #0:0, 0, 1/1000000: Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s
Successfully opened the file.
Parsing a group of options: output url test.wav.
Applying option t (record or transcode "duration" seconds of audio/video) with argument 30.
Successfully parsed a group of options.
Opening an output file: test.wav.
File 'test.wav' already exists. Overwrite ? [y/N] y
[file @ 0x55c9f0f03280] Setting default whitelist 'file,crypto'
Successfully opened the file.
Stream mapping:
  Stream #0:0 -> #0:0 (pcm_s16le (native) -> pcm_s16le (native))
Press [q] to stop, [?] for help
Finishing stream 0:0 without any data written to it.
detected 4 logical cores
[graph_0_in_0_0 @ 0x55c9f0f05dc0] Setting 'time_base' to value '1/48000'
[graph_0_in_0_0 @ 0x55c9f0f05dc0] Setting 'sample_rate' to value '48000'
[graph_0_in_0_0 @ 0x55c9f0f05dc0] Setting 'sample_fmt' to value 's16'
[graph_0_in_0_0 @ 0x55c9f0f05dc0] Setting 'channel_layout' to value '0x3'
[graph_0_in_0_0 @ 0x55c9f0f05dc0] tb:1/48000 samplefmt:s16 samplerate:48000 chlayout:0x3
[format_out_0_0 @ 0x55c9f0f060c0] Setting 'sample_fmts' to value 's16'
[AVFilterGraph @ 0x55c9f0f04be0] query_formats: 5 queried, 12 merged, 0 already done, 0 delayed
Output #0, wav, to 'test.wav':
  Metadata:
    ISFT            : Lavf57.83.100
    Stream #0:0, 0, 1/48000: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 48000 Hz, stereo, s16, 1536 kb/s
    Metadata:
      encoder         : Lavc57.107.100 pcm_s16le
size=       0kB time=00:00:00.00 bitrate=N/A speed=   0x
video:0kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
Input file #0 (hw:CARD=capture,DEV=0):
  Input stream #0:0 (audio): 0 packets read (0 bytes); 0 frames decoded (0 samples);
  Total: 0 packets (0 bytes) demuxed
Output file #0 (test.wav):
  Output stream #0:0 (audio): 0 frames encoded (0 samples); 0 packets muxed (0 bytes);
  Total: 0 packets (0 bytes) muxed
Output file is empty, nothing was encoded (check -ss / -t / -frames parameters if used)
0 frames successfully decoded, 0 decoding errors
[AVIOContext @ 0x55c9f0f033e0] Statistics: 3 seeks, 3 writeouts
Exiting normally, received signal 2.

Проблема может быть решена, если я снова отключу и снова подключу карту захвата ... но я не хочу делать это все время. Есть ли способ решить эту проблему?

1
задан 23 July 2019 в 05:43

0 ответов

Другие вопросы по тегам:

Похожие вопросы: