amiaopensource / vrecord

Vrecord is open-source software for capturing a video signal and turning it into a digital file.
https://github.com/amiaopensource/vrecord
149 stars 45 forks source link

audio passthru legend issue #469

Closed bturkus closed 4 years ago

bturkus commented 4 years ago

not sure what i'm missing, but after upgrading stuff I lost audio passthru mode. Getting this message:

MY-LPAMI-056430:~ benjaminturkus$ vrecord -a
Playing: -
[file] Reading from stdin...
[ffmpeg] Parsed_showspectrum_6: Option 'legend' not found
[ffmpeg] AVFilterGraph: Error initializing filter 'showspectrum' with args 's=535x672:color=rainbow:legend=1'
[lavfi] parsing the filter graph failed

Exiting... (Errors when loading file)

on ffmpeg 4.2.1 and mpv 0.29.1 (just installed from cask). is this related to general brew/mpv stuff?

dericed commented 4 years ago

What is your output of /usr/local/opt/ffmpegdecklink/bin/ffmpeg-dl -h filter=showspectrum

bturkus commented 4 years ago
MY-LPAMI-056430:~ benjaminturkus$ /usr/local/opt/ffmpegdecklink/bin/ffmpeg-dl -h filter=showspectrum
ffmpeg version 4.2.1 Copyright (c) 2000-2019 the FFmpeg developers
  built with Apple LLVM version 10.0.1 (clang-1001.0.46.4)
  configuration: --prefix=/usr/local/Cellar/ffmpegdecklink/4.2.1 --disable-shared --enable-version3 --cc=clang --host-cflags= --host-ldflags= --enable-gpl --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libsnappy --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-libxvid --enable-opencl --enable-videotoolbox --enable-libopenjpeg --disable-decoder=jpeg2000 --extra-cflags=-I/usr/local/Cellar/openjpeg/2.3.1/include/openjpeg-2.3 --enable-nonfree --enable-decklink --extra-cflags=-I/usr/local/include --extra-ldflags=-L/usr/local/include
  libavutil      56. 31.100 / 56. 31.100
  libavcodec     58. 54.100 / 58. 54.100
  libavformat    58. 29.100 / 58. 29.100
  libavdevice    58.  8.100 / 58.  8.100
  libavfilter     7. 57.100 /  7. 57.100
  libswscale      5.  5.100 /  5.  5.100
  libswresample   3.  5.100 /  3.  5.100
  libpostproc    55.  5.100 / 55.  5.100
Filter showspectrum
  Convert input audio to a spectrum video output.
    slice threading supported
    Inputs:
       #0: default (audio)
    Outputs:
       #0: default (video)
