May 21, 2016 at 6:17 pm
I have some files stored in Folder and the paths of this files stored in sql server:
File path : E:\videofiles\123.mp4
how to get the video duration using tsql, because i need to update the table with the duration for all records
May 24, 2016 at 1:58 am
Hi,
I think this is impossible, SQL is a database tool, no video tool. I've never heard, that sql cmd could manage such a task.
Kind regards,
Andreas
May 25, 2016 at 8:12 am
You'll have to access the Extended File Properties of the file but I don't think you can do it with TSQL. The Extended Properties vary according to the type of file.
In the old days, you would probably have to write some c#/vb but Powershell is the way to go now. Powershell can use the GetDetailsOf method to query folders. You might even be able to use a SSIS script component.
You might be lucky and someone has written a similar script already.
May 25, 2016 at 9:20 am
You might be able to do it using the T-SQL commands to allow for OLE Automation. Start with sp_OACreate and work your way through. I warn you now, it'll be unpleasant.
Thomas Rushton
blog: https://thelonedba.wordpress.com
May 25, 2016 at 9:24 am
DouglasH (5/25/2016)
You'll have to access the Extended File Properties of the file but I don't think you can do it with TSQL. The Extended Properties vary according to the type of file.In the old days, you would probably have to write some c#/vb but Powershell is the way to go now. Powershell can use the GetDetailsOf method to query folders. You might even be able to use a SSIS script component.
You might be lucky and someone has written a similar script already.
that's how i would have tackled it as well. my first link i found:
Lowell
May 25, 2016 at 3:08 pm
i used c# to do that using :
http://www.nrecosite.com/video_info_net.aspx
Download package and add reference to NReco.VideoInfo.dll assembly
var ffProbe = new NReco.VideoInfo.FFProbe();
var videoInfo = ffProbe.GetMediaInfo(pathToVideoFile);
Console.WriteLine(videoInfo.FormatName);
Console.WriteLine(videoInfo.Duration);
June 2, 2016 at 6:49 am
in sql if you use any extended procedure will cause many issue later.
i suggest, while uploading the video file you can save the file path , name and duration in sql table will save lot of your extra effort which is very much possible using your C# or vb.net
June 3, 2016 at 8:46 am
Upload is done automatically , the user will select multiple files , then will press upload button, everything must be added to sql server table , this why i use ffmpeg tool
Viewing 8 posts - 1 through 7 (of 7 total)
You must be logged in to reply to this topic. Login to reply