dlib/examples/ffmpeg_info_ex.cpp

98 lines
3.8 KiB
C++
Raw Normal View History

FFMPEG wrappers: dlib::ffmpeg::decoder and dlib::ffmpeg::demuxer (#2707) * - added ffmpeg stuff to cmake * - added observer_ptr * ffmpeg utils * WIP * - added ffmpeg_decoder * config file for test data * another test file * install ffmpeg * added ffmpeg_demuxer * install all ffmpeg libraries * support older version of ffmpeg * simplified loop * - test converting to dlib object - added docs - support older ffmpeg * added convert() overload * added comment * only register stuff when API not deprecated * - fixed version issues - fixed decoding * added tests for ffmpeg_demuxer * removed unused code * test GIF * added docs * added audio test * test for audio * more tests * review changes * don't need observer_ptr * made deps public. I could be wrong but just in case. * - added some static asserts. Some areas of the code might do memcpy's on arrays of pixels. This requires the structures to be packed. Check this. - added convert() functions - changed default decoder options. By default, always decode to RGB and S16 audio - added convenience constructor to demuxer * - no longer need opencv * oops. I let that slip * - made a few functions public - more precise requires clauses * enhanced example * - avoid FFMPEG_INITIALIZED being optimized away at link time - added decoding example * - avoid -Wunused-parameter error * constexpr and noexcept correctness. This probably makes no difference to performance, BUT, it's what the core guidelines tell you to do. It does however demonstrate how complicated and unecessarily verbose C++ is becoming. Sigh, maybe one day i'll make the switch to something that doesn't make my eyes twitch. * - simplified metadata structure * hopefully more educational * added another example * ditto * typo * screen grab example * whoops * avoid -Wunused-parameter errors * ditto * - added methods to av_dict - print the demuxer format options that were not used - enhanced webcam_face_pose_ex.cpp so you can set webcam options * if height and width are specified, attempt to set video_size in format_options. Otherwise set the bilinear resizer. * updated docs * once again, the ffmpeg APIs do a lot for you. It's a matter of knowing which APIs to call. * made header-only * - some Werror thing * don't use type_safe_union * - templated sample type - reverted deep copy of AVFrame for frame copy constructor * - added is_pixel_type and is_pixel_check * unit tests for pixel traits * enhanced is_image_type type trait and added is_image_check * added unit tests for is_image_type * added pix_traits, improved convert() functions * bug fix * get rid of -Werror=unused-variable error * added a type alias * that's the last of the manual memcpys gone. We'using ffmpeg API everywhere now for copying frames to buffers and back * missing doc * set framerate for webcam * list input devices * oops. I was trying to make ffmpeg 5 happy but i've given up on ffmpeg v5 compatibility in this PR. Future PR. * enhanced the information provided by list_input_devices and list_output_devices * removed vscode settings.json file * - added a type trait for checking whether a type is complete. This is useful for writing type traits that check other types have type trait specializations. But also other useful things. For example, std::unique_ptr uses something similar to this. * Davis was keen to simply check pixel_traits is specialised. That's equivalent to checking pixel_traits<> is complete for some type * code review * juse use the void_t in dlib/type_traits.h * one liners * just need is_image_check * more tests for is_image_type * i think this is correct * removed printf * better docs * Keep opencv out of it * keep old face pose example, then add new one which uses dlib's ffmpeg wrappers * revert * revert * better docs * better docs --------- Co-authored-by: pf <pf@me>
2023-01-30 09:17:34 +08:00
// The contents of this file are in the public domain. See LICENSE_FOR_EXAMPLE_PROGRAMS.txt
/*
This is an example illustrating some of the functional ffmpeg wrapper APIs.
It demonstrates how to list the supported codecs, muxers, demuxers and protocols
in your installation of ffmpeg (or the one dlib built against).
It also demonstrates how to check ffmpeg library versions programmatically.
*/
#include <iostream>
#include <iomanip>
#include <dlib/media/ffmpeg_utils.h>
using namespace std;
using namespace dlib;
int main()
{
// List all codecs supported by this installation of ffmpeg libraries
const auto codecs = ffmpeg::list_codecs();
FFMPEG : misc + ffmpeg5 support (#2746) * - enhanced list_muxers() - added fail() error handling helper function - moved framerate setting to decoder_image_args * docs * oops * - don't use std::endl, use `\n` instead - use fail(). See, on average, it removes lines of code * convenient constructor for demuxer * ffmpeg5 support * added docs for == -1 * oops * grouping audio channel compatibility stuff together * more compatibility stuff * more channel abstractions * build with ffmpeg 5 * install assembler * cache the installation * cmake doesn't like using ~ in filepath * at some point this will work * i think i need to change the key * test FFmpeg-n5.1.3_try3 cache * bug fix * Update build_cpp.yml Giving this another go * Update build_cpp.yml Disable building documentation and CLI tools * Update CMakeLists.txt Fix cmake script when using 3.8.0 and expecting imported targets to work when there are link flags included * - use environment variables - on ubuntu 18 gcc7, use ffmpeg 3.2.18 * correct way of dereferencing variables ? * can't get variables to work * Revert "can't get variables to work" This reverts commit 5eef96a43ef9e04bc7780abfce75e1bb2f0ca25f. * Revert "correct way of dereferencing variables ?" This reverts commit e8ff95f5c6c317bc8f3e6dde4b017a533c6806b3. * Revert "- use environment variables" This reverts commit a6938333d555d64e6cddcb7482ab579827ba6dfb. * using ffmpeg 3.2.18 with ubuntu18 gcc7 * Update build_cpp.yml Disable ubuntu18 job for now. Hopefully no more cancelled jobs, then i can re-enable * Re-enabled ubuntu18 job. Hopefully this time it won't get cancelled * Fixed bad indentation * Can go in details namespace * Update dlib/CMakeLists.txt Co-authored-by: Davis E. King <davis685@gmail.com> * use details namespace * remove declaration. It's in details now * don't need get_channels_from_layout() --------- Co-authored-by: pf <pf@me> Co-authored-by: Davis E. King <davis685@gmail.com>
2023-03-30 10:12:47 +08:00
cout << "Supported codecs:\n";
FFMPEG wrappers: dlib::ffmpeg::decoder and dlib::ffmpeg::demuxer (#2707) * - added ffmpeg stuff to cmake * - added observer_ptr * ffmpeg utils * WIP * - added ffmpeg_decoder * config file for test data * another test file * install ffmpeg * added ffmpeg_demuxer * install all ffmpeg libraries * support older version of ffmpeg * simplified loop * - test converting to dlib object - added docs - support older ffmpeg * added convert() overload * added comment * only register stuff when API not deprecated * - fixed version issues - fixed decoding * added tests for ffmpeg_demuxer * removed unused code * test GIF * added docs * added audio test * test for audio * more tests * review changes * don't need observer_ptr * made deps public. I could be wrong but just in case. * - added some static asserts. Some areas of the code might do memcpy's on arrays of pixels. This requires the structures to be packed. Check this. - added convert() functions - changed default decoder options. By default, always decode to RGB and S16 audio - added convenience constructor to demuxer * - no longer need opencv * oops. I let that slip * - made a few functions public - more precise requires clauses * enhanced example * - avoid FFMPEG_INITIALIZED being optimized away at link time - added decoding example * - avoid -Wunused-parameter error * constexpr and noexcept correctness. This probably makes no difference to performance, BUT, it's what the core guidelines tell you to do. It does however demonstrate how complicated and unecessarily verbose C++ is becoming. Sigh, maybe one day i'll make the switch to something that doesn't make my eyes twitch. * - simplified metadata structure * hopefully more educational * added another example * ditto * typo * screen grab example * whoops * avoid -Wunused-parameter errors * ditto * - added methods to av_dict - print the demuxer format options that were not used - enhanced webcam_face_pose_ex.cpp so you can set webcam options * if height and width are specified, attempt to set video_size in format_options. Otherwise set the bilinear resizer. * updated docs * once again, the ffmpeg APIs do a lot for you. It's a matter of knowing which APIs to call. * made header-only * - some Werror thing * don't use type_safe_union * - templated sample type - reverted deep copy of AVFrame for frame copy constructor * - added is_pixel_type and is_pixel_check * unit tests for pixel traits * enhanced is_image_type type trait and added is_image_check * added unit tests for is_image_type * added pix_traits, improved convert() functions * bug fix * get rid of -Werror=unused-variable error * added a type alias * that's the last of the manual memcpys gone. We'using ffmpeg API everywhere now for copying frames to buffers and back * missing doc * set framerate for webcam * list input devices * oops. I was trying to make ffmpeg 5 happy but i've given up on ffmpeg v5 compatibility in this PR. Future PR. * enhanced the information provided by list_input_devices and list_output_devices * removed vscode settings.json file * - added a type trait for checking whether a type is complete. This is useful for writing type traits that check other types have type trait specializations. But also other useful things. For example, std::unique_ptr uses something similar to this. * Davis was keen to simply check pixel_traits is specialised. That's equivalent to checking pixel_traits<> is complete for some type * code review * juse use the void_t in dlib/type_traits.h * one liners * just need is_image_check * more tests for is_image_type * i think this is correct * removed printf * better docs * Keep opencv out of it * keep old face pose example, then add new one which uses dlib's ffmpeg wrappers * revert * revert * better docs * better docs --------- Co-authored-by: pf <pf@me>
2023-01-30 09:17:34 +08:00
for (const auto& codec : codecs)
FFMPEG : misc + ffmpeg5 support (#2746) * - enhanced list_muxers() - added fail() error handling helper function - moved framerate setting to decoder_image_args * docs * oops * - don't use std::endl, use `\n` instead - use fail(). See, on average, it removes lines of code * convenient constructor for demuxer * ffmpeg5 support * added docs for == -1 * oops * grouping audio channel compatibility stuff together * more compatibility stuff * more channel abstractions * build with ffmpeg 5 * install assembler * cache the installation * cmake doesn't like using ~ in filepath * at some point this will work * i think i need to change the key * test FFmpeg-n5.1.3_try3 cache * bug fix * Update build_cpp.yml Giving this another go * Update build_cpp.yml Disable building documentation and CLI tools * Update CMakeLists.txt Fix cmake script when using 3.8.0 and expecting imported targets to work when there are link flags included * - use environment variables - on ubuntu 18 gcc7, use ffmpeg 3.2.18 * correct way of dereferencing variables ? * can't get variables to work * Revert "can't get variables to work" This reverts commit 5eef96a43ef9e04bc7780abfce75e1bb2f0ca25f. * Revert "correct way of dereferencing variables ?" This reverts commit e8ff95f5c6c317bc8f3e6dde4b017a533c6806b3. * Revert "- use environment variables" This reverts commit a6938333d555d64e6cddcb7482ab579827ba6dfb. * using ffmpeg 3.2.18 with ubuntu18 gcc7 * Update build_cpp.yml Disable ubuntu18 job for now. Hopefully no more cancelled jobs, then i can re-enable * Re-enabled ubuntu18 job. Hopefully this time it won't get cancelled * Fixed bad indentation * Can go in details namespace * Update dlib/CMakeLists.txt Co-authored-by: Davis E. King <davis685@gmail.com> * use details namespace * remove declaration. It's in details now * don't need get_channels_from_layout() --------- Co-authored-by: pf <pf@me> Co-authored-by: Davis E. King <davis685@gmail.com>
2023-03-30 10:12:47 +08:00
cout << " name : " << left << setw(20) << codec.codec_name << " id : " << codec.codec_id << " : encoding supported " << codec.supports_encoding << " decoding supported " << codec.supports_decoding << '\n';
cout << '\n';
FFMPEG wrappers: dlib::ffmpeg::decoder and dlib::ffmpeg::demuxer (#2707) * - added ffmpeg stuff to cmake * - added observer_ptr * ffmpeg utils * WIP * - added ffmpeg_decoder * config file for test data * another test file * install ffmpeg * added ffmpeg_demuxer * install all ffmpeg libraries * support older version of ffmpeg * simplified loop * - test converting to dlib object - added docs - support older ffmpeg * added convert() overload * added comment * only register stuff when API not deprecated * - fixed version issues - fixed decoding * added tests for ffmpeg_demuxer * removed unused code * test GIF * added docs * added audio test * test for audio * more tests * review changes * don't need observer_ptr * made deps public. I could be wrong but just in case. * - added some static asserts. Some areas of the code might do memcpy's on arrays of pixels. This requires the structures to be packed. Check this. - added convert() functions - changed default decoder options. By default, always decode to RGB and S16 audio - added convenience constructor to demuxer * - no longer need opencv * oops. I let that slip * - made a few functions public - more precise requires clauses * enhanced example * - avoid FFMPEG_INITIALIZED being optimized away at link time - added decoding example * - avoid -Wunused-parameter error * constexpr and noexcept correctness. This probably makes no difference to performance, BUT, it's what the core guidelines tell you to do. It does however demonstrate how complicated and unecessarily verbose C++ is becoming. Sigh, maybe one day i'll make the switch to something that doesn't make my eyes twitch. * - simplified metadata structure * hopefully more educational * added another example * ditto * typo * screen grab example * whoops * avoid -Wunused-parameter errors * ditto * - added methods to av_dict - print the demuxer format options that were not used - enhanced webcam_face_pose_ex.cpp so you can set webcam options * if height and width are specified, attempt to set video_size in format_options. Otherwise set the bilinear resizer. * updated docs * once again, the ffmpeg APIs do a lot for you. It's a matter of knowing which APIs to call. * made header-only * - some Werror thing * don't use type_safe_union * - templated sample type - reverted deep copy of AVFrame for frame copy constructor * - added is_pixel_type and is_pixel_check * unit tests for pixel traits * enhanced is_image_type type trait and added is_image_check * added unit tests for is_image_type * added pix_traits, improved convert() functions * bug fix * get rid of -Werror=unused-variable error * added a type alias * that's the last of the manual memcpys gone. We'using ffmpeg API everywhere now for copying frames to buffers and back * missing doc * set framerate for webcam * list input devices * oops. I was trying to make ffmpeg 5 happy but i've given up on ffmpeg v5 compatibility in this PR. Future PR. * enhanced the information provided by list_input_devices and list_output_devices * removed vscode settings.json file * - added a type trait for checking whether a type is complete. This is useful for writing type traits that check other types have type trait specializations. But also other useful things. For example, std::unique_ptr uses something similar to this. * Davis was keen to simply check pixel_traits is specialised. That's equivalent to checking pixel_traits<> is complete for some type * code review * juse use the void_t in dlib/type_traits.h * one liners * just need is_image_check * more tests for is_image_type * i think this is correct * removed printf * better docs * Keep opencv out of it * keep old face pose example, then add new one which uses dlib's ffmpeg wrappers * revert * revert * better docs * better docs --------- Co-authored-by: pf <pf@me>
2023-01-30 09:17:34 +08:00
// List all demuxers supported by this installation of ffmpeg libraries
const auto demuxers = ffmpeg::list_demuxers();
FFMPEG : misc + ffmpeg5 support (#2746) * - enhanced list_muxers() - added fail() error handling helper function - moved framerate setting to decoder_image_args * docs * oops * - don't use std::endl, use `\n` instead - use fail(). See, on average, it removes lines of code * convenient constructor for demuxer * ffmpeg5 support * added docs for == -1 * oops * grouping audio channel compatibility stuff together * more compatibility stuff * more channel abstractions * build with ffmpeg 5 * install assembler * cache the installation * cmake doesn't like using ~ in filepath * at some point this will work * i think i need to change the key * test FFmpeg-n5.1.3_try3 cache * bug fix * Update build_cpp.yml Giving this another go * Update build_cpp.yml Disable building documentation and CLI tools * Update CMakeLists.txt Fix cmake script when using 3.8.0 and expecting imported targets to work when there are link flags included * - use environment variables - on ubuntu 18 gcc7, use ffmpeg 3.2.18 * correct way of dereferencing variables ? * can't get variables to work * Revert "can't get variables to work" This reverts commit 5eef96a43ef9e04bc7780abfce75e1bb2f0ca25f. * Revert "correct way of dereferencing variables ?" This reverts commit e8ff95f5c6c317bc8f3e6dde4b017a533c6806b3. * Revert "- use environment variables" This reverts commit a6938333d555d64e6cddcb7482ab579827ba6dfb. * using ffmpeg 3.2.18 with ubuntu18 gcc7 * Update build_cpp.yml Disable ubuntu18 job for now. Hopefully no more cancelled jobs, then i can re-enable * Re-enabled ubuntu18 job. Hopefully this time it won't get cancelled * Fixed bad indentation * Can go in details namespace * Update dlib/CMakeLists.txt Co-authored-by: Davis E. King <davis685@gmail.com> * use details namespace * remove declaration. It's in details now * don't need get_channels_from_layout() --------- Co-authored-by: pf <pf@me> Co-authored-by: Davis E. King <davis685@gmail.com>
2023-03-30 10:12:47 +08:00
cout << "Supported demuxers:\n";
FFMPEG wrappers: dlib::ffmpeg::decoder and dlib::ffmpeg::demuxer (#2707) * - added ffmpeg stuff to cmake * - added observer_ptr * ffmpeg utils * WIP * - added ffmpeg_decoder * config file for test data * another test file * install ffmpeg * added ffmpeg_demuxer * install all ffmpeg libraries * support older version of ffmpeg * simplified loop * - test converting to dlib object - added docs - support older ffmpeg * added convert() overload * added comment * only register stuff when API not deprecated * - fixed version issues - fixed decoding * added tests for ffmpeg_demuxer * removed unused code * test GIF * added docs * added audio test * test for audio * more tests * review changes * don't need observer_ptr * made deps public. I could be wrong but just in case. * - added some static asserts. Some areas of the code might do memcpy's on arrays of pixels. This requires the structures to be packed. Check this. - added convert() functions - changed default decoder options. By default, always decode to RGB and S16 audio - added convenience constructor to demuxer * - no longer need opencv * oops. I let that slip * - made a few functions public - more precise requires clauses * enhanced example * - avoid FFMPEG_INITIALIZED being optimized away at link time - added decoding example * - avoid -Wunused-parameter error * constexpr and noexcept correctness. This probably makes no difference to performance, BUT, it's what the core guidelines tell you to do. It does however demonstrate how complicated and unecessarily verbose C++ is becoming. Sigh, maybe one day i'll make the switch to something that doesn't make my eyes twitch. * - simplified metadata structure * hopefully more educational * added another example * ditto * typo * screen grab example * whoops * avoid -Wunused-parameter errors * ditto * - added methods to av_dict - print the demuxer format options that were not used - enhanced webcam_face_pose_ex.cpp so you can set webcam options * if height and width are specified, attempt to set video_size in format_options. Otherwise set the bilinear resizer. * updated docs * once again, the ffmpeg APIs do a lot for you. It's a matter of knowing which APIs to call. * made header-only * - some Werror thing * don't use type_safe_union * - templated sample type - reverted deep copy of AVFrame for frame copy constructor * - added is_pixel_type and is_pixel_check * unit tests for pixel traits * enhanced is_image_type type trait and added is_image_check * added unit tests for is_image_type * added pix_traits, improved convert() functions * bug fix * get rid of -Werror=unused-variable error * added a type alias * that's the last of the manual memcpys gone. We'using ffmpeg API everywhere now for copying frames to buffers and back * missing doc * set framerate for webcam * list input devices * oops. I was trying to make ffmpeg 5 happy but i've given up on ffmpeg v5 compatibility in this PR. Future PR. * enhanced the information provided by list_input_devices and list_output_devices * removed vscode settings.json file * - added a type trait for checking whether a type is complete. This is useful for writing type traits that check other types have type trait specializations. But also other useful things. For example, std::unique_ptr uses something similar to this. * Davis was keen to simply check pixel_traits is specialised. That's equivalent to checking pixel_traits<> is complete for some type * code review * juse use the void_t in dlib/type_traits.h * one liners * just need is_image_check * more tests for is_image_type * i think this is correct * removed printf * better docs * Keep opencv out of it * keep old face pose example, then add new one which uses dlib's ffmpeg wrappers * revert * revert * better docs * better docs --------- Co-authored-by: pf <pf@me>
2023-01-30 09:17:34 +08:00
for (const auto& demuxer : demuxers)
FFMPEG : misc + ffmpeg5 support (#2746) * - enhanced list_muxers() - added fail() error handling helper function - moved framerate setting to decoder_image_args * docs * oops * - don't use std::endl, use `\n` instead - use fail(). See, on average, it removes lines of code * convenient constructor for demuxer * ffmpeg5 support * added docs for == -1 * oops * grouping audio channel compatibility stuff together * more compatibility stuff * more channel abstractions * build with ffmpeg 5 * install assembler * cache the installation * cmake doesn't like using ~ in filepath * at some point this will work * i think i need to change the key * test FFmpeg-n5.1.3_try3 cache * bug fix * Update build_cpp.yml Giving this another go * Update build_cpp.yml Disable building documentation and CLI tools * Update CMakeLists.txt Fix cmake script when using 3.8.0 and expecting imported targets to work when there are link flags included * - use environment variables - on ubuntu 18 gcc7, use ffmpeg 3.2.18 * correct way of dereferencing variables ? * can't get variables to work * Revert "can't get variables to work" This reverts commit 5eef96a43ef9e04bc7780abfce75e1bb2f0ca25f. * Revert "correct way of dereferencing variables ?" This reverts commit e8ff95f5c6c317bc8f3e6dde4b017a533c6806b3. * Revert "- use environment variables" This reverts commit a6938333d555d64e6cddcb7482ab579827ba6dfb. * using ffmpeg 3.2.18 with ubuntu18 gcc7 * Update build_cpp.yml Disable ubuntu18 job for now. Hopefully no more cancelled jobs, then i can re-enable * Re-enabled ubuntu18 job. Hopefully this time it won't get cancelled * Fixed bad indentation * Can go in details namespace * Update dlib/CMakeLists.txt Co-authored-by: Davis E. King <davis685@gmail.com> * use details namespace * remove declaration. It's in details now * don't need get_channels_from_layout() --------- Co-authored-by: pf <pf@me> Co-authored-by: Davis E. King <davis685@gmail.com>
2023-03-30 10:12:47 +08:00
cout << " name : " << demuxer << '\n';
cout << '\n';
FFMPEG wrappers: dlib::ffmpeg::decoder and dlib::ffmpeg::demuxer (#2707) * - added ffmpeg stuff to cmake * - added observer_ptr * ffmpeg utils * WIP * - added ffmpeg_decoder * config file for test data * another test file * install ffmpeg * added ffmpeg_demuxer * install all ffmpeg libraries * support older version of ffmpeg * simplified loop * - test converting to dlib object - added docs - support older ffmpeg * added convert() overload * added comment * only register stuff when API not deprecated * - fixed version issues - fixed decoding * added tests for ffmpeg_demuxer * removed unused code * test GIF * added docs * added audio test * test for audio * more tests * review changes * don't need observer_ptr * made deps public. I could be wrong but just in case. * - added some static asserts. Some areas of the code might do memcpy's on arrays of pixels. This requires the structures to be packed. Check this. - added convert() functions - changed default decoder options. By default, always decode to RGB and S16 audio - added convenience constructor to demuxer * - no longer need opencv * oops. I let that slip * - made a few functions public - more precise requires clauses * enhanced example * - avoid FFMPEG_INITIALIZED being optimized away at link time - added decoding example * - avoid -Wunused-parameter error * constexpr and noexcept correctness. This probably makes no difference to performance, BUT, it's what the core guidelines tell you to do. It does however demonstrate how complicated and unecessarily verbose C++ is becoming. Sigh, maybe one day i'll make the switch to something that doesn't make my eyes twitch. * - simplified metadata structure * hopefully more educational * added another example * ditto * typo * screen grab example * whoops * avoid -Wunused-parameter errors * ditto * - added methods to av_dict - print the demuxer format options that were not used - enhanced webcam_face_pose_ex.cpp so you can set webcam options * if height and width are specified, attempt to set video_size in format_options. Otherwise set the bilinear resizer. * updated docs * once again, the ffmpeg APIs do a lot for you. It's a matter of knowing which APIs to call. * made header-only * - some Werror thing * don't use type_safe_union * - templated sample type - reverted deep copy of AVFrame for frame copy constructor * - added is_pixel_type and is_pixel_check * unit tests for pixel traits * enhanced is_image_type type trait and added is_image_check * added unit tests for is_image_type * added pix_traits, improved convert() functions * bug fix * get rid of -Werror=unused-variable error * added a type alias * that's the last of the manual memcpys gone. We'using ffmpeg API everywhere now for copying frames to buffers and back * missing doc * set framerate for webcam * list input devices * oops. I was trying to make ffmpeg 5 happy but i've given up on ffmpeg v5 compatibility in this PR. Future PR. * enhanced the information provided by list_input_devices and list_output_devices * removed vscode settings.json file * - added a type trait for checking whether a type is complete. This is useful for writing type traits that check other types have type trait specializations. But also other useful things. For example, std::unique_ptr uses something similar to this. * Davis was keen to simply check pixel_traits is specialised. That's equivalent to checking pixel_traits<> is complete for some type * code review * juse use the void_t in dlib/type_traits.h * one liners * just need is_image_check * more tests for is_image_type * i think this is correct * removed printf * better docs * Keep opencv out of it * keep old face pose example, then add new one which uses dlib's ffmpeg wrappers * revert * revert * better docs * better docs --------- Co-authored-by: pf <pf@me>
2023-01-30 09:17:34 +08:00
// List all muxers supported by this installation of ffmpeg libraries
FFMPEG : misc + ffmpeg5 support (#2746) * - enhanced list_muxers() - added fail() error handling helper function - moved framerate setting to decoder_image_args * docs * oops * - don't use std::endl, use `\n` instead - use fail(). See, on average, it removes lines of code * convenient constructor for demuxer * ffmpeg5 support * added docs for == -1 * oops * grouping audio channel compatibility stuff together * more compatibility stuff * more channel abstractions * build with ffmpeg 5 * install assembler * cache the installation * cmake doesn't like using ~ in filepath * at some point this will work * i think i need to change the key * test FFmpeg-n5.1.3_try3 cache * bug fix * Update build_cpp.yml Giving this another go * Update build_cpp.yml Disable building documentation and CLI tools * Update CMakeLists.txt Fix cmake script when using 3.8.0 and expecting imported targets to work when there are link flags included * - use environment variables - on ubuntu 18 gcc7, use ffmpeg 3.2.18 * correct way of dereferencing variables ? * can't get variables to work * Revert "can't get variables to work" This reverts commit 5eef96a43ef9e04bc7780abfce75e1bb2f0ca25f. * Revert "correct way of dereferencing variables ?" This reverts commit e8ff95f5c6c317bc8f3e6dde4b017a533c6806b3. * Revert "- use environment variables" This reverts commit a6938333d555d64e6cddcb7482ab579827ba6dfb. * using ffmpeg 3.2.18 with ubuntu18 gcc7 * Update build_cpp.yml Disable ubuntu18 job for now. Hopefully no more cancelled jobs, then i can re-enable * Re-enabled ubuntu18 job. Hopefully this time it won't get cancelled * Fixed bad indentation * Can go in details namespace * Update dlib/CMakeLists.txt Co-authored-by: Davis E. King <davis685@gmail.com> * use details namespace * remove declaration. It's in details now * don't need get_channels_from_layout() --------- Co-authored-by: pf <pf@me> Co-authored-by: Davis E. King <davis685@gmail.com>
2023-03-30 10:12:47 +08:00
cout << "Supported muxers:\n";
for (const auto& muxer : ffmpeg::list_muxers())
{
cout << " name : " << muxer.name << '\n';
if (!muxer.supported_codecs.empty())
{
cout << " supported codecs:\n";
for (const auto& codec : muxer.supported_codecs)
cout << " " << codec.codec_name << '\n';
}
}
cout << '\n';
FFMPEG wrappers: dlib::ffmpeg::decoder and dlib::ffmpeg::demuxer (#2707) * - added ffmpeg stuff to cmake * - added observer_ptr * ffmpeg utils * WIP * - added ffmpeg_decoder * config file for test data * another test file * install ffmpeg * added ffmpeg_demuxer * install all ffmpeg libraries * support older version of ffmpeg * simplified loop * - test converting to dlib object - added docs - support older ffmpeg * added convert() overload * added comment * only register stuff when API not deprecated * - fixed version issues - fixed decoding * added tests for ffmpeg_demuxer * removed unused code * test GIF * added docs * added audio test * test for audio * more tests * review changes * don't need observer_ptr * made deps public. I could be wrong but just in case. * - added some static asserts. Some areas of the code might do memcpy's on arrays of pixels. This requires the structures to be packed. Check this. - added convert() functions - changed default decoder options. By default, always decode to RGB and S16 audio - added convenience constructor to demuxer * - no longer need opencv * oops. I let that slip * - made a few functions public - more precise requires clauses * enhanced example * - avoid FFMPEG_INITIALIZED being optimized away at link time - added decoding example * - avoid -Wunused-parameter error * constexpr and noexcept correctness. This probably makes no difference to performance, BUT, it's what the core guidelines tell you to do. It does however demonstrate how complicated and unecessarily verbose C++ is becoming. Sigh, maybe one day i'll make the switch to something that doesn't make my eyes twitch. * - simplified metadata structure * hopefully more educational * added another example * ditto * typo * screen grab example * whoops * avoid -Wunused-parameter errors * ditto * - added methods to av_dict - print the demuxer format options that were not used - enhanced webcam_face_pose_ex.cpp so you can set webcam options * if height and width are specified, attempt to set video_size in format_options. Otherwise set the bilinear resizer. * updated docs * once again, the ffmpeg APIs do a lot for you. It's a matter of knowing which APIs to call. * made header-only * - some Werror thing * don't use type_safe_union * - templated sample type - reverted deep copy of AVFrame for frame copy constructor * - added is_pixel_type and is_pixel_check * unit tests for pixel traits * enhanced is_image_type type trait and added is_image_check * added unit tests for is_image_type * added pix_traits, improved convert() functions * bug fix * get rid of -Werror=unused-variable error * added a type alias * that's the last of the manual memcpys gone. We'using ffmpeg API everywhere now for copying frames to buffers and back * missing doc * set framerate for webcam * list input devices * oops. I was trying to make ffmpeg 5 happy but i've given up on ffmpeg v5 compatibility in this PR. Future PR. * enhanced the information provided by list_input_devices and list_output_devices * removed vscode settings.json file * - added a type trait for checking whether a type is complete. This is useful for writing type traits that check other types have type trait specializations. But also other useful things. For example, std::unique_ptr uses something similar to this. * Davis was keen to simply check pixel_traits is specialised. That's equivalent to checking pixel_traits<> is complete for some type * code review * juse use the void_t in dlib/type_traits.h * one liners * just need is_image_check * more tests for is_image_type * i think this is correct * removed printf * better docs * Keep opencv out of it * keep old face pose example, then add new one which uses dlib's ffmpeg wrappers * revert * revert * better docs * better docs --------- Co-authored-by: pf <pf@me>
2023-01-30 09:17:34 +08:00
// List all input devices supported by this installation of ffmpeg libraries
FFMPEG : misc + ffmpeg5 support (#2746) * - enhanced list_muxers() - added fail() error handling helper function - moved framerate setting to decoder_image_args * docs * oops * - don't use std::endl, use `\n` instead - use fail(). See, on average, it removes lines of code * convenient constructor for demuxer * ffmpeg5 support * added docs for == -1 * oops * grouping audio channel compatibility stuff together * more compatibility stuff * more channel abstractions * build with ffmpeg 5 * install assembler * cache the installation * cmake doesn't like using ~ in filepath * at some point this will work * i think i need to change the key * test FFmpeg-n5.1.3_try3 cache * bug fix * Update build_cpp.yml Giving this another go * Update build_cpp.yml Disable building documentation and CLI tools * Update CMakeLists.txt Fix cmake script when using 3.8.0 and expecting imported targets to work when there are link flags included * - use environment variables - on ubuntu 18 gcc7, use ffmpeg 3.2.18 * correct way of dereferencing variables ? * can't get variables to work * Revert "can't get variables to work" This reverts commit 5eef96a43ef9e04bc7780abfce75e1bb2f0ca25f. * Revert "correct way of dereferencing variables ?" This reverts commit e8ff95f5c6c317bc8f3e6dde4b017a533c6806b3. * Revert "- use environment variables" This reverts commit a6938333d555d64e6cddcb7482ab579827ba6dfb. * using ffmpeg 3.2.18 with ubuntu18 gcc7 * Update build_cpp.yml Disable ubuntu18 job for now. Hopefully no more cancelled jobs, then i can re-enable * Re-enabled ubuntu18 job. Hopefully this time it won't get cancelled * Fixed bad indentation * Can go in details namespace * Update dlib/CMakeLists.txt Co-authored-by: Davis E. King <davis685@gmail.com> * use details namespace * remove declaration. It's in details now * don't need get_channels_from_layout() --------- Co-authored-by: pf <pf@me> Co-authored-by: Davis E. King <davis685@gmail.com>
2023-03-30 10:12:47 +08:00
cout << "Supported input devices:\n";
for (const auto& device : ffmpeg::list_input_device_types())
FFMPEG wrappers: dlib::ffmpeg::decoder and dlib::ffmpeg::demuxer (#2707) * - added ffmpeg stuff to cmake * - added observer_ptr * ffmpeg utils * WIP * - added ffmpeg_decoder * config file for test data * another test file * install ffmpeg * added ffmpeg_demuxer * install all ffmpeg libraries * support older version of ffmpeg * simplified loop * - test converting to dlib object - added docs - support older ffmpeg * added convert() overload * added comment * only register stuff when API not deprecated * - fixed version issues - fixed decoding * added tests for ffmpeg_demuxer * removed unused code * test GIF * added docs * added audio test * test for audio * more tests * review changes * don't need observer_ptr * made deps public. I could be wrong but just in case. * - added some static asserts. Some areas of the code might do memcpy's on arrays of pixels. This requires the structures to be packed. Check this. - added convert() functions - changed default decoder options. By default, always decode to RGB and S16 audio - added convenience constructor to demuxer * - no longer need opencv * oops. I let that slip * - made a few functions public - more precise requires clauses * enhanced example * - avoid FFMPEG_INITIALIZED being optimized away at link time - added decoding example * - avoid -Wunused-parameter error * constexpr and noexcept correctness. This probably makes no difference to performance, BUT, it's what the core guidelines tell you to do. It does however demonstrate how complicated and unecessarily verbose C++ is becoming. Sigh, maybe one day i'll make the switch to something that doesn't make my eyes twitch. * - simplified metadata structure * hopefully more educational * added another example * ditto * typo * screen grab example * whoops * avoid -Wunused-parameter errors * ditto * - added methods to av_dict - print the demuxer format options that were not used - enhanced webcam_face_pose_ex.cpp so you can set webcam options * if height and width are specified, attempt to set video_size in format_options. Otherwise set the bilinear resizer. * updated docs * once again, the ffmpeg APIs do a lot for you. It's a matter of knowing which APIs to call. * made header-only * - some Werror thing * don't use type_safe_union * - templated sample type - reverted deep copy of AVFrame for frame copy constructor * - added is_pixel_type and is_pixel_check * unit tests for pixel traits * enhanced is_image_type type trait and added is_image_check * added unit tests for is_image_type * added pix_traits, improved convert() functions * bug fix * get rid of -Werror=unused-variable error * added a type alias * that's the last of the manual memcpys gone. We'using ffmpeg API everywhere now for copying frames to buffers and back * missing doc * set framerate for webcam * list input devices * oops. I was trying to make ffmpeg 5 happy but i've given up on ffmpeg v5 compatibility in this PR. Future PR. * enhanced the information provided by list_input_devices and list_output_devices * removed vscode settings.json file * - added a type trait for checking whether a type is complete. This is useful for writing type traits that check other types have type trait specializations. But also other useful things. For example, std::unique_ptr uses something similar to this. * Davis was keen to simply check pixel_traits is specialised. That's equivalent to checking pixel_traits<> is complete for some type * code review * juse use the void_t in dlib/type_traits.h * one liners * just need is_image_check * more tests for is_image_type * i think this is correct * removed printf * better docs * Keep opencv out of it * keep old face pose example, then add new one which uses dlib's ffmpeg wrappers * revert * revert * better docs * better docs --------- Co-authored-by: pf <pf@me>
2023-01-30 09:17:34 +08:00
{
cout << " device type : `" << device.device_type << "` is audio " << device.is_audio_type << " is video " << device.is_video_type << '\n';
const auto instances = ffmpeg::list_input_device_instances(device.device_type);
if (!instances.empty())
FFMPEG wrappers: dlib::ffmpeg::decoder and dlib::ffmpeg::demuxer (#2707) * - added ffmpeg stuff to cmake * - added observer_ptr * ffmpeg utils * WIP * - added ffmpeg_decoder * config file for test data * another test file * install ffmpeg * added ffmpeg_demuxer * install all ffmpeg libraries * support older version of ffmpeg * simplified loop * - test converting to dlib object - added docs - support older ffmpeg * added convert() overload * added comment * only register stuff when API not deprecated * - fixed version issues - fixed decoding * added tests for ffmpeg_demuxer * removed unused code * test GIF * added docs * added audio test * test for audio * more tests * review changes * don't need observer_ptr * made deps public. I could be wrong but just in case. * - added some static asserts. Some areas of the code might do memcpy's on arrays of pixels. This requires the structures to be packed. Check this. - added convert() functions - changed default decoder options. By default, always decode to RGB and S16 audio - added convenience constructor to demuxer * - no longer need opencv * oops. I let that slip * - made a few functions public - more precise requires clauses * enhanced example * - avoid FFMPEG_INITIALIZED being optimized away at link time - added decoding example * - avoid -Wunused-parameter error * constexpr and noexcept correctness. This probably makes no difference to performance, BUT, it's what the core guidelines tell you to do. It does however demonstrate how complicated and unecessarily verbose C++ is becoming. Sigh, maybe one day i'll make the switch to something that doesn't make my eyes twitch. * - simplified metadata structure * hopefully more educational * added another example * ditto * typo * screen grab example * whoops * avoid -Wunused-parameter errors * ditto * - added methods to av_dict - print the demuxer format options that were not used - enhanced webcam_face_pose_ex.cpp so you can set webcam options * if height and width are specified, attempt to set video_size in format_options. Otherwise set the bilinear resizer. * updated docs * once again, the ffmpeg APIs do a lot for you. It's a matter of knowing which APIs to call. * made header-only * - some Werror thing * don't use type_safe_union * - templated sample type - reverted deep copy of AVFrame for frame copy constructor * - added is_pixel_type and is_pixel_check * unit tests for pixel traits * enhanced is_image_type type trait and added is_image_check * added unit tests for is_image_type * added pix_traits, improved convert() functions * bug fix * get rid of -Werror=unused-variable error * added a type alias * that's the last of the manual memcpys gone. We'using ffmpeg API everywhere now for copying frames to buffers and back * missing doc * set framerate for webcam * list input devices * oops. I was trying to make ffmpeg 5 happy but i've given up on ffmpeg v5 compatibility in this PR. Future PR. * enhanced the information provided by list_input_devices and list_output_devices * removed vscode settings.json file * - added a type trait for checking whether a type is complete. This is useful for writing type traits that check other types have type trait specializations. But also other useful things. For example, std::unique_ptr uses something similar to this. * Davis was keen to simply check pixel_traits is specialised. That's equivalent to checking pixel_traits<> is complete for some type * code review * juse use the void_t in dlib/type_traits.h * one liners * just need is_image_check * more tests for is_image_type * i think this is correct * removed printf * better docs * Keep opencv out of it * keep old face pose example, then add new one which uses dlib's ffmpeg wrappers * revert * revert * better docs * better docs --------- Co-authored-by: pf <pf@me>
2023-01-30 09:17:34 +08:00
{
FFMPEG : misc + ffmpeg5 support (#2746) * - enhanced list_muxers() - added fail() error handling helper function - moved framerate setting to decoder_image_args * docs * oops * - don't use std::endl, use `\n` instead - use fail(). See, on average, it removes lines of code * convenient constructor for demuxer * ffmpeg5 support * added docs for == -1 * oops * grouping audio channel compatibility stuff together * more compatibility stuff * more channel abstractions * build with ffmpeg 5 * install assembler * cache the installation * cmake doesn't like using ~ in filepath * at some point this will work * i think i need to change the key * test FFmpeg-n5.1.3_try3 cache * bug fix * Update build_cpp.yml Giving this another go * Update build_cpp.yml Disable building documentation and CLI tools * Update CMakeLists.txt Fix cmake script when using 3.8.0 and expecting imported targets to work when there are link flags included * - use environment variables - on ubuntu 18 gcc7, use ffmpeg 3.2.18 * correct way of dereferencing variables ? * can't get variables to work * Revert "can't get variables to work" This reverts commit 5eef96a43ef9e04bc7780abfce75e1bb2f0ca25f. * Revert "correct way of dereferencing variables ?" This reverts commit e8ff95f5c6c317bc8f3e6dde4b017a533c6806b3. * Revert "- use environment variables" This reverts commit a6938333d555d64e6cddcb7482ab579827ba6dfb. * using ffmpeg 3.2.18 with ubuntu18 gcc7 * Update build_cpp.yml Disable ubuntu18 job for now. Hopefully no more cancelled jobs, then i can re-enable * Re-enabled ubuntu18 job. Hopefully this time it won't get cancelled * Fixed bad indentation * Can go in details namespace * Update dlib/CMakeLists.txt Co-authored-by: Davis E. King <davis685@gmail.com> * use details namespace * remove declaration. It's in details now * don't need get_channels_from_layout() --------- Co-authored-by: pf <pf@me> Co-authored-by: Davis E. King <davis685@gmail.com>
2023-03-30 10:12:47 +08:00
cout << " instances :\n";
for (const auto& instance : instances)
FFMPEG : misc + ffmpeg5 support (#2746) * - enhanced list_muxers() - added fail() error handling helper function - moved framerate setting to decoder_image_args * docs * oops * - don't use std::endl, use `\n` instead - use fail(). See, on average, it removes lines of code * convenient constructor for demuxer * ffmpeg5 support * added docs for == -1 * oops * grouping audio channel compatibility stuff together * more compatibility stuff * more channel abstractions * build with ffmpeg 5 * install assembler * cache the installation * cmake doesn't like using ~ in filepath * at some point this will work * i think i need to change the key * test FFmpeg-n5.1.3_try3 cache * bug fix * Update build_cpp.yml Giving this another go * Update build_cpp.yml Disable building documentation and CLI tools * Update CMakeLists.txt Fix cmake script when using 3.8.0 and expecting imported targets to work when there are link flags included * - use environment variables - on ubuntu 18 gcc7, use ffmpeg 3.2.18 * correct way of dereferencing variables ? * can't get variables to work * Revert "can't get variables to work" This reverts commit 5eef96a43ef9e04bc7780abfce75e1bb2f0ca25f. * Revert "correct way of dereferencing variables ?" This reverts commit e8ff95f5c6c317bc8f3e6dde4b017a533c6806b3. * Revert "- use environment variables" This reverts commit a6938333d555d64e6cddcb7482ab579827ba6dfb. * using ffmpeg 3.2.18 with ubuntu18 gcc7 * Update build_cpp.yml Disable ubuntu18 job for now. Hopefully no more cancelled jobs, then i can re-enable * Re-enabled ubuntu18 job. Hopefully this time it won't get cancelled * Fixed bad indentation * Can go in details namespace * Update dlib/CMakeLists.txt Co-authored-by: Davis E. King <davis685@gmail.com> * use details namespace * remove declaration. It's in details now * don't need get_channels_from_layout() --------- Co-authored-by: pf <pf@me> Co-authored-by: Davis E. King <davis685@gmail.com>
2023-03-30 10:12:47 +08:00
cout << " name : " << left << setw(32) << instance.name << ", description : " << instance.description << '\n';
FFMPEG wrappers: dlib::ffmpeg::decoder and dlib::ffmpeg::demuxer (#2707) * - added ffmpeg stuff to cmake * - added observer_ptr * ffmpeg utils * WIP * - added ffmpeg_decoder * config file for test data * another test file * install ffmpeg * added ffmpeg_demuxer * install all ffmpeg libraries * support older version of ffmpeg * simplified loop * - test converting to dlib object - added docs - support older ffmpeg * added convert() overload * added comment * only register stuff when API not deprecated * - fixed version issues - fixed decoding * added tests for ffmpeg_demuxer * removed unused code * test GIF * added docs * added audio test * test for audio * more tests * review changes * don't need observer_ptr * made deps public. I could be wrong but just in case. * - added some static asserts. Some areas of the code might do memcpy's on arrays of pixels. This requires the structures to be packed. Check this. - added convert() functions - changed default decoder options. By default, always decode to RGB and S16 audio - added convenience constructor to demuxer * - no longer need opencv * oops. I let that slip * - made a few functions public - more precise requires clauses * enhanced example * - avoid FFMPEG_INITIALIZED being optimized away at link time - added decoding example * - avoid -Wunused-parameter error * constexpr and noexcept correctness. This probably makes no difference to performance, BUT, it's what the core guidelines tell you to do. It does however demonstrate how complicated and unecessarily verbose C++ is becoming. Sigh, maybe one day i'll make the switch to something that doesn't make my eyes twitch. * - simplified metadata structure * hopefully more educational * added another example * ditto * typo * screen grab example * whoops * avoid -Wunused-parameter errors * ditto * - added methods to av_dict - print the demuxer format options that were not used - enhanced webcam_face_pose_ex.cpp so you can set webcam options * if height and width are specified, attempt to set video_size in format_options. Otherwise set the bilinear resizer. * updated docs * once again, the ffmpeg APIs do a lot for you. It's a matter of knowing which APIs to call. * made header-only * - some Werror thing * don't use type_safe_union * - templated sample type - reverted deep copy of AVFrame for frame copy constructor * - added is_pixel_type and is_pixel_check * unit tests for pixel traits * enhanced is_image_type type trait and added is_image_check * added unit tests for is_image_type * added pix_traits, improved convert() functions * bug fix * get rid of -Werror=unused-variable error * added a type alias * that's the last of the manual memcpys gone. We'using ffmpeg API everywhere now for copying frames to buffers and back * missing doc * set framerate for webcam * list input devices * oops. I was trying to make ffmpeg 5 happy but i've given up on ffmpeg v5 compatibility in this PR. Future PR. * enhanced the information provided by list_input_devices and list_output_devices * removed vscode settings.json file * - added a type trait for checking whether a type is complete. This is useful for writing type traits that check other types have type trait specializations. But also other useful things. For example, std::unique_ptr uses something similar to this. * Davis was keen to simply check pixel_traits is specialised. That's equivalent to checking pixel_traits<> is complete for some type * code review * juse use the void_t in dlib/type_traits.h * one liners * just need is_image_check * more tests for is_image_type * i think this is correct * removed printf * better docs * Keep opencv out of it * keep old face pose example, then add new one which uses dlib's ffmpeg wrappers * revert * revert * better docs * better docs --------- Co-authored-by: pf <pf@me>
2023-01-30 09:17:34 +08:00
}
}
FFMPEG : misc + ffmpeg5 support (#2746) * - enhanced list_muxers() - added fail() error handling helper function - moved framerate setting to decoder_image_args * docs * oops * - don't use std::endl, use `\n` instead - use fail(). See, on average, it removes lines of code * convenient constructor for demuxer * ffmpeg5 support * added docs for == -1 * oops * grouping audio channel compatibility stuff together * more compatibility stuff * more channel abstractions * build with ffmpeg 5 * install assembler * cache the installation * cmake doesn't like using ~ in filepath * at some point this will work * i think i need to change the key * test FFmpeg-n5.1.3_try3 cache * bug fix * Update build_cpp.yml Giving this another go * Update build_cpp.yml Disable building documentation and CLI tools * Update CMakeLists.txt Fix cmake script when using 3.8.0 and expecting imported targets to work when there are link flags included * - use environment variables - on ubuntu 18 gcc7, use ffmpeg 3.2.18 * correct way of dereferencing variables ? * can't get variables to work * Revert "can't get variables to work" This reverts commit 5eef96a43ef9e04bc7780abfce75e1bb2f0ca25f. * Revert "correct way of dereferencing variables ?" This reverts commit e8ff95f5c6c317bc8f3e6dde4b017a533c6806b3. * Revert "- use environment variables" This reverts commit a6938333d555d64e6cddcb7482ab579827ba6dfb. * using ffmpeg 3.2.18 with ubuntu18 gcc7 * Update build_cpp.yml Disable ubuntu18 job for now. Hopefully no more cancelled jobs, then i can re-enable * Re-enabled ubuntu18 job. Hopefully this time it won't get cancelled * Fixed bad indentation * Can go in details namespace * Update dlib/CMakeLists.txt Co-authored-by: Davis E. King <davis685@gmail.com> * use details namespace * remove declaration. It's in details now * don't need get_channels_from_layout() --------- Co-authored-by: pf <pf@me> Co-authored-by: Davis E. King <davis685@gmail.com>
2023-03-30 10:12:47 +08:00
cout << '\n';
FFMPEG wrappers: dlib::ffmpeg::decoder and dlib::ffmpeg::demuxer (#2707) * - added ffmpeg stuff to cmake * - added observer_ptr * ffmpeg utils * WIP * - added ffmpeg_decoder * config file for test data * another test file * install ffmpeg * added ffmpeg_demuxer * install all ffmpeg libraries * support older version of ffmpeg * simplified loop * - test converting to dlib object - added docs - support older ffmpeg * added convert() overload * added comment * only register stuff when API not deprecated * - fixed version issues - fixed decoding * added tests for ffmpeg_demuxer * removed unused code * test GIF * added docs * added audio test * test for audio * more tests * review changes * don't need observer_ptr * made deps public. I could be wrong but just in case. * - added some static asserts. Some areas of the code might do memcpy's on arrays of pixels. This requires the structures to be packed. Check this. - added convert() functions - changed default decoder options. By default, always decode to RGB and S16 audio - added convenience constructor to demuxer * - no longer need opencv * oops. I let that slip * - made a few functions public - more precise requires clauses * enhanced example * - avoid FFMPEG_INITIALIZED being optimized away at link time - added decoding example * - avoid -Wunused-parameter error * constexpr and noexcept correctness. This probably makes no difference to performance, BUT, it's what the core guidelines tell you to do. It does however demonstrate how complicated and unecessarily verbose C++ is becoming. Sigh, maybe one day i'll make the switch to something that doesn't make my eyes twitch. * - simplified metadata structure * hopefully more educational * added another example * ditto * typo * screen grab example * whoops * avoid -Wunused-parameter errors * ditto * - added methods to av_dict - print the demuxer format options that were not used - enhanced webcam_face_pose_ex.cpp so you can set webcam options * if height and width are specified, attempt to set video_size in format_options. Otherwise set the bilinear resizer. * updated docs * once again, the ffmpeg APIs do a lot for you. It's a matter of knowing which APIs to call. * made header-only * - some Werror thing * don't use type_safe_union * - templated sample type - reverted deep copy of AVFrame for frame copy constructor * - added is_pixel_type and is_pixel_check * unit tests for pixel traits * enhanced is_image_type type trait and added is_image_check * added unit tests for is_image_type * added pix_traits, improved convert() functions * bug fix * get rid of -Werror=unused-variable error * added a type alias * that's the last of the manual memcpys gone. We'using ffmpeg API everywhere now for copying frames to buffers and back * missing doc * set framerate for webcam * list input devices * oops. I was trying to make ffmpeg 5 happy but i've given up on ffmpeg v5 compatibility in this PR. Future PR. * enhanced the information provided by list_input_devices and list_output_devices * removed vscode settings.json file * - added a type trait for checking whether a type is complete. This is useful for writing type traits that check other types have type trait specializations. But also other useful things. For example, std::unique_ptr uses something similar to this. * Davis was keen to simply check pixel_traits is specialised. That's equivalent to checking pixel_traits<> is complete for some type * code review * juse use the void_t in dlib/type_traits.h * one liners * just need is_image_check * more tests for is_image_type * i think this is correct * removed printf * better docs * Keep opencv out of it * keep old face pose example, then add new one which uses dlib's ffmpeg wrappers * revert * revert * better docs * better docs --------- Co-authored-by: pf <pf@me>
2023-01-30 09:17:34 +08:00
// List all input devices supported by this installation of ffmpeg libraries
FFMPEG : misc + ffmpeg5 support (#2746) * - enhanced list_muxers() - added fail() error handling helper function - moved framerate setting to decoder_image_args * docs * oops * - don't use std::endl, use `\n` instead - use fail(). See, on average, it removes lines of code * convenient constructor for demuxer * ffmpeg5 support * added docs for == -1 * oops * grouping audio channel compatibility stuff together * more compatibility stuff * more channel abstractions * build with ffmpeg 5 * install assembler * cache the installation * cmake doesn't like using ~ in filepath * at some point this will work * i think i need to change the key * test FFmpeg-n5.1.3_try3 cache * bug fix * Update build_cpp.yml Giving this another go * Update build_cpp.yml Disable building documentation and CLI tools * Update CMakeLists.txt Fix cmake script when using 3.8.0 and expecting imported targets to work when there are link flags included * - use environment variables - on ubuntu 18 gcc7, use ffmpeg 3.2.18 * correct way of dereferencing variables ? * can't get variables to work * Revert "can't get variables to work" This reverts commit 5eef96a43ef9e04bc7780abfce75e1bb2f0ca25f. * Revert "correct way of dereferencing variables ?" This reverts commit e8ff95f5c6c317bc8f3e6dde4b017a533c6806b3. * Revert "- use environment variables" This reverts commit a6938333d555d64e6cddcb7482ab579827ba6dfb. * using ffmpeg 3.2.18 with ubuntu18 gcc7 * Update build_cpp.yml Disable ubuntu18 job for now. Hopefully no more cancelled jobs, then i can re-enable * Re-enabled ubuntu18 job. Hopefully this time it won't get cancelled * Fixed bad indentation * Can go in details namespace * Update dlib/CMakeLists.txt Co-authored-by: Davis E. King <davis685@gmail.com> * use details namespace * remove declaration. It's in details now * don't need get_channels_from_layout() --------- Co-authored-by: pf <pf@me> Co-authored-by: Davis E. King <davis685@gmail.com>
2023-03-30 10:12:47 +08:00
cout << "Supported output devices:\n";
for (const auto& device : ffmpeg::list_output_device_types())
FFMPEG wrappers: dlib::ffmpeg::decoder and dlib::ffmpeg::demuxer (#2707) * - added ffmpeg stuff to cmake * - added observer_ptr * ffmpeg utils * WIP * - added ffmpeg_decoder * config file for test data * another test file * install ffmpeg * added ffmpeg_demuxer * install all ffmpeg libraries * support older version of ffmpeg * simplified loop * - test converting to dlib object - added docs - support older ffmpeg * added convert() overload * added comment * only register stuff when API not deprecated * - fixed version issues - fixed decoding * added tests for ffmpeg_demuxer * removed unused code * test GIF * added docs * added audio test * test for audio * more tests * review changes * don't need observer_ptr * made deps public. I could be wrong but just in case. * - added some static asserts. Some areas of the code might do memcpy's on arrays of pixels. This requires the structures to be packed. Check this. - added convert() functions - changed default decoder options. By default, always decode to RGB and S16 audio - added convenience constructor to demuxer * - no longer need opencv * oops. I let that slip * - made a few functions public - more precise requires clauses * enhanced example * - avoid FFMPEG_INITIALIZED being optimized away at link time - added decoding example * - avoid -Wunused-parameter error * constexpr and noexcept correctness. This probably makes no difference to performance, BUT, it's what the core guidelines tell you to do. It does however demonstrate how complicated and unecessarily verbose C++ is becoming. Sigh, maybe one day i'll make the switch to something that doesn't make my eyes twitch. * - simplified metadata structure * hopefully more educational * added another example * ditto * typo * screen grab example * whoops * avoid -Wunused-parameter errors * ditto * - added methods to av_dict - print the demuxer format options that were not used - enhanced webcam_face_pose_ex.cpp so you can set webcam options * if height and width are specified, attempt to set video_size in format_options. Otherwise set the bilinear resizer. * updated docs * once again, the ffmpeg APIs do a lot for you. It's a matter of knowing which APIs to call. * made header-only * - some Werror thing * don't use type_safe_union * - templated sample type - reverted deep copy of AVFrame for frame copy constructor * - added is_pixel_type and is_pixel_check * unit tests for pixel traits * enhanced is_image_type type trait and added is_image_check * added unit tests for is_image_type * added pix_traits, improved convert() functions * bug fix * get rid of -Werror=unused-variable error * added a type alias * that's the last of the manual memcpys gone. We'using ffmpeg API everywhere now for copying frames to buffers and back * missing doc * set framerate for webcam * list input devices * oops. I was trying to make ffmpeg 5 happy but i've given up on ffmpeg v5 compatibility in this PR. Future PR. * enhanced the information provided by list_input_devices and list_output_devices * removed vscode settings.json file * - added a type trait for checking whether a type is complete. This is useful for writing type traits that check other types have type trait specializations. But also other useful things. For example, std::unique_ptr uses something similar to this. * Davis was keen to simply check pixel_traits is specialised. That's equivalent to checking pixel_traits<> is complete for some type * code review * juse use the void_t in dlib/type_traits.h * one liners * just need is_image_check * more tests for is_image_type * i think this is correct * removed printf * better docs * Keep opencv out of it * keep old face pose example, then add new one which uses dlib's ffmpeg wrappers * revert * revert * better docs * better docs --------- Co-authored-by: pf <pf@me>
2023-01-30 09:17:34 +08:00
{
cout << " device type : `" << device.device_type << "` is audio " << device.is_audio_type << " is video " << device.is_video_type << '\n';
const auto instances = ffmpeg::list_output_device_instances(device.device_type);
if (!instances.empty())
FFMPEG wrappers: dlib::ffmpeg::decoder and dlib::ffmpeg::demuxer (#2707) * - added ffmpeg stuff to cmake * - added observer_ptr * ffmpeg utils * WIP * - added ffmpeg_decoder * config file for test data * another test file * install ffmpeg * added ffmpeg_demuxer * install all ffmpeg libraries * support older version of ffmpeg * simplified loop * - test converting to dlib object - added docs - support older ffmpeg * added convert() overload * added comment * only register stuff when API not deprecated * - fixed version issues - fixed decoding * added tests for ffmpeg_demuxer * removed unused code * test GIF * added docs * added audio test * test for audio * more tests * review changes * don't need observer_ptr * made deps public. I could be wrong but just in case. * - added some static asserts. Some areas of the code might do memcpy's on arrays of pixels. This requires the structures to be packed. Check this. - added convert() functions - changed default decoder options. By default, always decode to RGB and S16 audio - added convenience constructor to demuxer * - no longer need opencv * oops. I let that slip * - made a few functions public - more precise requires clauses * enhanced example * - avoid FFMPEG_INITIALIZED being optimized away at link time - added decoding example * - avoid -Wunused-parameter error * constexpr and noexcept correctness. This probably makes no difference to performance, BUT, it's what the core guidelines tell you to do. It does however demonstrate how complicated and unecessarily verbose C++ is becoming. Sigh, maybe one day i'll make the switch to something that doesn't make my eyes twitch. * - simplified metadata structure * hopefully more educational * added another example * ditto * typo * screen grab example * whoops * avoid -Wunused-parameter errors * ditto * - added methods to av_dict - print the demuxer format options that were not used - enhanced webcam_face_pose_ex.cpp so you can set webcam options * if height and width are specified, attempt to set video_size in format_options. Otherwise set the bilinear resizer. * updated docs * once again, the ffmpeg APIs do a lot for you. It's a matter of knowing which APIs to call. * made header-only * - some Werror thing * don't use type_safe_union * - templated sample type - reverted deep copy of AVFrame for frame copy constructor * - added is_pixel_type and is_pixel_check * unit tests for pixel traits * enhanced is_image_type type trait and added is_image_check * added unit tests for is_image_type * added pix_traits, improved convert() functions * bug fix * get rid of -Werror=unused-variable error * added a type alias * that's the last of the manual memcpys gone. We'using ffmpeg API everywhere now for copying frames to buffers and back * missing doc * set framerate for webcam * list input devices * oops. I was trying to make ffmpeg 5 happy but i've given up on ffmpeg v5 compatibility in this PR. Future PR. * enhanced the information provided by list_input_devices and list_output_devices * removed vscode settings.json file * - added a type trait for checking whether a type is complete. This is useful for writing type traits that check other types have type trait specializations. But also other useful things. For example, std::unique_ptr uses something similar to this. * Davis was keen to simply check pixel_traits is specialised. That's equivalent to checking pixel_traits<> is complete for some type * code review * juse use the void_t in dlib/type_traits.h * one liners * just need is_image_check * more tests for is_image_type * i think this is correct * removed printf * better docs * Keep opencv out of it * keep old face pose example, then add new one which uses dlib's ffmpeg wrappers * revert * revert * better docs * better docs --------- Co-authored-by: pf <pf@me>
2023-01-30 09:17:34 +08:00
{
FFMPEG : misc + ffmpeg5 support (#2746) * - enhanced list_muxers() - added fail() error handling helper function - moved framerate setting to decoder_image_args * docs * oops * - don't use std::endl, use `\n` instead - use fail(). See, on average, it removes lines of code * convenient constructor for demuxer * ffmpeg5 support * added docs for == -1 * oops * grouping audio channel compatibility stuff together * more compatibility stuff * more channel abstractions * build with ffmpeg 5 * install assembler * cache the installation * cmake doesn't like using ~ in filepath * at some point this will work * i think i need to change the key * test FFmpeg-n5.1.3_try3 cache * bug fix * Update build_cpp.yml Giving this another go * Update build_cpp.yml Disable building documentation and CLI tools * Update CMakeLists.txt Fix cmake script when using 3.8.0 and expecting imported targets to work when there are link flags included * - use environment variables - on ubuntu 18 gcc7, use ffmpeg 3.2.18 * correct way of dereferencing variables ? * can't get variables to work * Revert "can't get variables to work" This reverts commit 5eef96a43ef9e04bc7780abfce75e1bb2f0ca25f. * Revert "correct way of dereferencing variables ?" This reverts commit e8ff95f5c6c317bc8f3e6dde4b017a533c6806b3. * Revert "- use environment variables" This reverts commit a6938333d555d64e6cddcb7482ab579827ba6dfb. * using ffmpeg 3.2.18 with ubuntu18 gcc7 * Update build_cpp.yml Disable ubuntu18 job for now. Hopefully no more cancelled jobs, then i can re-enable * Re-enabled ubuntu18 job. Hopefully this time it won't get cancelled * Fixed bad indentation * Can go in details namespace * Update dlib/CMakeLists.txt Co-authored-by: Davis E. King <davis685@gmail.com> * use details namespace * remove declaration. It's in details now * don't need get_channels_from_layout() --------- Co-authored-by: pf <pf@me> Co-authored-by: Davis E. King <davis685@gmail.com>
2023-03-30 10:12:47 +08:00
cout << " instances :\n";
for (const auto& instance : instances)
FFMPEG : misc + ffmpeg5 support (#2746) * - enhanced list_muxers() - added fail() error handling helper function - moved framerate setting to decoder_image_args * docs * oops * - don't use std::endl, use `\n` instead - use fail(). See, on average, it removes lines of code * convenient constructor for demuxer * ffmpeg5 support * added docs for == -1 * oops * grouping audio channel compatibility stuff together * more compatibility stuff * more channel abstractions * build with ffmpeg 5 * install assembler * cache the installation * cmake doesn't like using ~ in filepath * at some point this will work * i think i need to change the key * test FFmpeg-n5.1.3_try3 cache * bug fix * Update build_cpp.yml Giving this another go * Update build_cpp.yml Disable building documentation and CLI tools * Update CMakeLists.txt Fix cmake script when using 3.8.0 and expecting imported targets to work when there are link flags included * - use environment variables - on ubuntu 18 gcc7, use ffmpeg 3.2.18 * correct way of dereferencing variables ? * can't get variables to work * Revert "can't get variables to work" This reverts commit 5eef96a43ef9e04bc7780abfce75e1bb2f0ca25f. * Revert "correct way of dereferencing variables ?" This reverts commit e8ff95f5c6c317bc8f3e6dde4b017a533c6806b3. * Revert "- use environment variables" This reverts commit a6938333d555d64e6cddcb7482ab579827ba6dfb. * using ffmpeg 3.2.18 with ubuntu18 gcc7 * Update build_cpp.yml Disable ubuntu18 job for now. Hopefully no more cancelled jobs, then i can re-enable * Re-enabled ubuntu18 job. Hopefully this time it won't get cancelled * Fixed bad indentation * Can go in details namespace * Update dlib/CMakeLists.txt Co-authored-by: Davis E. King <davis685@gmail.com> * use details namespace * remove declaration. It's in details now * don't need get_channels_from_layout() --------- Co-authored-by: pf <pf@me> Co-authored-by: Davis E. King <davis685@gmail.com>
2023-03-30 10:12:47 +08:00
cout << " name : " << left << setw(32) << instance.name << ", description : " << instance.description << '\n';
FFMPEG wrappers: dlib::ffmpeg::decoder and dlib::ffmpeg::demuxer (#2707) * - added ffmpeg stuff to cmake * - added observer_ptr * ffmpeg utils * WIP * - added ffmpeg_decoder * config file for test data * another test file * install ffmpeg * added ffmpeg_demuxer * install all ffmpeg libraries * support older version of ffmpeg * simplified loop * - test converting to dlib object - added docs - support older ffmpeg * added convert() overload * added comment * only register stuff when API not deprecated * - fixed version issues - fixed decoding * added tests for ffmpeg_demuxer * removed unused code * test GIF * added docs * added audio test * test for audio * more tests * review changes * don't need observer_ptr * made deps public. I could be wrong but just in case. * - added some static asserts. Some areas of the code might do memcpy's on arrays of pixels. This requires the structures to be packed. Check this. - added convert() functions - changed default decoder options. By default, always decode to RGB and S16 audio - added convenience constructor to demuxer * - no longer need opencv * oops. I let that slip * - made a few functions public - more precise requires clauses * enhanced example * - avoid FFMPEG_INITIALIZED being optimized away at link time - added decoding example * - avoid -Wunused-parameter error * constexpr and noexcept correctness. This probably makes no difference to performance, BUT, it's what the core guidelines tell you to do. It does however demonstrate how complicated and unecessarily verbose C++ is becoming. Sigh, maybe one day i'll make the switch to something that doesn't make my eyes twitch. * - simplified metadata structure * hopefully more educational * added another example * ditto * typo * screen grab example * whoops * avoid -Wunused-parameter errors * ditto * - added methods to av_dict - print the demuxer format options that were not used - enhanced webcam_face_pose_ex.cpp so you can set webcam options * if height and width are specified, attempt to set video_size in format_options. Otherwise set the bilinear resizer. * updated docs * once again, the ffmpeg APIs do a lot for you. It's a matter of knowing which APIs to call. * made header-only * - some Werror thing * don't use type_safe_union * - templated sample type - reverted deep copy of AVFrame for frame copy constructor * - added is_pixel_type and is_pixel_check * unit tests for pixel traits * enhanced is_image_type type trait and added is_image_check * added unit tests for is_image_type * added pix_traits, improved convert() functions * bug fix * get rid of -Werror=unused-variable error * added a type alias * that's the last of the manual memcpys gone. We'using ffmpeg API everywhere now for copying frames to buffers and back * missing doc * set framerate for webcam * list input devices * oops. I was trying to make ffmpeg 5 happy but i've given up on ffmpeg v5 compatibility in this PR. Future PR. * enhanced the information provided by list_input_devices and list_output_devices * removed vscode settings.json file * - added a type trait for checking whether a type is complete. This is useful for writing type traits that check other types have type trait specializations. But also other useful things. For example, std::unique_ptr uses something similar to this. * Davis was keen to simply check pixel_traits is specialised. That's equivalent to checking pixel_traits<> is complete for some type * code review * juse use the void_t in dlib/type_traits.h * one liners * just need is_image_check * more tests for is_image_type * i think this is correct * removed printf * better docs * Keep opencv out of it * keep old face pose example, then add new one which uses dlib's ffmpeg wrappers * revert * revert * better docs * better docs --------- Co-authored-by: pf <pf@me>
2023-01-30 09:17:34 +08:00
}
}
FFMPEG : misc + ffmpeg5 support (#2746) * - enhanced list_muxers() - added fail() error handling helper function - moved framerate setting to decoder_image_args * docs * oops * - don't use std::endl, use `\n` instead - use fail(). See, on average, it removes lines of code * convenient constructor for demuxer * ffmpeg5 support * added docs for == -1 * oops * grouping audio channel compatibility stuff together * more compatibility stuff * more channel abstractions * build with ffmpeg 5 * install assembler * cache the installation * cmake doesn't like using ~ in filepath * at some point this will work * i think i need to change the key * test FFmpeg-n5.1.3_try3 cache * bug fix * Update build_cpp.yml Giving this another go * Update build_cpp.yml Disable building documentation and CLI tools * Update CMakeLists.txt Fix cmake script when using 3.8.0 and expecting imported targets to work when there are link flags included * - use environment variables - on ubuntu 18 gcc7, use ffmpeg 3.2.18 * correct way of dereferencing variables ? * can't get variables to work * Revert "can't get variables to work" This reverts commit 5eef96a43ef9e04bc7780abfce75e1bb2f0ca25f. * Revert "correct way of dereferencing variables ?" This reverts commit e8ff95f5c6c317bc8f3e6dde4b017a533c6806b3. * Revert "- use environment variables" This reverts commit a6938333d555d64e6cddcb7482ab579827ba6dfb. * using ffmpeg 3.2.18 with ubuntu18 gcc7 * Update build_cpp.yml Disable ubuntu18 job for now. Hopefully no more cancelled jobs, then i can re-enable * Re-enabled ubuntu18 job. Hopefully this time it won't get cancelled * Fixed bad indentation * Can go in details namespace * Update dlib/CMakeLists.txt Co-authored-by: Davis E. King <davis685@gmail.com> * use details namespace * remove declaration. It's in details now * don't need get_channels_from_layout() --------- Co-authored-by: pf <pf@me> Co-authored-by: Davis E. King <davis685@gmail.com>
2023-03-30 10:12:47 +08:00
cout << '\n';
FFMPEG wrappers: dlib::ffmpeg::decoder and dlib::ffmpeg::demuxer (#2707) * - added ffmpeg stuff to cmake * - added observer_ptr * ffmpeg utils * WIP * - added ffmpeg_decoder * config file for test data * another test file * install ffmpeg * added ffmpeg_demuxer * install all ffmpeg libraries * support older version of ffmpeg * simplified loop * - test converting to dlib object - added docs - support older ffmpeg * added convert() overload * added comment * only register stuff when API not deprecated * - fixed version issues - fixed decoding * added tests for ffmpeg_demuxer * removed unused code * test GIF * added docs * added audio test * test for audio * more tests * review changes * don't need observer_ptr * made deps public. I could be wrong but just in case. * - added some static asserts. Some areas of the code might do memcpy's on arrays of pixels. This requires the structures to be packed. Check this. - added convert() functions - changed default decoder options. By default, always decode to RGB and S16 audio - added convenience constructor to demuxer * - no longer need opencv * oops. I let that slip * - made a few functions public - more precise requires clauses * enhanced example * - avoid FFMPEG_INITIALIZED being optimized away at link time - added decoding example * - avoid -Wunused-parameter error * constexpr and noexcept correctness. This probably makes no difference to performance, BUT, it's what the core guidelines tell you to do. It does however demonstrate how complicated and unecessarily verbose C++ is becoming. Sigh, maybe one day i'll make the switch to something that doesn't make my eyes twitch. * - simplified metadata structure * hopefully more educational * added another example * ditto * typo * screen grab example * whoops * avoid -Wunused-parameter errors * ditto * - added methods to av_dict - print the demuxer format options that were not used - enhanced webcam_face_pose_ex.cpp so you can set webcam options * if height and width are specified, attempt to set video_size in format_options. Otherwise set the bilinear resizer. * updated docs * once again, the ffmpeg APIs do a lot for you. It's a matter of knowing which APIs to call. * made header-only * - some Werror thing * don't use type_safe_union * - templated sample type - reverted deep copy of AVFrame for frame copy constructor * - added is_pixel_type and is_pixel_check * unit tests for pixel traits * enhanced is_image_type type trait and added is_image_check * added unit tests for is_image_type * added pix_traits, improved convert() functions * bug fix * get rid of -Werror=unused-variable error * added a type alias * that's the last of the manual memcpys gone. We'using ffmpeg API everywhere now for copying frames to buffers and back * missing doc * set framerate for webcam * list input devices * oops. I was trying to make ffmpeg 5 happy but i've given up on ffmpeg v5 compatibility in this PR. Future PR. * enhanced the information provided by list_input_devices and list_output_devices * removed vscode settings.json file * - added a type trait for checking whether a type is complete. This is useful for writing type traits that check other types have type trait specializations. But also other useful things. For example, std::unique_ptr uses something similar to this. * Davis was keen to simply check pixel_traits is specialised. That's equivalent to checking pixel_traits<> is complete for some type * code review * juse use the void_t in dlib/type_traits.h * one liners * just need is_image_check * more tests for is_image_type * i think this is correct * removed printf * better docs * Keep opencv out of it * keep old face pose example, then add new one which uses dlib's ffmpeg wrappers * revert * revert * better docs * better docs --------- Co-authored-by: pf <pf@me>
2023-01-30 09:17:34 +08:00
const bool mp4_available =
std::find_if(begin(demuxers),
end(demuxers),
[](const auto& demux) {return demux.find("mp4") != std::string::npos;}) != demuxers.end();
const bool h264_available =
std::find_if(begin(codecs),
end(codecs),
[](const auto& codec) {return codec.codec_name == "h264" && codec.supports_decoding;}) != codecs.end();
FFMPEG : misc + ffmpeg5 support (#2746) * - enhanced list_muxers() - added fail() error handling helper function - moved framerate setting to decoder_image_args * docs * oops * - don't use std::endl, use `\n` instead - use fail(). See, on average, it removes lines of code * convenient constructor for demuxer * ffmpeg5 support * added docs for == -1 * oops * grouping audio channel compatibility stuff together * more compatibility stuff * more channel abstractions * build with ffmpeg 5 * install assembler * cache the installation * cmake doesn't like using ~ in filepath * at some point this will work * i think i need to change the key * test FFmpeg-n5.1.3_try3 cache * bug fix * Update build_cpp.yml Giving this another go * Update build_cpp.yml Disable building documentation and CLI tools * Update CMakeLists.txt Fix cmake script when using 3.8.0 and expecting imported targets to work when there are link flags included * - use environment variables - on ubuntu 18 gcc7, use ffmpeg 3.2.18 * correct way of dereferencing variables ? * can't get variables to work * Revert "can't get variables to work" This reverts commit 5eef96a43ef9e04bc7780abfce75e1bb2f0ca25f. * Revert "correct way of dereferencing variables ?" This reverts commit e8ff95f5c6c317bc8f3e6dde4b017a533c6806b3. * Revert "- use environment variables" This reverts commit a6938333d555d64e6cddcb7482ab579827ba6dfb. * using ffmpeg 3.2.18 with ubuntu18 gcc7 * Update build_cpp.yml Disable ubuntu18 job for now. Hopefully no more cancelled jobs, then i can re-enable * Re-enabled ubuntu18 job. Hopefully this time it won't get cancelled * Fixed bad indentation * Can go in details namespace * Update dlib/CMakeLists.txt Co-authored-by: Davis E. King <davis685@gmail.com> * use details namespace * remove declaration. It's in details now * don't need get_channels_from_layout() --------- Co-authored-by: pf <pf@me> Co-authored-by: Davis E. King <davis685@gmail.com>
2023-03-30 10:12:47 +08:00
cout << "Can read MP4 file with H264 encoded video stream? " << (mp4_available && h264_available) << '\n';
FFMPEG wrappers: dlib::ffmpeg::decoder and dlib::ffmpeg::demuxer (#2707) * - added ffmpeg stuff to cmake * - added observer_ptr * ffmpeg utils * WIP * - added ffmpeg_decoder * config file for test data * another test file * install ffmpeg * added ffmpeg_demuxer * install all ffmpeg libraries * support older version of ffmpeg * simplified loop * - test converting to dlib object - added docs - support older ffmpeg * added convert() overload * added comment * only register stuff when API not deprecated * - fixed version issues - fixed decoding * added tests for ffmpeg_demuxer * removed unused code * test GIF * added docs * added audio test * test for audio * more tests * review changes * don't need observer_ptr * made deps public. I could be wrong but just in case. * - added some static asserts. Some areas of the code might do memcpy's on arrays of pixels. This requires the structures to be packed. Check this. - added convert() functions - changed default decoder options. By default, always decode to RGB and S16 audio - added convenience constructor to demuxer * - no longer need opencv * oops. I let that slip * - made a few functions public - more precise requires clauses * enhanced example * - avoid FFMPEG_INITIALIZED being optimized away at link time - added decoding example * - avoid -Wunused-parameter error * constexpr and noexcept correctness. This probably makes no difference to performance, BUT, it's what the core guidelines tell you to do. It does however demonstrate how complicated and unecessarily verbose C++ is becoming. Sigh, maybe one day i'll make the switch to something that doesn't make my eyes twitch. * - simplified metadata structure * hopefully more educational * added another example * ditto * typo * screen grab example * whoops * avoid -Wunused-parameter errors * ditto * - added methods to av_dict - print the demuxer format options that were not used - enhanced webcam_face_pose_ex.cpp so you can set webcam options * if height and width are specified, attempt to set video_size in format_options. Otherwise set the bilinear resizer. * updated docs * once again, the ffmpeg APIs do a lot for you. It's a matter of knowing which APIs to call. * made header-only * - some Werror thing * don't use type_safe_union * - templated sample type - reverted deep copy of AVFrame for frame copy constructor * - added is_pixel_type and is_pixel_check * unit tests for pixel traits * enhanced is_image_type type trait and added is_image_check * added unit tests for is_image_type * added pix_traits, improved convert() functions * bug fix * get rid of -Werror=unused-variable error * added a type alias * that's the last of the manual memcpys gone. We'using ffmpeg API everywhere now for copying frames to buffers and back * missing doc * set framerate for webcam * list input devices * oops. I was trying to make ffmpeg 5 happy but i've given up on ffmpeg v5 compatibility in this PR. Future PR. * enhanced the information provided by list_input_devices and list_output_devices * removed vscode settings.json file * - added a type trait for checking whether a type is complete. This is useful for writing type traits that check other types have type trait specializations. But also other useful things. For example, std::unique_ptr uses something similar to this. * Davis was keen to simply check pixel_traits is specialised. That's equivalent to checking pixel_traits<> is complete for some type * code review * juse use the void_t in dlib/type_traits.h * one liners * just need is_image_check * more tests for is_image_type * i think this is correct * removed printf * better docs * Keep opencv out of it * keep old face pose example, then add new one which uses dlib's ffmpeg wrappers * revert * revert * better docs * better docs --------- Co-authored-by: pf <pf@me>
2023-01-30 09:17:34 +08:00
return EXIT_SUCCESS;
FFMPEG : misc + ffmpeg5 support (#2746) * - enhanced list_muxers() - added fail() error handling helper function - moved framerate setting to decoder_image_args * docs * oops * - don't use std::endl, use `\n` instead - use fail(). See, on average, it removes lines of code * convenient constructor for demuxer * ffmpeg5 support * added docs for == -1 * oops * grouping audio channel compatibility stuff together * more compatibility stuff * more channel abstractions * build with ffmpeg 5 * install assembler * cache the installation * cmake doesn't like using ~ in filepath * at some point this will work * i think i need to change the key * test FFmpeg-n5.1.3_try3 cache * bug fix * Update build_cpp.yml Giving this another go * Update build_cpp.yml Disable building documentation and CLI tools * Update CMakeLists.txt Fix cmake script when using 3.8.0 and expecting imported targets to work when there are link flags included * - use environment variables - on ubuntu 18 gcc7, use ffmpeg 3.2.18 * correct way of dereferencing variables ? * can't get variables to work * Revert "can't get variables to work" This reverts commit 5eef96a43ef9e04bc7780abfce75e1bb2f0ca25f. * Revert "correct way of dereferencing variables ?" This reverts commit e8ff95f5c6c317bc8f3e6dde4b017a533c6806b3. * Revert "- use environment variables" This reverts commit a6938333d555d64e6cddcb7482ab579827ba6dfb. * using ffmpeg 3.2.18 with ubuntu18 gcc7 * Update build_cpp.yml Disable ubuntu18 job for now. Hopefully no more cancelled jobs, then i can re-enable * Re-enabled ubuntu18 job. Hopefully this time it won't get cancelled * Fixed bad indentation * Can go in details namespace * Update dlib/CMakeLists.txt Co-authored-by: Davis E. King <davis685@gmail.com> * use details namespace * remove declaration. It's in details now * don't need get_channels_from_layout() --------- Co-authored-by: pf <pf@me> Co-authored-by: Davis E. King <davis685@gmail.com>
2023-03-30 10:12:47 +08:00
}