sipsorcery-org / SIPSorceryMedia.FFmpeg

GNU Lesser General Public License v2.1
31 stars 24 forks source link

Is it possible to use custom IO context? #37

Open high-code opened 2 years ago

high-code commented 2 years ago

Hello,

FFMpeg library has possibility to use custom IO context in order to accept memory buffers as input instead of using files. Does this library has possibility to do so? Examples from official ffmpeg doc: https://ffmpeg.org/doxygen/trunk/avio_reading_8c-example.html#a20 https://ffmpeg.org/doxygen/trunk/structAVFormatContext.html#a1e7324262b6b78522e52064daaa7bc87 I've tried to port that functionality in your library but unfortunately System.AccessViolationException thrown when I use custom IO. Here https://stackoverflow.com/questions/41734219/avformat-open-input-fails-only-with-a-custom-io-context I found that this could be due to missing configuration flag in compilation of ffmpeg. Have you think about support of custom IO context in your library?

Any help will be appreciated)

ChristopheI commented 2 years ago

Hi,

I learned to use FFmpeg using samples around - Google search engine was my best friend for this ... And I never used IO Context ... And it's not in my top list of priorities ... But It should be great to add this in this lib :)

If you think it's related to how ffmpeg binaries are compiled, check how they are built , according your environment: For example on Windows: https://www.gyan.dev/ffmpeg/builds/#about-these-builds https://github.com/GyanD/codexffmpeg

Which environment are you using ?

PS: I'm looking for a way to manage incoming RTP paquet directly by FFmpeg to decode Audio and / or Video. It's just in case you know a way to do so ;)

high-code commented 2 years ago

I'm on Windows environment. It seems they do not say which configure flags they turned on in their builds.

ChristopheI commented 2 years ago

Take a look also here: https://github.com/stjeong/ffmpeg_autogen_cs Examples from official FFmpeg web site have been rewritten with FFmpeg.Autogen. Perhaps it will help

ChristopheI commented 2 years ago

Another tips: Once ffmpeg binaries/exceutable are downloaded on your environment you can check elements which are enabled/disabled using: ffmepg -version

Output example: ` ffmpeg version 4.4.1-full_build-www.gyan.dev Copyright (c) 2000-2021 the FFmpeg developers built with gcc 11.2.0 (Rev1, Built by MSYS2 project) configuration: --enable-gpl --enable-version3 --enable-shared --disable-w32threads --disable-autodetect --enable-fontconfig --enable-iconv --enable-gnutls --enable-libxml2 --enable-gmp --enable-lzma --enable-libsnappy --enable-zlib --enable-librist --enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth --enable-libbluray --enable-libcaca --enable-sdl2 --enable-libdav1d --enable-libzvbi --enable-librav1e --enable-libsvtav1 --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-libaom --enable-libopenjpeg --enable-libvpx --enable-libass --enable-frei0r --enable-libfreetype --enable-libfribidi --enable-libvidstab --enable-libvmaf --enable-libzimg --enable-amf --enable-cuda-llvm --enable-cuvid --enable-ffnvcodec --enable-nvdec --enable-nvenc --enable-d3d11va --enable-dxva2 --enable-libmfx --enable-libglslang --enable-vulkan --enable-opencl --enable-libcdio --enable-libgme --enable-libmodplug --enable-libopenmpt --enable-libopencore-amrwb --enable-libmp3lame --enable-libshine --enable-libtheora --enable-libtwolame --enable-libvo-amrwbenc --enable-libilbc --enable-libgsm --enable-libopencore-amrnb --enable-libopus --enable-libspeex --enable-libvorbis --enable-ladspa --enable-libbs2b --enable-libflite --enable-libmysofa --enable-librubberband --enable-libsoxr --enable-chromaprint

libavutil 56. 70.100 / 56. 70.100 libavcodec 58.134.100 / 58.134.100 libavformat 58. 76.100 / 58. 76.100 libavdevice 58. 13.100 / 58. 13.100 libavfilter 7.110.100 / 7.110.100 libswscale 5. 9.100 / 5. 9.100 libswresample 3. 9.100 / 3. 9.100 libpostproc 55. 9.100 / 55. 9.100 `

In my case nothing "important" is disabled. So I guess custom IO context should work with this binaries

ChristopheI commented 1 year ago

Do you have any news about your try to use custom IO context ?

Coud you give me some examples where the use of custom IO context could be helpful ?

If you can share some code too I will be glad to take a look.

Thx