showspectrum AVOptions:
  size              <image_size> ..FV..... set video size (default "640x512")
  s                 <image_size> ..FV..... set video size (default "640x512")
  slide             <int>        ..FV..... set sliding mode (from 0 to 3) (default replace)
     replace                      ..FV..... replace old columns with new
     scroll                       ..FV..... scroll from right to left
     fullframe                    ..FV..... return full frames
     rscroll                      ..FV..... scroll from left to right
  mode              <int>        ..FV..... set channel display mode (from 0 to 1) (default combined)
     combined                     ..FV..... combined mode
     separate                     ..FV..... separate mode
  color             <int>        ..FV..... set channel coloring (from 0 to 14) (default channel)
     channel                      ..FV..... separate color for each channel
     intensity                    ..FV..... intensity based coloring
     rainbow                      ..FV..... rainbow based coloring
     moreland                     ..FV..... moreland based coloring
     nebulae                      ..FV..... nebulae based coloring
     fire                         ..FV..... fire based coloring
     fiery                        ..FV..... fiery based coloring
     fruit                        ..FV..... fruit based coloring
     cool                         ..FV..... cool based coloring
     magma                        ..FV..... magma based coloring
     green                        ..FV..... green based coloring
     viridis                      ..FV..... viridis based coloring
     plasma                       ..FV..... plasma based coloring
     cividis                      ..FV..... cividis based coloring
     terrain                      ..FV..... terrain based coloring
  scale             <int>        ..FV..... set display scale (from 0 to 5) (default sqrt)
     lin                          ..FV..... linear
     sqrt                         ..FV..... square root
     cbrt                         ..FV..... cubic root
     log                          ..FV..... logarithmic
     4thrt                        ..FV..... 4th root
     5thrt                        ..FV..... 5th root
  fscale            <int>        ..FV..... set frequency scale (from 0 to 1) (default lin)
     lin                          ..FV..... linear
     log                          ..FV..... logarithmic
  saturation        <float>      ..FV..... color saturation multiplier (from -10 to 10) (default 1)
  win_func          <int>        ..FV..... set window function (from 0 to 19) (default hann)
     rect                         ..FV..... Rectangular
     bartlett                     ..FV..... Bartlett
     hann                         ..FV..... Hann
     hanning                      ..FV..... Hanning
     hamming                      ..FV..... Hamming
     blackman                     ..FV..... Blackman
     welch                        ..FV..... Welch
     flattop                      ..FV..... Flat-top
     bharris                      ..FV..... Blackman-Harris
     bnuttall                     ..FV..... Blackman-Nuttall
     bhann                        ..FV..... Bartlett-Hann
     sine                         ..FV..... Sine
     nuttall                      ..FV..... Nuttall
     lanczos                      ..FV..... Lanczos
     gauss                        ..FV..... Gauss
     tukey                        ..FV..... Tukey
     dolph                        ..FV..... Dolph-Chebyshev
     cauchy                       ..FV..... Cauchy
     parzen                       ..FV..... Parzen
     poisson                      ..FV..... Poisson
     bohman                       ..FV..... Bohman
  orientation       <int>        ..FV..... set orientation (from 0 to 1) (default vertical)
     vertical                     ..FV.....
     horizontal                   ..FV.....
  overlap           <float>      ..FV..... set window overlap (from 0 to 1) (default 0)
  gain              <float>      ..FV..... set scale gain (from 0 to 128) (default 1)
  data              <int>        ..FV..... set data mode (from 0 to 1) (default magnitude)
     magnitude                    ..FV.....
     phase                        ..FV.....
  rotation          <float>      ..FV..... color rotation (from -1 to 1) (default 0)
  start             <int>        ..FV..... start frequency (from 0 to INT_MAX) (default 0)
  stop              <int>        ..FV..... stop frequency (from 0 to INT_MAX) (default 0)
  fps               <string>     ..FV..... set video rate (default "auto")
  legend            <boolean>    ..FV..... draw legend (default false)

MY-LPAMI-056430:~ benjaminturkus$ 
dericed commented 4 years ago

I forgot that this filter is sent to mpv and not ffmpeg. I confirm that mpv file.mkv -lavfi-complex "[aid1]showspectrum=color=rainbow[vo]" works, mpv file.mkv -lavfi-complex "[aid1]showspectrum=color=rainbow:legend=1[vo]" doesn't work.

@bmahol, is this expected? I see legend is still in ffmpeg,libavfilter but seems to have been dropped in mpv.

privatezero commented 4 years ago

I note that @retokromer's original PR to update the vrecord homebrew formula noted that it contained an embedded FFmpeg 4.0.2. If memory serves me correctly then yes, the legend option was added in a later version, so yes this would be because of the switch to the cask formula for mpv :/

dericed commented 4 years ago

Blerg, any reason to use the cask version rather than the last non-cask installer at https://raw.githubusercontent.com/Homebrew/homebrew-core/03ac5ca999877ff8e522a354aaeb246815f715b5/Formula/mpv.rb?

dericed commented 4 years ago

I started adding the non-cask version to the amiaos tap via https://github.com/amiaopensource/homebrew-amiaos/tree/non-cask-mpv.

retokromer commented 4 years ago

