Giter VIP home page Giter VIP logo

xabe.ffmpeg's People

Contributors

06needhamt avatar alex6dj avatar ben-pearce avatar craiggilchrist avatar djon2003 avatar dremnor avatar hanabi1224 avatar johnduhart avatar leonardder avatar lkischler avatar nlogozzo avatar ogliznutsa avatar ohads-msft avatar proletariatpatryk avatar reminoer avatar shravan2x avatar thecodejedi avatar theolivenbaum avatar tomaszzmuda avatar wolfteam avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

xabe.ffmpeg's Issues

Error in ConversionQueue

When there is an error during the conversion of any file in the conversion queue, the _number field is not incremented, so the reference to the exact number of files that have been processed in the conversion queue is lost.

FFMpeg path problem

Hey, @tomaszzmuda I'm using your wrapper for a while and it's great. Now i have a problem with path. FFmpeg is registered on my environment variable but unfortunately most people can't do that. I want to tell ffmpeg and ffprobe path to your wrapper but i couldn't manage it. Here is a screenshot :
https://prnt.sc/hls50s

Do you have any idea ? Why FFbase.FFmpegDir doesn't work ? Thanks!

Refactor MediaInfo

Media info should have private constructor and be accessible by static method like Get(string filePath) in which all properties should be probed.

Danger of Task.Run to make ffmpeg async

It seems you are using Task.Run to run System.Diagnostics.Process
https://github.com/tomaszzmuda/Xabe.FFmpeg/blob/master/Xabe.FFmpeg/FFmpeg.cs#L41

Based on this link: https://stackoverflow.com/questions/14896057/mvc4-webapi-process-launcher
and many online references using Task.Run in asp.net or .net core api controller is dangerous: quoting below from @StephenCleary

However, I must caution you that this is quite dangerous. ASP.NET is an HTTP server, so if there are no active requests, it will feel free to take down your AppDomain if it wants to. This would mean your "do more stuff with exitcode" will just drop off the face of the earth.

I myself looking for simple solid solution other than https://github.com/HangfireIO/Hangfire

Are you aware of this issue?

Possible NullReferenceException

Hi!

return new[] {probe.streams.FirstOrDefault(x => x.codec_type == "video") ?? null, probe.streams.FirstOrDefault(x => x.codec_type == "audio") ?? null};

if JsonConvert.DeserializeObject returns null, this line would cause null reference exception.
such thing may happen if, for example, provided file mime type will not be recognized by ffprobe.
In that case it would be great to initialize Properties with null reference so it should be possible to check if file was recognized or not without wrapping first call to properties into try catch block.

Catching exceptions from ffmpeg process

Currently only ConversionException is returned from ffmpeg process. Messages from ffmpeg should be parse and throw specific exception (e.g FileNotFoundException).

Extract subtitles

Ability to extract subtitles from a video file and maybe convert from one format to another (from ass to srt)

Nuget Error when installing package

Hey. I hope this is the right place for this kind problem if it's not i'm sorry. I'm new to github community. I want to use ffmpeg wrapper but i couldn't manage to install nuget package.

PM> Install-Package Xabe.FFMpeg -Version 2.2.7
Installing 'Xabe.FFmpeg 2.2.7'.
Successfully installed 'Xabe.FFmpeg 2.2.7'.
Adding 'Xabe.FFmpeg 2.2.7' to WindowsFormsApplication1.
Uninstalling 'Xabe.FFmpeg 2.2.7'.
Successfully uninstalled 'Xabe.FFmpeg 2.2.7'.
Install failed. Rolling back...
Install-Package : Could not install package 'Xabe.FFmpeg 2.2.7'. You are trying to install this package into a project that targets '.NETFramework,Version=v2.0', but the package does not conta
in any assembly references or content files that are compatible with that framework. For more information, contact the package author.
At line:1 char:1
+ Install-Package Xabe.FFMpeg -Version 2.2.7
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Install-Package], InvalidOperationException
    + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PowerShell.Commands.InstallPackageCommand

I hope you can help me i'm totally lost right now. Thank you!

Missing XML doc

Conversion.cs(80,47): warning CS1591: Missing XML comment for publicly visible type or member 'Conversion.OnDataReceived' [/home/travis/build/tomaszzmuda/Xabe.FFmpeg/Xabe.FFmpeg/Xabe.FFmpeg.csproj]
Build completed.

