Package: deffcode
Releases|Recipes|Documentation|Installation|LicenseDeFFcode - A cross-platformHigh-performance Video Frames Decoderthat flexibly executesFFmpeg pipeline inside a subprocess pipe for generating real-time, low-overhead,lightning fast video frames with robust error-handlingin just a few lines of python code ⚡Highly Adaptive -DeFFcode APIs implements astandalone highly-extensible wrapper aroundFFmpegmultimedia framework. These APIssupports a wide-ranging media streams as inputsource such as [live USB/Virtual/IP camera feeds][capturing-and-previewing-frames-from-a-webcam],regular multimedia files,screen recordings,image sequences,network URL schemes(such as HTTP(s), RTP/RSTP, etc.), so on and so forth.Highly Flexible -DeFFcode APIs gains an edge over other FFmpeg Wrappers by providingcomplete control over the underline pipelineincludingaccess to almost any FFmpeg specification thinkablesuch as specifying framerate, resolution, hardware decoder(s), filtergraph(s), and pixel-format(s) that are readilysupported by all well known Computer Vision libraries.Highly Convenient -FFmpeg has a steep learning curve especially for users unfamiliar with a command line interface. DeFFcode helps users by providing similar to OpenCV,Index based Camera Device Capturingand thesame standardOpenCV-Python(Python API for OpenCV) coding syntax for its APIs, thereby making it eveneasier to learn, create, and develop FFmpeg based appsin Python.Key features of DeFFcodeHere are some key features that stand out:High-performance, low-overhead video frames decoding with robust error-handling.Flexible API with access to almost any FFmpeg specification thinkable.Supports a wide-range of media streams/devices/protocols as input source.Curated list of well-documented recipes ranging fromBasictoAdvancedskill levels.Hands down the easiestIndex based Camera Device Capturing, similar to OpenCV.Easy to codeReal-timeSimple&ComplexFiltergraphs.(Yes, You read it correctly "Real-time"!)Lightning fast dedicatedGPU-Accelerated VideoDecoding&Transcoding.Enables precise FFmpegKey-frame Seekingwith pinpoint accuracy.EffortlessMetadata Extractionfrom all streams available in the source.Maintains the standard easy to learnOpenCV-Pythoncoding syntax.Out-of-the-box support for all prominent Computer Vision libraries.Cross-platform, runs on Python 3.7+, and easy to install.Getting Started📚 Documentation:https://abhitronix.github.io/deffcodeInstallation:If this is your first time using DeFFcode, head straight to theInstallation Notesto install DeFFcode on your machine.Recipesa.k.aExamples:Once you have DeFFcode installed, checkout our Well-DocumentedRecipes 🍱for usage examples:NoteIn case you're run into any problems, consult ourHelp section.A.Basic Recipes 🍰:Recipes for beginners of any skill level to get started.Big Buck Bunny Reversed using Live Simple FiltergraphBasic Decoding RecipesAccessing RGB frames from a video fileCapturing and Previewing BGR frames from a video file(OpenCV Support)Playing with any other FFmpeg pixel formatsCapturing and Previewing frames from a Looping VideoEnumerating all Camera Devices with IndexesCapturing and Previewing frames from a Camera using IndexesCapturing and Previewing frames from a HTTPs StreamCapturing and Previewing frames from a RTSP/RTP StreamCapturing and Previewing frames from Sequence of imagesCapturing and Previewing frames from Single looping imageBasic Transcoding RecipesTranscoding video using OpenCV VideoWriter APITranscoding lossless video using WriteGear APITranscoding Trimmed and Reversed videoTranscoding Cropped videoTranscoding Rotated video (withrotatefilter)Transcoding Rotated video (withtransposefilter)Transcoding Horizontally flipped and Scaled videoExtracting Key-frames as PNG imageGenerating Thumbnail with a Fancy filterBasic Metadata RecipesExtracting video metadata using Sourcer APIExtracting video metadata using FFdecoder APIB.Advanced Recipes 🥐:Recipes to take your skills to the next level.Live Mandelbrot pattern with a Vectorscope & two WaveformsAdvanced Decoding RecipesGenerate and Decode frames from Sierpinski patternGenerate and Decode frames from Test Source patternGenerate and Decode frames from Gradients with custom Text effectGenerate and Decode frames from Mandelbrot test pattern with vectorscope & waveformsGenerate and Decode frames from Game of Life VisualizationCapturing and Previewing frames from a Webcam using Custom DemuxerCapturing and Previewing frames from your Desktop(Screen Recording)CUVID-accelerated Hardware-based Video Decoding and PreviewingCUDA-accelerated Hardware-based Video Decoding and PreviewingAdvanced Transcoding RecipesTranscoding video with Live Custom watermark image overlayTranscoding video from sequence of Images with additional filteringTranscoding video art with YUV Bitplane VisualizationTranscoding video art with Jetcolor effectTranscoding video art with Ghosting effectTranscoding video art with Pixelation effectCUDA-accelerated Video Transcoding with OpenCV's VideoWriter APICUDA-NVENC-accelerated Video Transcoding with WriteGear APICUDA-NVENC-accelerated End-to-end Lossless Video Transcoding with WriteGear APIAdvanced Metadata RecipesAdded new attributes to metadata in FFdecoder APIOverriding source video metadata in FFdecoder APIAPI in a nutshell:As a user, you just have to remember only two DeFFcode APIs, namely:A. FFdecoder APIThe primary function ofFFdecoder APIis todecode 24-bit RGB video framesfrom the given source:NoteSeeAPI Referencefor more in-depth information.# import the necessary packagesfromdeffcodeimportFFdecoder# formulate the decoder with suitable sourcedecoder=FFdecoder("https://abhitronix.github.io/html/Big_Buck_Bunny_1080_10s_1MB.mp4").formulate()# grab RGB24(default) 3D frames from decoderforframeindecoder.generateFrame():# lets print its shapeprint(frame.shape)# (1080, 1920, 3)# terminate the decoderdecoder.terminate()B. Sourcer APIThe primary function ofSourcer APIis togather metadata information from all multimedia streams availablein the given source:# import the necessary packagesfromdeffcodeimportSourcer# initialize and formulate the decoder using suitable sourcesourcer=Sourcer("https://abhitronix.github.io/html/Big_Buck_Bunny_1080_10s_1MB.mp4").probe_stream()# print metadata as `json.dump`print(sourcer.retrieve_metadata(pretty_json=True))The resultant Terminal Output will look something as following on Windows machine{"ffmpeg_binary_path":"C:\\Users\\foo\\AppData\\Local\\Temp\\ffmpeg-static-win64-gpl/bin/ffmpeg.exe","source":"https://abhitronix.github.io/html/Big_Buck_Bunny_1080_10s_1MB.mp4","source_extension":".mp4","source_video_resolution":[1920,1080],"source_video_framerate":60.0,"source_video_pixfmt":"yuv420p","source_video_decoder":"h264","source_duration_sec":10.0,"approx_video_nframes":600,"source_video_bitrate":"832k","source_audio_bitrate":"","source_audio_samplerate":"","source_has_video":true,"source_has_audio":false,"source_has_image_sequence":false}ContributionsWe're happy to meet new contributors💗We welcome your contributions to help us improve and extend this project. If you want to get involved with VidGear development, checkout theContribution Guidelines ▶️We're offering support for DeFFcode onGitter Community Channel. Come and join the conversation over there!DonationsDeFFcode is free and open source and will always remain so. ❤️It is something I am doing with my own free time. But so much more needs to be done, and I need your help to do this. For just the price of a cup of coffee, you can make a difference 🙂CitationHere is a Bibtex entry you can use to cite this project in a publication:@software{deffcode,author={Abhishek Singh Thakur},title={abhiTronix/deffcode: v0.2.4},month=oct,year=2022,publisher={Zenodo},version={v0.2.4},doi={10.5281/zenodo.7155399},url={https://doi.org/10.5281/zenodo.7155399}}CopyrightCopyright (c) abhiTronix 2021This library is released under theApache 2.0 License.