-
Notifications
You must be signed in to change notification settings - Fork 54
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature request or solution that I could not find natively #316
Comments
Maybe not the exact solution you are looking for, but I have an old NUC and an UltraStudio Monitor 3G that I use with UG, to loop a QT file and output via sdi -d decklink. I then put that SDI signal on the router, and switch as neccessary. |
-t file:path to file:loop -s embedded -d decklink:drift_fix -r analog |
Yeah thats what I do now, but that requires me to have another source and a router. I want to be able to have one device and while I wait for a source then I can switch. But if -t file works, then I can use the built in switcher. Just a regular QT file works? |
One thing I used to do, was have a QT file play at UG startup while waiting for incoming stream. But that only works the first time it is launched, not later on if the stream drops. ./UltraGrid.AppImage --tool uv -t file:$INSTALLDIR/splash/$SPLASHSCREEN -d $VIDEODEVICE -r $AUDIODEVICE
Yeah. |
Thanks a bunch @alatteri I will close this. I think I have enough to get the ball rolling in what I need to do. Although I can't get audio to work for some reason. Do you have a sample QT file with multiple audio channels kicking around? |
So reopening this. Looks like the file dosnt play well with the switcher. I am sure I am missing something here. |
./UltraGrid-continuous-x86_64.AppImage -t file:new.mp4 --audio-codec=MP3:sample_rate=48000:bitrate=256k --audio-capture-format channels=2 -m 1316 -P 22816 192.168.99.228 (This works without audio, havn't got there yet.) ./UltraGrid-continuous-x86_64.AppImage -t switcher -t file:new.mp4 --audio-codec=MP3:sample_rate=48000:bitrate=256k --audio-capture-format channels=2 -m 1316 -P 22816 192.168.99.228 (This crashes) vidcap_switcher_init UltraGrid has crashed (Aborted). |
Email has been sent privately with DL link to prevent data scrapers. |
Thanks a million @alatteri |
I even tried matching the formats of the content of both inputs and it still dosnt work. ./UltraGrid-continuous-x86_64.AppImage -t switcher -t decklink:0:Hi59:v210 -t file:audio_channel_test_clip_single_track_multi_channel.mov -m 1316 -P 22816 192.168.99.228 [Decklink capture] Deprecated syntax used, please use options in format "key=value" |
Just experimenting with working sources, and I am confused for sure, but wouldnt the excl_init and fallback both be an option that could run at the same time? vidcap_switcher_init When I test it, it throws an errors saying [switcher] Options "excl_init" and "fallback" are mutualy incompatible! But reading it: I am sure its me, but thats just the way I think it should work. So when I run the command above: I can get UG to start working, but the moment I switch to that source it crashes. Custom keybindings: [g] indicates that that option is guarded (Ctrl-x needs to be pressed first) |
Playing with the switcher more and I am able to get switching between test card and decklink quite well, but when not in decklink I get tons of errors on the console about dropping audio packets. I am not sure if thats the correct behavior or not? -9.04/-1.89, [10] -9.18/-1.89, [11] -9.11/-1.89, [12] -9.04/-1.89, [13] -9.38/-1.89, [14] -9.16/-1.89, [15] -9.32/-1.89 dBFS RMS/peak |
We've tried to replicate the issue with @mpiatka but unsuccessfully. Isn't it possible that this also was a temporarily broken version? Current version (066d1f4) seems to work without problems:
(and alternating by pressing '1' and '2'). |
Switching seems to work fine when using testcards, but when using the decklink as a source I get the following messages And when trying to use a file as a source to switch to and from, UG crashes as I stated above. |
Basically yes, the switcher captures from one card or another. When DeckLink is not selected, audio frames are also not captured resulting in the error (because it overflows after some time). It depends how problematic this is for you - from my point of view it is, if not intended, at least expected behavior. But I guess that it may be annoying. |
Thats fine. Just making sure thats the expected behaviour. |
When testing with audio, messages about the source show: [testcard] capture set to 1920x1080 @59.94i, codec v210, bpc 10, pattern: ebu_bars, audio off But clearly there is audio on the bars. |
Additionally, the audio on the bars is bad and when doing switching all audio is broken... I can start clean on decklink, but after the first switch it gets bad. I can DM you a link if you like so you can hear/see what I being output? ./UltraGrid-continuous-x86_64.AppImage -t switcher -t testcard:1920:1080:59.94i:v210 -t decklink:device=0 -s embedded -t testcard:1920:1080:59.94i:v210 -t testcard:1920:1080:59.94i:v210:pattern=ebu_bars -t testcard:1920:1080:59.94i:v210:pattern=smpte_bars --audio-codec=MP3:sample_rate=48000:bitrate=256k --audio-capture-format channels=16 -m 1316 -P 22816 192.168.99.228 This example crashes the moment I switch to decklink. But if I initiate decklink first I can do the switching just fine. BUT, the audio is broken on the bars. I can start clean with no audio issues on decklink if I use that as the first item, but the moment I switch to bars, all the audio get bad and even the decklink is bad. |
I found my issue, first I wasn't passing the command correctly. Lastly is it safe to assume that the switcher "as per the wiki" only allows video source switching and not audio with that source, correct?
Edit: If I place the -s embedded for the decklink audio in the chain, then it will take that audio and use it, but once I switch to the testcard as a source, the audio goes crazy. This is why I was getting confused, "assuming" that it was audio follow video, but in fact it isn't. Would be nice feature to have. Update: while testing, its seems that some audio is trying to be processed, I did a sample video to show what I see on a scope. Its hard to hear the good audio, but you can definitely hear the bad audio and the audio gets completely broken on the decoder side after the I switch to some other source. Here is the decoded video recording: https://www.dropbox.com/s/mv2omhsn9ilf025/IMG_0921.MOV?dl=0 and here is the source recording from ug: https://www.dropbox.com/s/ycvckcwo5yqmoll/content.mp4?dl=0 Update2: trying to playback the content file as a source for fun and encoder crashes as above. |
Not really, it should actually work. I've slightly looked into the issue and there seem to be 2 another possible problems:
I'll try to look at the issue # 2 first in next day(s). UPDATE: I've converted first problem to issue #318 |
I can confirm that in fact when passing additional audio after each -t command it will only take the first audio and not pass the audio. At least that was in my test setup. Remember that this all started when testing -t file as a source when using switcher and it crashes. |
avoid unintended audio playback/capture devices given refer GH-316
I am not sure if I understand entirely. To clarify, how (I suppose) it works right now - selecting analog/embedded/aesebu selects that input for all video inputs, selecting different audio device (eg.
Do you have steps to reproduce? Ideally a minimal (non-)working example. Hard to say if it is supposed to work or not without more info. |
embedded audio for vidcap testcard with framerates using 1001 fractions (tested 23.98, 29.97 and 59.94) should now be working |
please see also #318 for further comments |
This should be already fixed with a24e194. File capture module was just not connected to root when initialized with switcher. |
Awesome! Will the audio follow the video when switching, sorry for duplicate question. |
yes, with some limitations (see #318) |
Well.... You are correct. It's not working, its just limited. Any thoughts on if this is possible to work, I think the feature is called "AFV" audio follows video. Its used on production switchers all the time. |
I am sorry but can you be more specific what exactly is not working? |
I was reading #318 and it says that portaudio works but not decklink audio. The point of having a switcher is being able to not only switch sources with a static audio source, but also have the ability to switch sources with different audio sources. #318 says that it dosnt work. Or at least thats how I read it. |
No, it says:
It also switches embedded audio with video devices.
|
I think we are confusing things. Example: I have two devices and one file. I want to switch between the file and the decklink devices, but as I switch the devices the audio should go along with the switching. i.e. device 1 file, then device 2 embedded, device 3 embedded, and follow along the audio as I switch from device to device. This is called AFV. (Audio Follow Video) Your example shows switching devices, which works 100%. What dosen't work is audio switching to the respective device. So when its switched form device 1 to device 2, device 2 audio should be playing, and then when switching back to device 1, should now be using device 1 audio. |
But it does, eg.: Please follow this specific problem in #318 with further comments not to mess this discussions with multiple issues. We can discuss more examples/use cases there. I've also slightly updated examples/description there. And sorry for the issues, the switcher capture is seldom used so not everything is (currently) handled as it should be. |
Great news the audio does work in this method and I can get the audio from the file as well. But I think a bit of understanding is still needed. Here are my commands: ./UltraGrid-continuous-x86_64.AppImage -s embedded -t switcher -t decklink:0 -t file:output.mp4:loop -c libavcodec:encoder=libx264:bitrate=20000k:preset=ultrafast --audio-codec=MP3:sample_rate=48000:bitrate=256k --audio-capture-format channels=16 -m 1316 -P 22816 192.168.99.228 --control-port 10000 ./UltraGrid-continuous-x86_64.AppImage -d decklink:device=0 -r embedded 192.168.99.228 -P 22816 When switching from decklink to file, a ton of audio buffer overflow messages a thrown in the decoder logs. This happens at every time the file loops itself as well. The next issue is it seems that the file player controls are not accessible/working:
Its not too important, but I felt worth bringing up. Next is, how the file is being handled as a source. Based on the documentation the sources should all be initialized at the start of the command line. I can validate that if I am using multiple vidcap sources that is correct, but once I add the file, no matter if I use the The last issue, but this is probably only a me issue, but I used this example to make a recording: Then I follow the instructions from here: https://github.com/CESNET/UltraGrid/wiki/Recording-and-Playback And if I am using two channels as my capture, everything works just fine. But If I have more than 2, eg. 16 channels, following the same instructions causes UG to crash each time when trying to initialize switcher or not. I am sure this is something to do with how I am making the recording and using ffmpeg to convert it. I tested with another file that was shared by @alatteri which works very well with the file and multiple audio channels, BUT after letting the file play for a bit, then trying to switch between sources, the decoder crashes. |
Maybe you still have to specify :drift-fix for the decklink? |
Actually seems to make it worse during the switch. @alatteri Update: still causes the decoder to crash when I switch sources.
UltraGrid has crashed (Aborted). Please send a bug report to address [email protected]. |
If I am not mistaken, in only occurs with H.264, not eg. with MJPEG, correct? If so, then see #322.
You mean in the swithcher? It seems so, I'll look into it. #320
yes, it is, as you correctly mentioned, without
Do you mean that the file jumps to beginning? I've tested and it doesn't seem to be the case, please try (source file Sintel to 1080i59 here):
With H.264 it stops for a while (and it doesn't for MJPEG), so blank frame may be produced by output decklink? but it should keep last frame, as far as i know. In this particular case, compression reintialized because change in mode (progressive vs. interlaced, fixed #321), but it can also be due to different codec.
can you create a minimal working examle? I've tried:
neither of the above crashed for me with current continuous. I've also checked the testcard-recorded WAV and it looked ok. |
libavcodec audio decoder has assertion on channel non-emptiness (which is perhpas correct - there cannot be anything done there) so do not pass emtpy channels. refer to GH-316
fixed (perhaps), but I won't expect the option to help now, anyways |
So I believe the main issue is a format mismatch. Using your file and testing there is no crashing and no dropping to black, so all works as it should as long as I am 100% matching my sources. I think the main confusion is the recorded file that I was assuming would have been good enough for my test since it came from actually recording the UG output, but clearly my ffmpeg process breaks it. I will use your file as the example of how a multiple channel source should look like moving forward. I do however still have problems. At first I thought the problem was the audio channels. File has 6, decklink has 16, command line says encode 16. So maybe that was my issue, so I dropped my audio layout to 2 channels. But I still have an issue. I can let the file play....... Ok so I will stop here for a moment, I was typing this and testing at the same time, BUT I think I finally found the problem. My command is here: Decode So I set two channels of audio for the encode, but look at the decoder log output, says I have 6 which is what the file actually has, that should not be like that right?: Ignore the rest of this but I will leave it for historical data! LOLOL. Starting the command line with switcher and file as first option. Video dec stats (cumulative): 5580 total / 5541 disp / 38 drop / 0 corr / 1 missing. I still get tons of error messages as per #322 and from your previous note in #318 about the messages of the [DeckLink capture] Dropping audio packet, queue full. I do think those should be truncated. |
|
libavcodec audio decoder has assertion on channel non-emptiness (which is perhpas correct - there cannot be anything done there) so do not pass emtpy channels. refer to GH-316
If BMD API generates timeout event, return NULL from getf. This allows switching to a fallback source in this case (see referenced issue and a comment below this referencing commit. refers to GH-316
Okay, all sub-issues are fixed from my perspective, let me know if I am something missing. Returning back to the original question.
It used to be simply a RAW file with data corresponding given props (color_spec + size). Now it can also handle Y4M (for YUV; but only first frame is taken). PAM or PNM (RGB). But file capture is perhaps more eligible, indeed. using switcherI believe that you could use something like this:
correct? But there was still one catch with this approach. When DeckLink is the first device, but not having a signal, DeckLink's timeout caused that the file capture produced just 1/2-1/3 FPS (i.e. 10-20 FPS for 59.94i). I've provisionally fixed this with commit 1db584e which utilizes the fact, that DeckLink locks its clock to the signal and triggers nosignal exactly when the frame should be presented, even if there is none. It needs a bit testing but I think it could work. UPDATE (7th Aug '23): fixed commit number |
I believe that the issue has been resolved with above changes and fixes in sub-issues. You can reopen if disagree (or open an another issue to report a more specific related problem). |
I'd like to be able to switch sources to some file playback when there is no SDI signal detected. I was looking at how to playback recordings to the decklink, and it seems cumbersome. I noticed there is a testcard option with a file name that can be used instead of the default bars. What file is supported there? I was thinking that some sort of audio and bars to be used as a playback source, or beset I can just make a recording of my favourite and have that loop in the background as a switchable source. Any suggestions on how to do this easily? Additionally, if the testcard resolution and setup could match the input format automatically, then it would make the whole process easier.
The text was updated successfully, but these errors were encountered: