|
Good morning,
I'm trying to capture an image from a RTSP stream using ffmpeg.
I'm struggling, it is as if ffmpeg isnt working. A snip from my code is below:
using System.Runtime.InteropServices;
using FFmpeg.AutoGen;
using SixLabors.ImageSharp.Formats.Png;
using SixLabors.ImageSharp.Formats;
Class Program
{
unsafe static void Main(string[] args)
{
string inputUrl = "rtsp://wowzaec2demo.streamlock.net/vod/mp4:BigBuckBunny_115k.mp4";
ffmpeg.avformat_open_input(&pFormatContext, inputUrl, null, null);
The error that I'm receiving which is related to the last line of code is:
System.NotSupportedException
HResult=0x80131515
Message=Specified method is not supported.
Source=FFmpeg.AutoGen
StackTrace:
at FFmpeg.AutoGen.DynamicallyLoadedBindings.<>c.<Initialize>b__2_1284(AVFormatContext** <p0>, String <p1>, AVInputFormat* <p2>, AVDictionary** <p3>)
at FFmpeg.AutoGen.ffmpeg.avformat_open_input(AVFormatContext** ps, String url, AVInputFormat* fmt, AVDictionary** options)
at Program.Main(String[] args)
Any help would be appreciated,
Freddie
|
|
|
|
|
You'll probably have better luck reporting this as an issue in the GitHub project - assuming it hasn't already been reported:
Issues · Ruslan-B/FFmpeg.AutoGen · GitHub[^]
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
The documentation at FFmpeg: Demuxing[^] implies that it expcts an actual filename as input. So try reading the stream into a local file, and see if it can process that.
|
|
|
|
|
|
I have about 6 user controls, each with its own GUI and code to load data from a MySQL database.
Are there any tutorials or examples on how to use multithreading to load all 6 user controls on a Form when the Form is shown?
Thanks in advance.
|
|
|
|
|
Controls cannot be created and used on anything other than the UI (startup) thread. Your controls CAN, however, used Tasks or Threads to load data from the database, but populating the control data with the data returned from the database must be done on the UI thread.
There are plenty of articles on the web about using tasks to get data. There is nothing specific to user controls that changes how that's done.
|
|
|
|
|
What Dave said and use ObservableCollections to have the UC's update "live".
"Before entering on an understanding, I have meditated for a long time, and have foreseen what might happen. It is not genius which reveals to me suddenly, secretly, what I have to say or to do in a circumstance unexpected by other people; it is reflection, it is meditation." - Napoleon I
|
|
|
|
|
I am using visual basic to try and get the webview2 current url but all I get is the first page that I opened with the webview2. I used
dim URL as string = webView21.Source.ToString() but not returning current page url. I have work on this for 2 days now and no luck. I sure hope some body can answer this or my whole project is toast.
|
|
|
|
|
You have to handle the NavigationCompleted event, then you can get the "current" uri from either webView21.Source or webView21.CoreWebView2.Source .
|
|
|
|
|
Thanks so much Dave. I knew there had to be away, just couldn't find it. Vb.net is just a hobby for me but if I can help someone else I will pay this forward.
|
|
|
|
|
First some background. 10+ years ago my spouse started a small webshop and I made the administration part in Delphi. Slowly transitioning it to the web. I have tried to make everything as automatic as I can. Like register a payment automatically makes a record in the ledger.
On the same line I later made a C# .NET as a part in the handling of incoming invoices. She scans the invoice to PDF and place it on the desktop or drops it there if it is delivered electronically. My application detects the file and pops up and she can fill in the things needed to put in the ledger and store it in the database.
Now last week the application starts and then closes without being touched for years. It worked last month, the delphi written things still works.
Does anyone have any idea why, this coincide with me reading something about Microsoft removing some old version of TLS. The application uses Entityframework.
Then I tried opening up the source in VS 2017 community edition(?) where it was written but I never get past the "credentials is wrong" page. Moved the code to another computer with VS 2022 on it where I had trouble getting it to work. When I did I got back an exception telling me "opening of table didn't work" but no indication of why.
|
|
|
|
|
You've said a lot but nothing that can be used to give any suggestions. We know nothing about the code, what it uses or does, nor the EXACT exception messages.
|
|
|
|
|
I don't use C# on a daily basis and I haven't touched the code for a long time. There could be that this debug session broke when imported in 2022 instead of 2017 where the original development was done.
I hoped that someone would say something along the lines of (Microsoft disabled Tech Z version X, try installing Y). But anyway Entity framework and under references MySql.Data and MySql.Data.Entity.EF6.
NuGet packages MySql.Data 6.9.9 and MySql.Data.Entity 6.9.9 (This one is marked as depreceted).
This is the exception I received:
System.Data.Entity.Core.EntityException
HResult=0x80131501
Message=The underlying provider failed on Open.
Source=EntityFramework
StackTrace:
at System.Data.Entity.Core.EntityClient.EntityConnection.Open()
at System.Data.Entity.Core.Objects.ObjectContext.EnsureConnection(Boolean shouldMonitorTransactions)
at System.Data.Entity.Core.Objects.ObjectContext.ExecuteInTransaction[T](Func`1 func, IDbExecutionStrategy executionStrategy, Boolean startLocalTransaction, Boolean releaseConnectionOnSuccess)
at System.Data.Entity.Core.Objects.ObjectQuery`1.<>c__DisplayClass7.<getresults>b__5()
at System.Data.Entity.Infrastructure.DefaultExecutionStrategy.Execute[TResult](Func`1 operation)
at System.Data.Entity.Core.Objects.ObjectQuery`1.GetResults(Nullable`1 forMergeOption)
at System.Data.Entity.Core.Objects.ObjectQuery`1.<system.collections.generic.ienumerable<t>.GetEnumerator>b__0()
at System.Data.Entity.Internal.LazyEnumerator`1.MoveNext()
at BusinessLayer.Supplier.GetAll() in C:\mitt\marieshopnet\BusinessLayer\Supplier.cs:line 33
at PendingLedgerEvidence.Form1..ctor() in C:\mitt\marieshopnet\PendingLedgerEvidence\Form1.cs:line 60
at PendingLedgerEvidence.Program.Main() in C:\mitt\marieshopnet\PendingLedgerEvidence\Program.cs:line 19
This exception was originally thrown at this call stack:
[External Code]
Inner Exception 1:
MySqlException: Unable to connect to any of the specified MySQL hosts.
|
|
|
|
|
The "provider" exception (probably) refers to the MySQL database driver / adapter. If you haven't touched stuff "in years", you need to verify all the versions (of components) you need are in "sync".
"Before entering on an understanding, I have meditated for a long time, and have foreseen what might happen. It is not genius which reveals to me suddenly, secretly, what I have to say or to do in a circumstance unexpected by other people; it is reflection, it is meditation." - Napoleon I
|
|
|
|
|
Your app's connector could not connect to the database host, or it connected and failed authentication. TLS is a transport protocol, a newer version of handshaking or validating in more detail. TLS last I checked is at V1.3, and V1.0, V1.1 was discontinued, but that was years ago.
If your database is hosted at home or in your shop, then that's a local connection, and could be a firewall blocking a port number for MySQL. If your using a cloud host, then perhaps they upgraded.
But if you wrote the app personally, you should remember how that part works, and be able to fix it fairly quickly. EF has nothing to do with the connection to the database server. You can use Fiddler to watch the connection, or check error logs, there is something out there that will guide you.
If it ain't broke don't fix it
Discover my world at jkirkerx.com
|
|
|
|
|
|
|
Smells like a spam setup to me. His profile lists his company name, who according to Google are "a Microsoft's Consulting having expertise in technologies like Power BI ...".
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Thanks, I didn't check that.
|
|
|
|
|
This sounds suspiciously like a question you find on a certification test, for BI. You know, the very thing your company says you're supposed to be an expert in.
We're not here to do your homework for you.
|
|
|
|
|
Consensus view is that he/she is a spammer.
|
|
|
|
|
YASH PATEL 2023 wrote: How can Power BI development services assist businesses in transforming raw data into meaningful insights and visualizations?
Answer: It cannot.
But people can. They might or might not use that.
|
|
|
|
|
Here's my Program.cs file (I've actually simplified it to some extent).
using StudentsMinimalApi;
using StudentsMinimalApi.Validation;
using System.Collections.Concurrent;
WebApplicationBuilder builder = WebApplication.CreateBuilder(args);
builder.Services.AddProblemDetails();
WebApplication app = builder.Build();
if (!app.Environment.IsDevelopment())
{
app.UseExceptionHandler();
}
app.UseStatusCodePages();
ConcurrentDictionary<string, Student> _students = new();
RouteGroupBuilder studentsApi = app.MapGroup("/student");
studentsApi.MapGet("/", () => _students);
RouteGroupBuilder studentsApiWithValidation = studentsApi
.MapGroup("/");
studentsApiWithValidation.MapGet("/{id}", (string id) =>
_students.TryGetValue(id, out var student)
? TypedResults.Ok(student)
: Results.Problem(statusCode: 404));
studentsApiWithValidation.MapPost("/{id}", (Student student, string id) =>
_students.TryAdd(id, student)
? TypedResults.Created($"/student/{id}", student)
: Results.ValidationProblem(new Dictionary<string, string[]>
{
{ "id", new[] { "A student with the given id already exists." } }
}));
app.Run();
public partial class Program { }
As you can see, I created an example minimal API that exposes endpoints that you can use to access or change data related to an example Student class using the HTTP protocol.
So now I'd like to test my minimal API using xUnit. That's how I decided to test if the post method successfully creates a new student.
[Fact]
public async Task MapPost_Should_Successfully_Create_A_New_Student()
{
await using var application = new WebApplicationFactory<Program>();
using HttpClient? client = application.CreateClient();
HttpResponseMessage? resultFromPost = await client.PostAsJsonAsync("/student/s1", new Student("X", "Y", "Z"));
HttpResponseMessage? resultFromGet = await client.GetAsync("/student/s1");
Assert.Equal(HttpStatusCode.Created, resultFromPost.StatusCode);
Assert.Equal(HttpStatusCode.OK, resultFromGet.StatusCode);
string? contentAsString = await resultFromGet.Content.ReadAsStringAsync();
var contentAsStudentObject =
JsonConvert.DeserializeObject<Student>(contentAsString);
Assert.Equal(HttpStatusCode.Created, resultFromPost.StatusCode);
Assert.Equal(HttpStatusCode.OK, resultFromGet.StatusCode);
Assert.NotNull(contentAsStudentObject);
Assert.Equal("X", contentAsStudentObject.FirstName);
Assert.Equal("Y", contentAsStudentObject.LastName);
Assert.Equal("Z", contentAsStudentObject.FavouriteSubject);
}
May I ask you if this way of testing is adequate? For the testing of the post method I've actually used the get method. This does not seem like a good approach, but I don't see how else I can handle the situation. So I can't compe up with another alternative that's maybe better than this. Is there a way for me to access the _students dictionary from the Program.cs file? How would you write your tests in this situation? Thank you in advance!
|
|
|
|
|
You might want to research 'code coverage' tools. Those collect stats during your test to make sure that you have tested all code paths.
Also note that you should not be actually testing the dictionary. But rather the usage of that. But perhaps that is what you mean.
Nikol Dimitrova 2023 wrote: Is there a way for me to access the _students dictionary from the Program.cs file?
Presumably to test that the state is as excepted. Yes there are several.
1. Just publicly expose the dictionary (getter)
2. You can use reflection to get to the internals of a class.
If you use the second then you should document with a comment that it only public for testing.
For a small case like this I would use the first (getter). For larger libraries I would use reflection because the idiom is clearer with more usage and because more chance of public methods getting misused over time.
|
|
|
|
|
Thank you for the response!
May I ask you how exactly can we access the dictionary after let's say we add a student with a POST request using reflection? We can also check if the count (the number of elements of the dictionary) is correct (if we add one student, it should be 1; if we add 2 students, then it should be 2, and so on).
I couldn't achieve that because we are actually using a WebApplicationBuilder<program>.
What is the approach?
Also, if I use the first method, how exactly do I expose it with a getter? I guess I cannot use the top-level statements syntax then, because we cannot define properties in namespaces.
Thanks!
|
|
|
|