I have an ASP.NET MVC Web Site ,the user can upload a video and When Done It finish uploading I show him an image extracted from the Video,
To do this I used the FFMPEG exe to get a frame.
Everthing works well in the developement machine , when I use the test environement it does not work!!
I've given the read/write and execute permissions to following folders:
1. videos(folder that store uploaded video files)
2. thumbnails (folder that store the thumbnails of videos, captured by ffmpeg)
3.ffmpeg.exe file at root and given read/write execute permissions to that file also.
but it does not work.
var _converter = new ImageConvertor(#System.Configuration.ConfigurationManager.AppSettings["FFmpegExec"].ToString());
_converter.WorkingPath = Server.MapPath("~/VideoSamples");
OutputPackage oo = _converter.ConvertToFLV(videoFilepath);
FileStream outStream = System.IO.File.OpenWrite(Path.Combine(Server.MapPath("~/VideoSamples"), id.ToString() + ".flv"));
oo.VideoStream.WriteTo(outStream);
This Code Works on developement env but not in test env !!!
Any Ideas Please
Related
I am using the dotNet sdk. All the images are stored in the wwwroot/Image folder i.e. Static folder.
When i am running the bot through emulator i.e. Locally it is showing the image.
But after publishing the application the image is not showing up.
when i debug program remotly then i am getting the proper image path: D:\home\site\wwwroot\wwwroot\Image\pdf.jpg
, which is currect url but sill image is not showing up.
new AdaptiveColumn() {
Width=AdaptiveColumnWidth.Auto,
Items = new List<AdaptiveElement>()
{
new AdaptiveImage()
{
//Url = new Uri(iconUrl),
Size = AdaptiveImageSize.Small,
Style = AdaptiveImageStyle.Default,
UrlString=iconUrl
}
}
},
Any location starting with a drive letter like D is a local path and not a remote URL. You should never use a local path when trying to identify resources on a server, since your bot is communicating with a client on a totally different machine.
Please familiarize yourself with this document to understand how static files work in .NET Core: https://learn.microsoft.com/en-us/aspnet/core/fundamentals/static-files
Once your web app is running on a server, you will be able to access the image using HTTP/S. If you're running the bot locally then the URL should look something like http://localhost:3978/Image/pdf.jpg and if the bot is deployed then it should look something like https://rajatbot.azurewebsites.com/Image/pdf.jpg. Test the URL by pasting it into a browser to make sure it works, then put the URL in your card.
I want to extract a thumbnail from an mp4 video hosted in azure storage. My current method in C# uses a NReco NuGet package:
But that is a local file. How do i extract the thumb from an azure storage file.
string mp4inputpath = server.mappath("~/testfolder/myvideo.mp4");
string thumbOutputPath = server.mappath("~/testfolder/mythumb.jpg");
var ffMpeg = new NReco.VideoConverter.FFMpegConverter();
// Get the thumb at the frame 1 second into the video
ffMpeg.GetVideoThumbnail(mp4inputpath, thumbOutputPath, 1);
That works! But i need to use an azure storage file url for mp4inputpath.
I can download the mp4 file from azure storage and save it temporarily into my azure web app. I can do that programatically.
Then extract the thumb, ie,
ffMpeg.GetVideoThumbnail(mp4inputpath, thumbOutputPath, 1);
Then delete the temporary mp4 within my app.
this works but i don't know it is advisable to download mp4 files into my azure web app. I don't know if it will scale. This is the only solution i have, so far.
string mp4Url = #"https://mysorageaccount.blob.core.windows.net/mp4/vacation/summer/dogbarking.mp4";
string thumbOutputPath = server.mappath("~/testfolder/mythumb.jpg");
var ffMpeg = new NReco.VideoConverter.FFMpegConverter();
// Get the thumb at the frame 1 second into the video
ffMpeg.GetVideoThumbnail(mp4Url, thumbOutputPath, 1);
This does not seem to work. No Error, but the thumbOutputPath file is empty.
What you've done is pretty much what you have to do, since you cannot open an object in Azure Storage as you would a local file. So, grabbing the file into a local file or a stream is what you'd need to do.
As far as scaling: that will depend on the size (and number of instances) you're running in your Web App. Just be aware that you should have both your storage account and your Web App in the same region, to reduce latency and avoid egress charges for bandwidth.
I'm writing a WPF C# application, and would like to obtain the SharePoint URL of a locally synced file.
In Windows Explorer, the user can right click on a file in the synced OneDrive folder, select "OneDrive for Business" menu and "Copy link". This provides the SharePoint URL of the synced file. Is there a way to replicate this in C#?
At the moment, if I reference the file using a FileOpenDialog from within my application, I only get the local physical path (e.g. c:\onedrive...\file.txt). How can I use the locally synced file to get the SharePoint URL?
I am also looking at a solution for getting the SharePoint url to a file in OneDrive Synced File Explorer.
I have noticed you get under C:\Users\uidxxxxx\AppData\Local\Microsoft\OneDrive\settings\Business1{GUID}.ini a mapping between your OneDrive synced folder and the SharePoint GUID
Example:
libraryScope = 1 630c2a866d9c458b81060eff107887ed+1 5 "GUIDEs" "Documents" 4 "https://tenant.sharepoint.com/teams/team_10000035" "8d4b558f-7b2e-40ba-ad1f-e04d79e6265a" e0266a43caf347238f684bab486f4e51 e0d25dcb1a014f5f86d787984f6327c2 4f86b3e3e54e42e0bb0f7a58eadf0335 0 "" 0 4cde5c00-3fe3-4162-b831-d8ef440e1593 libraryFolder = 0 1 8bbfe07dfeff41cea7ab5da4a554592a+1 1558084235 "D:\DSUsers\uid41890\TenantName\GUIDEs - General" 2 "General" bd0c1b7c-2a1f-4492-8b1b-8e152c9e0c26
You also have this mapping in the registry Computer\HKEY_CURRENT_USER\Software\Microsoft\OneDrive\Accounts\Business1\ScopeIdToMountPointPathCache
From the GUID you could get the path using SPWeb.GetFile(Guid)
Edit: unfortunately the GetFile function seems only to be available on the server side.
If you can make a standalone function given a local OneDrive file path that returns the SharePoint url, I would greatly appreciate you share your solution here.
am developing an application which can fetch files from internet.. how do i download and save a "docx" or "wav" file from internet within the application and use it later with other application likes office or windows media player.
You can download files in the background (ie. they will continue even when your application is not running).
Having said that, you should research the types of files you need to support. For example, you can play an audio file (if the format is supported) or add it to Music hub but you cannot open a file in Office. Very few filetypes can be integrated with, so do some research before you start writing your app otherwise you might be disappointed.
place an image control in your page. here im1 is controls name.
it is working for me
string imgurl="http://.........";(path)
Uri addrs=new Uri(imgurl,UriKind.Absolute);
BitmapImage bitmap = new BitmapImage(addrs);
im1.Source = bitmap;
I have a doubt from a silverlight application we can access MyDocuments. I am creating an Application which will download a set of files from a remote server . Is it possible to save these file in MyDocuments instead of Isolated Storage. I am using Silverlight 4.0 . Can any one give me Sample codes for it.
In order to acheive that you need to use Silverlight 4 and specify that is should get elevated privileges when install as an Out-of-browser application. When running as an OOB the app will have access to the users Documents folder.
In all other cases you will need to use the SaveFileDialog where the user can explictly specify where to save the file.
Edit code example:-
if (Application.Current.HasElevatedPermissions)
{
string path = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
path = Combine.Path(path, "MySaveFile.dat");
using (var filestream = File.OpenWrite(path))
{
// pump your input stream in to the filestream using standard Stream methods
}
}
No Isolated storage is currently the only option.