bakjos / FFMPEGMedia

Unreal FFMPEG Plugin to support more video formats and alpha videos
210 stars 55 forks source link

[Request] Specify input format explicitly #2

Closed helldog136 closed 5 years ago

helldog136 commented 5 years ago

Hi,

Is there a way to specify the input format (ie write the "-f" option) for the plugin? I'm working with an mjpeg video flux that is not correctly recognized and i just need to specify this option.

Thanks Helldog136

helldog136 commented 5 years ago

Found it. You should be able to specify the input format in the options and then this should be set in FFMPEGMediaPlayer.cpp at line 306 according to documentation: https://ffmpeg.org/doxygen/2.8/group__lavf__decoding.html#ga10a404346c646e4ab58f4ed798baca32

bakjos commented 5 years ago

The problem with this is that I’m using the Unreal base player and you can only set the options globally and it would apply to all the instances of the FFMPEGPlayer, so it’s posible to add the options but you’ll have to do it using an actor component. The primary target for this plugin is to use it as replacement for the default player when you need more codecs or support for transparent videos

helldog136 commented 5 years ago

I understand the goal of this plugin. Can you maybe point a solution? I've been struggling with this for ages... I'm not familiar with coding plugins for UE. Could you show me how i can hotfix your plugin so it takes only mjpeg streams using the mjpeg demux?

bakjos commented 5 years ago

I guess the easiest way is to specify the format_whitelist or the codec_whitelist, I don't have any video encoded with mjpeg, to test. So you can modify the FFMPEGMediaPlayer class and add something like

FFMPEGMediaPlayer.cpp:298

//this is the demuxer you can see the available formats using ffmpeg -formats av_dict_set(&format_opts, "format_whitelist", "...", AV_DICT_DONT_OVERWRITE);

//this is the demuxer you can see the available formats using ffmpeg -codecs ... av_dict_set(&format_opts, "codec_whitelist", "...", AV_DICT_DONT_OVERWRITE);

or you can specify directly the codec inside de FFMPEGMediaTracks.cpp:1515 FindDecoders(AV_CODEC_ID_MJPEG...)

avcodec_find_decoder(AV_CODEC_ID_MJPEG...)