Last active
April 4, 2018 15:14
-
-
Save DavidBasarab/81c64534d50df50993dc7d62399190c7 to your computer and use it in GitHub Desktop.
FFMPEg Print Codec
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var first_hwaccel = ffmpeg.av_hwaccel_next(null); | |
| var hwaccel = first_hwaccel; | |
| while (hwaccel != null) | |
| { | |
| var codecName = Marshal.PtrToStringAnsi((IntPtr)hwaccel->name); | |
| Log.Error($"{ffmpeg.avcodec_get_name(hwaccel->id)} | ID : {hwaccel->id} | {(int)(hwaccel->id)} | {hwaccel->pix_fmt} | {codecName}"); | |
| var codec = ffmpeg.avcodec_find_encoder_by_name(codecName); | |
| if (codec != null) | |
| { | |
| var nextPointer = (IntPtr)codec->pix_fmts; | |
| var value = Marshal.PtrToStructure<int>(nextPointer); | |
| while (value > 0) | |
| { | |
| Log.Error($" Supported Pixel Format {(AVPixelFormat)value}"); | |
| nextPointer = IntPtr.Add(nextPointer, sizeof(AVPixelFormat)); | |
| value = Marshal.PtrToStructure<int>(nextPointer); | |
| } | |
| } | |
| hwaccel = ffmpeg.av_hwaccel_next(hwaccel); | |
| if (hwaccel == first_hwaccel) break; | |
| } | |
| var codecName = "h264_qsv"; | |
| var codecPointer = ffmpeg.avcodec_find_encoder_by_name(codecName); | |
| if (codecPointer == null) throw new FFMpegException($"Codec {codecName} was not found"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment