amiaopensource / vrecord

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

Audio for Vrecord #43

Closed filmarc closed 8 years ago

filmarc commented 8 years ago

Would it be possible to add audio monitoring to Vrecord using waveforms or levels or spectograms? Thanks,

Hannah

privatezero commented 8 years ago

Hi Hannah! I experimented a bit today with the showvolume filter, and have a bit of a quick and dirty modification that allows you to visualize the audio in a new window after you close the playback mode window. I just added the following to the end of the passthrough area:

 
&&
    bmdcapture -m ${standard} -V "${video_input}" -A "${audio_input}" -c 8 -s 32 -p "${video_bitdepth}" -F nut -f pipe:1 | \
    ffplay -f lavfi "amovie='pipe:0',asplit[a][b];[a]showvolume[out0]; [b]anull[out1]" 
This would potentially help with setup, but doesn't allow monitoring during capture. Would this help for the time being Hannah?
filmarc commented 8 years ago

Any kind of monitoring, whether during setup or actual recording will be helpful. Thank you!

Hannah


From: Andrew Weaver notifications@github.com Sent: Tuesday, February 02, 2016 4:07 PM To: amiaopensource/vrecord Cc: Special Coll Film Archive Subject: Re: [vrecord] Audio for Vrecord (#43)

Hi Hannah! I experimented a bit today with the showvolume filter, and have a bit of a quick and dirty modification that allows you to visualize the audio in a new window after you close the playback mode window. I just added the following to the end of the passthrough area:

&&

bmdcapture -m ${standard} -V "${video_input}" -A "${audio_input}" -c 8 -s 32 -p "${video_bitdepth}" -F nut -f pipe:1 | \

ffplay -f lavfi "amovie='pipe:0',asplit[a][b];[a]showvolume[out0]; [b]anull[out1]"

This would potentially help with setup, but doesn't allow monitoring during capture. Would this help for the time being Hannah?

Reply to this email directly or view it on GitHubhttps://github.com/amiaopensource/vrecord/issues/43#issuecomment-178899885.

privatezero commented 8 years ago

I'll also mess around with the ebur128 filter and see if it looks like a good solution! This gives information about loudness, so it isn't quite the same as normal peak metering, but it might do what you need it to.

privatezero commented 8 years ago

Ok, getting closer to a solution that I like. Right now I am playing around with having the bars overlaid on the first video box. Any opinions? Bars too thick? (I have the vectorscope disabled currently because it isn't playing nicely with the new format yet- will fix). screen shot 2016-02-08 at 1 35 15 pm

filmarc commented 8 years ago

That works. Although this question came up this morning: what are the second set of waveform bars for in the lower left part of the Vrecord screen? Could that area be co-opted for sound?

From: Andrew Weaver notifications@github.com<mailto:notifications@github.com> Reply-To: amiaopensource/vrecord reply@reply.github.com<mailto:reply@reply.github.com> Date: Monday, February 8, 2016 at 2:05 PM To: amiaopensource/vrecord vrecord@noreply.github.com<mailto:vrecord@noreply.github.com> Cc: Film Archive filmarc@uw.edu<mailto:filmarc@uw.edu> Subject: Re: [vrecord] Audio for Vrecord (#43)

Ok, getting closer to a solution that I like. Right now I am playing around with having the bars overlaid on the first video box. Any opinions? Bars too thick? (I have the vectorscope disabled currently because it isn't playing nicely with the new format yet- will fix). [screen shot 2016-02-08 at 1 35 15 pm]https://cloud.githubusercontent.com/assets/12941699/12900107/78bdabb8-ce69-11e5-8ec9-7d5c720b6fa9.png

Reply to this email directly or view it on GitHubhttps://github.com/amiaopensource/vrecord/issues/43#issuecomment-181579905.

kieranjol commented 8 years ago

I believe the two waveforms represent field 1 and field 2 of a frame.

privatezero commented 8 years ago

Yes, so I figure we don't want to mess with them. We also could add blackspace to the right side and put bars over there if they are too in the way of monitoring (although I kind of like the compactness).

privatezero commented 8 years ago

Hmm, so a bit of a snag. I seem to be running up against a character limit within the lavfi device that prevents the vectorscope from being drawn. The following command will work but only draws two of the vectorscope boxes. (I am testing with an s-video in right now, so that is reflected in the bmdcapture command). For example, this seems to be the maximum length possible:

bmdcapture -m 1 -V 6 -A 1 -c 8 -s 32 -p 10 -F nut -f pipe:1 |ffplay -f lavfi "movie='pipe\:0':streams=dv+da[v][s];[s]asplit=2[x][out1];[x]showvolume=f=255:h=20[xx];[v]split=5[a][b][c][d][e];[b]field=top[b1];[c]field=bottom[c1];[b1]format=yuv422p,waveform=intensity=0.1:mode=column:mirror=1:c=1:f=lowpass:e=instant,drawbox=y=(256-16):w=iw:h=16:color=aqua@0.3:t=16,drawbox=w=iw:h=(256-235):color=crimson@0.3:t=16[b2];[c1]format=yuv422p,waveform=intensity=0.1:mode=column:mirror=1:c=1:f=lowpass:e=instant,drawbox=y=(256-16):w=iw:h=16:color=aqua@0.3:t=16,drawbox=w=iw:h=(256-235):color=crimson@0.3:t=16[c2];[b2][c2]framepack=tab,format=yuv422p[bc1];[a]pad=iw+512:ih+512[a1];[a1][bc1]overlay=0:486[abc1];[d]format=yuv422p,vectorscope=i=0.04:mode=color2:envelope=instant,vflip,scale=512:512,drawgrid=w=32:h=32:t=1:c=white@0.1,drawgrid=w=256:h=256:t=1:c=white@0.2,drawbox=w=9:h=9:t=1:x=180-3:y=512-480-5:c=red@0.6,drawbox=w=9:h=9:t=1:x=108-3:y=512-68-5:c=green@0.6[d1];[e]signalstats=out=brng,scale=512:486[e1];[abc1][d1]overlay=720:486[abcd1];[abcd1][e1]overlay=720:0[abcde1];[abcde1][xx]overlay=10:10[out0]"

Making it two characters longer like such by changing the audio output from [s] to [so]

bmdcapture -m 1 -V 6 -A 1 -c 8 -s 32 -p 10 -F nut -f pipe:1 |ffplay -f lavfi "movie='pipe\:0':streams=dv+da[v][so];[so]asplit=2[x][out1];[x]showvolume=f=255:h=20[xx];[v]split=5[a][b][c][d][e];[b]field=top[b1];[c]field=bottom[c1];[b1]format=yuv422p,waveform=intensity=0.1:mode=column:mirror=1:c=1:f=lowpass:e=instant,drawbox=y=(256-16):w=iw:h=16:color=aqua@0.3:t=16,drawbox=w=iw:h=(256-235):color=crimson@0.3:t=16[b2];[c1]format=yuv422p,waveform=intensity=0.1:mode=column:mirror=1:c=1:f=lowpass:e=instant,drawbox=y=(256-16):w=iw:h=16:color=aqua@0.3:t=16,drawbox=w=iw:h=(256-235):color=crimson@0.3:t=16[c2];[b2][c2]framepack=tab,format=yuv422p[bc1];[a]pad=iw+512:ih+512[a1];[a1][bc1]overlay=0:486[abc1];[d]format=yuv422p,vectorscope=i=0.04:mode=color2:envelope=instant,vflip,scale=512:512,drawgrid=w=32:h=32:t=1:c=white@0.1,drawgrid=w=256:h=256:t=1:c=white@0.2,drawbox=w=9:h=9:t=1:x=180-3:y=512-480-5:c=red@0.6,drawbox=w=9:h=9:t=1:x=108-3:y=512-68-5:c=green@0.6[d1];[e]signalstats=out=brng,scale=512:486[e1];[abc1][d1]overlay=720:486[abcd1];[abcd1][e1]overlay=720:0[abcde1];[abcde1][xx]overlay=10:10[out0]"

will error out because the end of the command gets clipped from [out0] to [out lavfi_error

Playing around with making commands longer confirms that the longer the filter chain, the more characters get clipped at the end. This makes it impossible to complete the vectorscope (or the Visual+Numerical view). I will keep experimenting when I have a bit of time, but does anyone have insight into a simple way to fix this that I am overlooking-or if this is an inherent limitation with the lavfi device? sad_lonely_vectorscope

dericed commented 8 years ago

I've been testing it with audio, but haven't gotten the filter to keep up with the incoming video yet. Either need to drop frames, reduce processing, or figure something out. Preview here: https://www.youtube.com/watch?v=b9XGMemAiZA

richardpl commented 8 years ago

So filter is so slow or overlaying it on top is slow?

dericed commented 8 years ago

Input is realtime but the filter is slower so it lags more and more behind input. Is there something like -re for filterchains to drop frames when needed?

richardpl commented 8 years ago

@dericed Does same happens if you use lin scale for showwaves filter? There are (a)realtime filters but they do not drop frames (yet).

The log scale in showwaves is really slow: 13 vs 85 realtime.

privatezero commented 8 years ago

Added functions for basic peak metering across four channels! Hopefully that does the trick!