The last non-cask Homebrew formula is not compatible with the current FFmpeg (see https://github.com/amiaopensource/vrecord/issues/468#issuecomment-536383174).

dericed commented 4 years ago

@retokromer, we could address that in a tap's formula and use the needed ffmpeg as a build dependency

retokromer commented 4 years ago

@dericed Yep, that was my intention. There are already a few examples around (which can be used at least as inspiration), because many have the same problem.

privatezero commented 4 years ago

@bturkus has reinstalling with the amia-os fork of MPV helped this?

digitensions commented 4 years ago

Hi, I'm having this same issue. I'll try the aria-os fork and see if it repairs here.

digitensions commented 4 years ago

Hi, I looked at the amia-os fork and I haven't the skills to install it I'm afraid. I saw your notes @privatezero / @reto about Xcode and I installed 10.1, (I'm on MacSO 10.13.6), uninstalled mpv, reinstalled linked and reinstalled vrecord. I also had intermittent failure of passthrough mode not loading from GUI, but always loading fine from command line. This is fixed, but the audio is still not working. I am now getting:

Pad aid1 is not connected to anything. Exiting... (Errors when loading file)

I'll post all the output in case you need it. Apologies for jumping in on this thread, but hope this is helpful.

Many thanks!

mace-mac-pro-1:~ MACE2$ vrecord -g [avfoundation @ 0x7fe33b01fe00] Selected framerate (29.970030) is not supported by the device. [avfoundation @ 0x7fe33b01fe00] Falling back to default. [avfoundation @ 0x7fe33b01fe00] Selected pixel format (yuv420p) is not supported by the input device. [avfoundation @ 0x7fe33b01fe00] Supported pixel formats: [avfoundation @ 0x7fe33b01fe00] uyvy422 [avfoundation @ 0x7fe33b01fe00] yuyv422 [avfoundation @ 0x7fe33b01fe00] nv12 [avfoundation @ 0x7fe33b01fe00] 0rgb [avfoundation @ 0x7fe33b01fe00] bgr0 [avfoundation @ 0x7fe33b01fe00] Overriding selected pixel format to use uyvy422 instead. Input #0, avfoundation, from 'DV-VCR': vq= 0KB sq= 0B f=0/0
Duration: N/A, start: 0.040000, bitrate: N/A Stream #0:0: Video: dvvideo, yuv420p, 720x576 [SAR 64:45 DAR 16:9], 25 tbr, 1000k tbn, 25 tbc 7.23 M-V: 0.000 fd= 0 aq= 0KB vq= 0KB sq= 0B f=0/0
Variables set: DEVICE_INPUT_CHOICE = 1 AVF_INPUT_CHOICE = DV-VCR DIR = /Users/MACE2/Desktop LOGDIR = /Users/MACE2/Desktop CONTAINER_CHOICE = Matroska VIDEO_INPUT_CHOICE = SDI AUDIO_INPUT_CHOICE = SDI Embedded Audio VIDEO_CODEC_CHOICE = FFV1 version 3 FFV1_SLICE_CHOICE = 24 AUDIO_CODEC_CHOICE = 24-bit PCM VIDEO_BIT_DEPTH_CHOICE = 10 bit AUDIO_MAPPING_CHOICE = 1 Stereo Track (From Channels 1 & 2) TIMECODE_CHOICE = vitc STANDARD_CHOICE = PAL QCTOOLSXML_CHOICE = Yes, concurrent with recording FRAMEMD5_CHOICE = Yes EMBED_LOGS_CHOICE = Yes PLAYBACKVIEW_CHOICE = Broadcast Range Visual PLAYBACKVIEW_CHOICE_PASS = Broadcast Range Visual DURATION = TECHNICIAN = PREFIX = USER_SUFFIX = NO_SUFFIX = false

[avfoundation @ 0x7fe35b824400] Selected framerate (29.970030) is not supported by the device. [avfoundation @ 0x7fe35b824400] Falling back to default. [avfoundation @ 0x7fe35b824400] Selected pixel format (yuv420p) is not supported by the input device. [avfoundation @ 0x7fe35b824400] Supported pixel formats: [avfoundation @ 0x7fe35b824400] uyvy422 [avfoundation @ 0x7fe35b824400] yuyv422 [avfoundation @ 0x7fe35b824400] nv12 [avfoundation @ 0x7fe35b824400] 0rgb [avfoundation @ 0x7fe35b824400] bgr0 [avfoundation @ 0x7fe35b824400] Overriding selected pixel format to use uyvy422 instead. Input #0, avfoundation, from 'DV-VCR': vq= 0KB sq= 0B f=0/0
Duration: N/A, start: 0.040000, bitrate: N/A Stream #0:0: Video: dvvideo, yuv420p, 720x576 [SAR 16:15 DAR 4:3], 25 tbr, 1000k tbn, 25 tbc 6.12 M-V: 0.000 fd= 0 aq= 0KB vq= 0KB sq= 0B f=0/0
[file] Reading from stdin... Pad aid1 is not connected to anything.

Exiting... (Errors when loading file)

privatezero commented 4 years ago

Hi @digitensions thanks for reporting this! Just as a question, does this happen when capturing from an analog source or just DV? Also, is there a similar problem when you use Quality Control view? (The other view mode that relies on MPV)

digitensions commented 4 years ago

I’ll try both for you tomorrow and let you know. Cheers, Joanna

On 19 Nov 2019, at 19:36, Andrew Weaver notifications@github.com wrote:

Hi @digitensions thanks for reporting this! Just as a question, does this happen when capturing from an analog source or just DV? Also, is there a similar problem when you use Quality Control view? (The other view mode that relies on MPV)

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.

privatezero commented 4 years ago

Thanks Joanna!

bturkus commented 4 years ago

analog capture working for me now, but I am getting this message in terminal:

/Users/benjaminturkus/.config/mpv/mpv.conf:1: unparseable extra characters: '{\rtf1\ansi\ansicpg1252\cocoartf1671\cocoasubrtf600'
/Users/benjaminturkus/.config/mpv/mpv.conf:2: unparseable extra characters: '{\fonttbl}'
/Users/benjaminturkus/.config/mpv/mpv.conf:3: unparseable extra characters: '{\colortbl;\red255\green255\blue255;}'
/Users/benjaminturkus/.config/mpv/mpv.conf:4: unparseable extra characters: '{\*\expandedcolortbl;;}'
/Users/benjaminturkus/.config/mpv/mpv.conf:5: unparseable extra characters: '\margl1440\margr1440\vieww10800\viewh8400\viewkind0'
/Users/benjaminturkus/.config/mpv/mpv.conf:6: unparseable extra characters: '}'

possibly something that's only affecting me, but wanted to pass along. thanks for the fix!!

privatezero commented 4 years ago

thanks @bturkus! Is that for both of the modes (audio passthrough and QC View) that use mpv?

retokromer commented 4 years ago

'{\rtf1\ansi\ansicpg1252\cocoartf1671\cocoasubrtf600' '{\fonttbl}' '{\colortbl;\red255\green255\blue255;}' '{*\expandedcolortbl;;}' '\margl1440\margr1440\vieww10800\viewh8400\viewkind0' '}'

That’s an RTF document.

@bturkus Could you possibly post the result of:

cat /Users/benjaminturkus/.config/mpv/mpv.conf
bturkus commented 4 years ago

I'm only seeing that in audio passthrough mode; regular qc view is message-less. And I should clarify: audio passthrough seems to be working fine in analog, despite the message.

with dv, no such luck. capture abouts in audio passthrough, with this message:

/Users/benjaminturkus/.config/mpv/mpv.conf:1: unparseable extra characters: '{\rtf1\ansi\ansicpg1252\cocoartf1671\cocoasubrtf600'
/Users/benjaminturkus/.config/mpv/mpv.conf:2: unparseable extra characters: '{\fonttbl}'
/Users/benjaminturkus/.config/mpv/mpv.conf:3: unparseable extra characters: '{\colortbl;\red255\green255\blue255;}'
/Users/benjaminturkus/.config/mpv/mpv.conf:4: unparseable extra characters: '{\*\expandedcolortbl;;}'
/Users/benjaminturkus/.config/mpv/mpv.conf:5: unparseable extra characters: '\margl1440\margr1440\vieww10800\viewh8400\viewkind0'
/Users/benjaminturkus/.config/mpv/mpv.conf:6: unparseable extra characters: '}'
[file] Reading from stdin...
Pad aid1 is not connected to anything.

Exiting... (Errors when loading file)

i'm guessing the first part (the rtf) isn't relevant, but the stdin pad aid maybe so..

retokromer commented 4 years ago

Thank you, @bturkus! I’m wondering why the hell a more or less empty RTF file is stored inside .config/mpv/

privatezero commented 4 years ago

for the aid1 error, that is the kind of error mpv will throw when you try to run a file that doesn't have that particular stream in it, so it looks to me like for whatever reason it might not be recognizing the audio in the DV data stream coming at it for the purposes of the filter.

For the mpv.conf problem, I suppose it might be somehow related to this: https://github.com/amiaopensource/vrecord/blob/master/vrecord#L625, which was originally added back in the day to try to get the mpv window close key to mimic the ffplay window close key that was already in use in vrecord. Not sure why it would end up as rtf though...

digitensions commented 4 years ago

Morning, so today the Audio Passthrough, Passthrough (BRV and QCV) worked fine with non-DV files in Decklink panel. Right now I'm running both DV and Decklink feeds and trying to switch between the two but passthrough will only launch the Decklink feed, instead of failing which makes me think passthrough GUI button is only looking for the Decklink feed, but the CLI vrecord -g will respond to the Edited settings(?). I'm able to launch passthrough for DV still from command line. vrecord -a is getting this error still:

file] Reading from stdin... Pad aid1 is not connected to anything.

Exiting... (Errors when loading file)

dericed commented 4 years ago

How the DV data passes along is a bit exception. FFmpeg sees the input as a single stream (of dv) and categorizes it as video. So an ffmpeg -i on the avfoundation input has no audio. The audio is still multiplexed within the dv stream. To get audio in the input we'd have to do something like:

ffmpeg -f avfoundation -otheroptionshere -i "${DVFILE}" -c:v copy -f rawvideo - | ffmpeg -i - ...
privatezero commented 4 years ago

Hi @digitensions - have a change at https://github.com/amiaopensource/vrecord/pull/478 that seems to fix this on my end. If you try that branch out, let me know if it fixes this for ya!

digitensions commented 4 years ago

Good morning, thanks so much @privatezero.

We now have GUI passthrough for both DV and Decklink feed, but to switch between we need to relaunch the software, which isn't a big deal. I've picked up another issue - DV audio check is still a no-go, but after attempting to view DV audio check I can't relaunch the DV passthrough without rebooting the software. Terminal outputs for this below. We're running the #478 amended version of vrecord here now - so if anything else crops up my colleague @alexhabgood may chime in and update you. I'm leaving MACE at the end of this week, so happy to run any more tests you need up until then... Many thanks! Really glad to have a workaround for our technician :)

Audio Check break:

[avfoundation @ 0x7fa407814a00] Selected framerate (29.970030) is not supported by the device. [avfoundation @ 0x7fa407814a00] Falling back to default. [avfoundation @ 0x7fa407814a00] Selected pixel format (yuv420p) is not supported by the input device. [avfoundation @ 0x7fa407814a00] Supported pixel formats: [avfoundation @ 0x7fa407814a00] uyvy422 [avfoundation @ 0x7fa407814a00] yuyv422 [avfoundation @ 0x7fa407814a00] nv12 [avfoundation @ 0x7fa407814a00] 0rgb [avfoundation @ 0x7fa407814a00] bgr0 [avfoundation @ 0x7fa407814a00] Overriding selected pixel format to use uyvy422 instead. Input #0, avfoundation, from 'DV-VCR': vq= 0KB sq= 0B f=0/0
Duration: N/A, start: 0.040000, bitrate: N/A Stream #0:0: Video: dvvideo, yuv420p, 720x576 [SAR 16:15 DAR 4:3], 25 tbr, 1000k tbn, 25 tbc 3.72 M-V: 0.000 fd= 0 aq= 0KB vq= 0KB sq= 0B f=0/0
/usr/local/bin/vrecord: line 629: : command not found [avfoundation @ 0x7fb355000e00] Selected framerate (29.970030) is not supported by the device. [avfoundation @ 0x7fb355000e00] Falling back to default. [avfoundation @ 0x7fb355000e00] Selected pixel format (yuv420p) is not supported by the input device. [avfoundation @ 0x7fb355000e00] Supported pixel formats: [avfoundation @ 0x7fb355000e00] uyvy422 [avfoundation @ 0x7fb355000e00] yuyv422 [avfoundation @ 0x7fb355000e00] nv12 [avfoundation @ 0x7fb355000e00] 0rgb [avfoundation @ 0x7fb355000e00] bgr0 [avfoundation @ 0x7fb355000e00] Overriding selected pixel format to use uyvy422 instead. Input #0, avfoundation, from 'DV-VCR': Duration: N/A, start: 0.120000, bitrate: N/A Stream #0:0: Video: dvvideo, yuv420p, 720x576 [SAR 16:15 DAR 4:3], 25 tbr, 1000k tbn, 25 tbc Output #0, rawvideo, to 'pipe:': Metadata: encoder : Lavf58.29.100 Stream #0:0: Video: dvvideo, yuv420p, 720x576 [SAR 16:15 DAR 4:3], q=2-31, 25 tbr, 25 tbn, 25 tbc Stream mapping: Stream #0:0 -> #0:0 (copy) av_interleaved_write_frame(): Broken pipe Error writing trailer of pipe:: Broken pipe frame= 17 fps=0.0 q=-1.0 Lsize= 2250kB time=00:00:00.68 bitrate=27105.9kbits/s speed=1.13x
video:2391kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown Conversion failed! [file] Reading from stdin...

Exiting... (Quit) [avfoundation @ 0x7ff042003c00] Selected framerate (29.970030) is not supported by the device. [avfoundation @ 0x7ff042003c00] Falling back to default. [avfoundation @ 0x7ff042003c00] Selected pixel format (yuv420p) is not supported by the input device. [avfoundation @ 0x7ff042003c00] Supported pixel formats: [avfoundation @ 0x7ff042003c00] uyvy422 [avfoundation @ 0x7ff042003c00] yuyv422 [avfoundation @ 0x7ff042003c00] nv12 [avfoundation @ 0x7ff042003c00] 0rgb [avfoundation @ 0x7ff042003c00] bgr0 [avfoundation @ 0x7ff042003c00] Overriding selected pixel format to use uyvy422 instead. Input #0, avfoundation, from 'DV-VCR': vq= 0KB sq= 0B f=0/0
Duration: N/A, start: 0.040000, bitrate: N/A Stream #0:0: Video: dvvideo, yuv420p, 720x576 [SAR 16:15 DAR 4:3], 25 tbr, 1000k tbn, 25 tbc Input pad "default" with type audio of the filter instance "Parsed_asplit_0" of asplit not connected to any source

bturkus commented 4 years ago

hey @privatezero I just testes audio passthrough for dv, and it seems to be working (it doesn't improve the quality of the playback, but what can you do?).

mpv-shot0005

could the same logic be used to pipe audio through for regular passthrough mode?

privatezero commented 4 years ago

Thanks for the testing @digitensions and @bturkus!! I haven't been able to reproduce some of the other problems reported in this issue - but I'll poke at it all again when i have a minute and see if I can figure out what is triggering them.

That logic could totally be applied to regular passthrough, but I was hesitant to add it as part of this PR without more testing. The extra layer of FFmpeg in the chain does slow things down a tad on my end, which concerned me for passthrough. (Since audiopassthrough is never used for actual capture I'm not as worried about the potential for changes to cause dropped frames/buffer overruns etc, but if a change in normal passthrough borked the system it could impact actual archival captures).

privatezero commented 4 years ago

Since this issue mostly related to MPV in audiopassthrough, and that has since been switched to ffplay gonna close this