Little warning. The inherit doc tag has wrong target.

Misleading SetChannels

Hi, there's a problem with .SetChannels function when it is called with operations on video, which require encoding and decoding again.

Flag that .SetChannels set in the command line turns on stream-copy mode which is used to change video meta or container, look here: http://ffmpeg.org/ffmpeg.html#Stream-copy
When this mode is used with operations which require encoding and decoding video (scaling, changing codecs etc), ffmpeg returns error and your lib throws exception.

It will be great to give more clear naming to .SetChannels or/and also check if .setVideo/.setScale and .SetChannels are being used simultaneously to warn user from such an action.

Conversion queue uses 100% processor

I found a problem in the conversion queue. It happens that when there is no work in the queue the worker stays in a loop that puts the processor at 100%. This happens when I start the queue ...

When I start ConversionQueue passing it true as parameter, it uses 100% of the CPU. And when I pass false it just lock a processor core. It seems to be a problem with Task Worker() that stays in a loop that puts the processor at 100% when it has nothing to process.

Streams in media properties

MediaInfo class doesn't provide info for all streams.
MediaInfo should contain properties for all streams (audio, video, subtitle) desptite of count.

FFmpeg executables

Find way to include ffmpeg executables in nuget package.
Doing it for single system will be simple, but make it cross platform would be hard work.
This could be done include all ffmpeg executables for all .net core operating system and include correct version for OS, but the package would be extremally heavy.

Delete Extensions class

Extension class is useless.
User could specify extensions more easily just by passing it as string.

Getting error when using FFbase.FFmpegDir on mac

I'm including http://ffmpeg.zeranoe.com/builds/ in my apps bin folder and set the Xabe.FFmpeg.FFbase.FFmpegDir to the right folder (mac64/win64) based on the OS.

bin2

It works fine on windows 10 but on mac I get this exception:

Unhandled Exception: System.ComponentModel.Win32Exception: Permission denied
   at Interop.Sys.ForkAndExecProcess(String filename, String[] argv, String[] envp, String cwd, Boolean redirectStdin, Boolean redirectStdout, Boolean redirectStderr, Int32& lpChildPid, Int32& stdinFd, Int32& stdoutFd, Int32& stderrFd)
   at System.Diagnostics.Process.StartCore(ProcessStartInfo startInfo)
   at System.Diagnostics.Process.Start()
   at Xabe.FFmpeg.FFbase.RunProcess(String args, String processPath, Boolean rStandardInput, Boolean rStandardOutput, Boolean rStandardError)
   at Xabe.FFmpeg.FFprobe.RunProcess(String args)
   at Xabe.FFmpeg.FFprobe.GetStream(String videoPath)
   at Xabe.FFmpeg.FFprobe.GetProperties(String videoPath)
   at Xabe.FFmpeg.MediaInfo.get_Properties()
   at Xabe.FFmpeg.MediaInfo.ToString()
   at .Program.<RunApp>d__3.MoveNext() in /Users/<path...>/Program.cs:line 100
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.ThreadPoolWorkQueue.Dispatch()

any thoughts?

Also, I'm new to ffmpeg, do I need to include ffserver and ffplay in that directory?

Thanks

Document thrown exceptions

XML docs are lack of thrown exceptions.
It has to be done.

Example:

     /// <summary>
    ///     Start conversion
    /// </summary>
    /// <returns>Conversion result</returns>
    /// <exception cref="ConversionException">Occurs when FFmpeg process return error.</exception>
    Task<bool> Start();

Tests for M3U8Stream

Method SaveM3U8Stream in ConversionHelper is untested.
I don't have any idea how to test it.
Theoretically it should works, but it has to be tested soon.

wrong scaling size param

Hi, I came across the scale problem in your solution, it seems that scale factor is given to the command line inproperly, in one integer, while ffmpeg accepts %width%x%height% format, or preset alias.
More Info here:
https://ffmpeg.org/ffmpeg-utils.html#Video-size

I fixed the problem, so if you accept contributors to your project, please create branch and I'll push the fix.

OnProgress totalLength parameter doesn't respect In and Out points

The totalLength parameter that gets passed to the OnProgress event handler gives the total length of the input file (which can then be used to calculate the % of progress completed).

However, when passing an "In" or "Out" point to ffmpeg (using -ss and -t ffmpeg arguments), the totalLength parameter still gives the length of entire video clip. This throws off the calculations of % of progress completed.

