EmguFFmpeg
EmguFFmpeg copied to clipboard
AVHWDeviceType and MediaFilterGraph
I use with success MediaFilterGraph with one or several MediaStream (as Video type) as Inputs I can use simple or complex filter - here I describe my problem using only one MediaStream as Input.
For example:
- scale=400:-2
- subtitles=f=c\:\\media\\TOEFLTest.mp4:si=0
When I tried to use an AVHWDeviceType ("d3d11va" to be precise) on MediaDecoder of the MediaStream using the first filter it's working fine When the second is used it failed on MediaFilterContext.ReadFrame (...) - see code snippet below.
// Get MediaFilterContext according the id specified
var mediaInputFilterContext = _videoFilterGraph.Where(mediaFilterContext => mediaFilterContext.Name == id).FirstOrDefault();
if (mediaInputFilterContext == null)
return;
// Write frame in the MediaFilterContext
mediaInputFilterContext.WriteFrame(mediaFrame, (int)BufferSrcFlags.KeepRef);
// ReadFrame (if any) from FilterGraph Output
var mediaOutputFilterContext = _videoFilterGraph.Where(mediaFilterContext => mediaFilterContext.NbOutputs == 0 ).FirstOrDefault();
if(mediaOutputFilterContext != null)
foreach (var filterFrame in mediaOutputFilterContext.ReadFrame()) // => FAILED WITH ERROR -22
ManageVideoFrame(filterFrame);
I suppose I need to do specific stuff when AVHWDeviceType is used but I really don't know where ...
Could you advise me ?
Thanks.
From ffmpeg I have this log entry:
[local04 @ 000001d9712a6700] [warning] Changing video frame properties on the fly is not supported by all filters.
Perhaps the AddFilter and the decoded AVFrame parameters are inconsistent.