Is there a particular reason why the totalDuration doesn't account for the -ss or -t arguments? And if so, can the OnProgress event handler be given a third parameter like segmentLength or similar, that respects the t and ss?

I can help with a Pull Request if you are open to accepting it.

Normalize and refactor changing speed of video and sound feature

I suggest to normalize methods ChangeAudioSpeed and ChangeVideoSpeed to the same parameter meaning, add one method with synchronized change of video and audio speed, protect parameters range (probably from 0.5 to 2) and maybe automate changing speed with other values.

Validate ffmpeg parameters composition during compilation

Validate FFMpeg arguments during build arguments using IConversion.
Now, parameters can be used together even if combination of them will returns FFMpeg process fail.

Conversion class shoudn't allow user to use inappropriate parameters.

Eliminate naming voodoo

.First(x => x.Name.Contains("FFmpeg"))

Hi, it's me again. Suggest the following change:

.First(x => x.Name.Contains("ffprobe"))
.FullName;
.First(x => x.Name.Contains("FFmpeg"))
.FullName;

to:
private const string _MPEG_FILE_NAME = "ffmpeg";
private const string _PROBE_FILE_NAME = "ffprobe";

.First(x => x.Name.ToLower().Contains(_PROBE_FILE_NAME))
.FullName;
.First(x => x.Name.ToLower().Contains(_MPEG_FILE_NAME))
.FullName;

Suggest this change for both calls.
I'm having both exe files in lower case and current solution gave me exception :(

btw. also it'll be good idea to wrap all this in try-catch block, because now if linq fails to find file with needed name in the user-provided dir it throws linq exception which is rather misleading in its place.

Refactor VideoCodec, AudioCodec, Filter

VideoCodec, AudioCodec, Filter have to be refactored.
This should be deleted and user will pass codec manually or it should contains much more codecs with possibility to allow user specify manually codec.

Add new classes to operate on streams

Conversion shoudn't operate on file as all.
New class to operate at Video, Audio, Subtitle stream should be added and operations at specific streams should be done at specific class.
Conversion should add all streams in one file and set options related to output file.

Speed up Travis CI build

Builds can be faster by using cache.
Sometimes not all tests passed there due to specific environment.
Faster builds should speed up development.

Error when converting .h264 files to .mp4

I am trying to convert a bunch of .h264 files to .mp4 but am getting the below error.

Exception thrown: 'System.DivideByZeroException' in Xabe.FFmpeg.dll
An exception of type 'System.DivideByZeroException' occurred in Xabe.FFmpeg.dll but was not handled in user code
Attempted to divide by zero.

The part throwing the error is below lines.

bool result = await new Conversion()
.AddParameter("-movflags +faststart")
.Concatenate(pathList.ToArray())
.StreamCopy(Channel.Both)
.SetBitstreamFilter(Channel.Audio, Filter.Aac_AdtstoAsc)
.SetOutput(output)
.Start();

The pathList.ToArray()) is List pathList containing full paths to the .h264 files.

Any help will be greatly appreciated.

One or more projects are incompatible with .NETCoreApp,Version=v2.0.

Hi (its Jeremy Thompson, we spoke on Stackoverflow)

When I open the solution in VS2017 15.2 Ent Edition, I get these 2 compilation errors:

Severity Code Description Project File Line Suppression State
Error One or more projects are incompatible with .NETCoreApp,Version=v2.0.

Severity Code Description Project File Line Suppression State
Error Project Xabe.FFmpeg is not compatible with netcoreapp2.0 (.NETCoreApp,Version=v2.0). Project Xabe.FFmpeg supports: netstandard2.0 (.NETStandard,Version=v2.0)

I have .Net 4.7 installed.

Googling the error indicates VS2017 is the problem: https://social.msdn.microsoft.com/Forums/vstudio/en-US/f3832fbf-d708-4440-9dee-3df6ed02622c/one-or-more-packages-are-incompatible-with-netcoreappversionv10?forum=netfxsetup

Could you let us know how to get the solution compiling? Thanks in advance.

Refactor ConversionHelper

Conversion Helper should be merged into Conversion class as static methods in separate file (using partial).
This shoudn't contains all overloads but only minimalistic presets to specific functionality.

Subtitles...

Ability to add subtitles as a new stream for mkv or others, as well as embedded within the video itself permanently.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.