19.09.14 23:21, Dan Dennedy написав(ла):
On Fri, Sep 19, 2014 at 1:56 AM, Maksym Veremeyenko <[email protected] <mailto:[email protected]>> wrote:18.09.14 19:43, Dan Dennedy написав(ла): On Thu, Sep 18, 2014 at 9:27 AM, Maksym Veremeyenko <[email protected] <mailto:[email protected]> <mailto:[email protected] <mailto:[email protected]>>> wrote: Hi, attached patch set metadata 'timecode' from first frame's meta.attr.timecode.markup property. Compare your patch to the recent commit that removed that feature: https://github.com/__mltframework/mlt/commit/__022dedf4d4ccc9e1703d7a1c8ad4bd__524ae62987#diff-__1bba886ccf70d0171adb4e7842ec3d__58L1393 <https://github.com/mltframework/mlt/commit/022dedf4d4ccc9e1703d7a1c8ad4bd524ae62987#diff-1bba886ccf70d0171adb4e7842ec3d58L1393> thanks for notices. my first idea was to call *mlt_consumer_rt_frame* before header writing but i decided just move header writing below because if less origin code ruins. I have not tested that patch, but I think that change is OK to make. first, without such kind of early mlt_consumer_rt_frame or delayed *avformat_write_header* makes impossible to store real timecode from SDI source (vitc). second, i cant understand where /timing problem/ can start from. *consumer_read_ahead_thread* seems had similar also had early /mlt_consumer_get_frame( self );/ It is a timing (or sequence) problem between determining mlt_image_format and starting the render threads. mlt_image_format must be set before starting the render threads. Now, we are determining mlt_image_format (if not set) by the selected pix_fmt, which can now be selected by the codec. The rendering threads do not start until the first call to mlt_consumer_rt_frame(). So, calling that function to get a frame was starting render threads before mlt_image_format was finalized. if it unsure where problem could comes from, we can add a property to avformat_consumer that allow calling *avformat_write_header* after first frame, i.e. make it parametrized I do not think it is necessary. I was just explaining the recent change that caused you to make a patch. :-) diff --git a/src/modules/avformat/__consumer_avformat.c b/src/modules/avformat/__consumer_avformat.c index 30e74f0..7f0fe98 100644 --- a/src/modules/avformat/__consumer_avformat.c +++ b/src/modules/avformat/__consumer_avformat.c @@ -1580,6 +1580,32 @@ static void *consumer_thread( void *arg ) // Write the stream header. if ( !header_written ) { +// set timecode from first frame if not been set from metadata +if( !mlt_properties_get( properties, "meta.attr.timecode.markup" ) ) +{ +char *vitc = mlt_properties_get( frame_properties, "meta.attr.vitc.markup" ); +if ( vitc ) Add test that vitc is not empty string. i will +{ +mlt_log_debug( MLT_CONSUMER_SERVICE( consumer ), "timecode=[%s]\n", vitc ); + +#if LIBAVUTIL_VERSION_INT >= ((51<<16)+(8<<8)+0) I need to check what release version of FFmpeg and Libav this corresponds to. I am very soon going to update the avformat code to address deprecations and to review API usage against ffmpeg.c. In that process, I am going to drop support for versions 0.7 and 0.8. it similar to code above that call *av_dict_set*, so i just copied that version checking macros. I understand. I am just letting you know this cruft might not be needed, but I decided to test and apply your patches before the API update. +av_dict_set +#else +av_metadata_set2 +#endif +( &oc->metadata, "timecode", vitc, 0 ); + +if ( video_st ) +#if LIBAVUTIL_VERSION_INT >= ((51<<16)+(8<<8)+0) +av_dict_set +#else +av_metadata_set2 +#endif +( &video_st->metadata, "timecode", vitc, 0 ); + I think we should check if ';' is in the string and if so, set the drop_frame_timecode flag. i will, but i do not understand which part of mltframework will use it...
updated patch attached
i implemented that by another patch, because i an not sure if i make it properly. please reviewMLT will not use it, but avcodecs will (mpeg1video and mpeg2video). Therefore, this flag with the exact name "drop_frame_timecode" should be set on the av_dict. I do not recall if the DeckLink produces timecode values with a ';', but I think it does. Even if not, if the application or user sets a timecode on the producer with a ';' it means drop-frame, and we should set this flag.
-- ________________________________________ Maksym Veremeyenko
>From 681740ba7ef0a573e4a0719eb9db146336f87310 Mon Sep 17 00:00:00 2001 From: Maksym Veremeyenko <[email protected]> Date: Mon, 22 Sep 2014 13:25:19 +0300 Subject: [PATCH 1/2] set metadata 'timecode' from first frame's meta.attr.timecode.markup property --- src/modules/avformat/consumer_avformat.c | 24 ++++++++++++++++++++++++ 1 files changed, 24 insertions(+), 0 deletions(-) diff --git a/src/modules/avformat/consumer_avformat.c b/src/modules/avformat/consumer_avformat.c index c1e0a7e..f32ce39 100644 --- a/src/modules/avformat/consumer_avformat.c +++ b/src/modules/avformat/consumer_avformat.c @@ -1583,6 +1583,30 @@ static void *consumer_thread( void *arg ) // Write the stream header. if ( !header_written ) { + // set timecode from first frame if not been set from metadata + if( !mlt_properties_get( properties, "timecode" ) ) + { + char *vitc = mlt_properties_get( frame_properties, "meta.attr.vitc.markup" ); + if ( vitc && vitc[0] ) + { + mlt_log_debug( MLT_CONSUMER_SERVICE( consumer ), "timecode=[%s]\n", vitc ); +#if LIBAVUTIL_VERSION_INT >= ((51<<16)+(8<<8)+0) + av_dict_set +#else + av_metadata_set2 +#endif + ( &oc->metadata, "timecode", vitc, 0 ); + + if ( video_st ) +#if LIBAVUTIL_VERSION_INT >= ((51<<16)+(8<<8)+0) + av_dict_set +#else + av_metadata_set2 +#endif + ( &video_st->metadata, "timecode", vitc, 0 ); + }; + }; + #if LIBAVFORMAT_VERSION_INT >= ((53<<16)+(2<<8)+0) if ( avformat_write_header( oc, NULL ) < 0 ) #else -- 1.7.7.6
>From d7057981ce50b955c1cbd71e42d8381986244d0c Mon Sep 17 00:00:00 2001 From: Maksym Veremeyenko <[email protected]> Date: Mon, 22 Sep 2014 13:31:23 +0300 Subject: [PATCH 2/2] set 'drop_frame_timecode' flag if needed --- src/modules/avformat/consumer_avformat.c | 10 ++++++++++ 1 files changed, 10 insertions(+), 0 deletions(-) diff --git a/src/modules/avformat/consumer_avformat.c b/src/modules/avformat/consumer_avformat.c index f32ce39..8460de2 100644 --- a/src/modules/avformat/consumer_avformat.c +++ b/src/modules/avformat/consumer_avformat.c @@ -1598,12 +1598,22 @@ static void *consumer_thread( void *arg ) ( &oc->metadata, "timecode", vitc, 0 ); if ( video_st ) + { #if LIBAVUTIL_VERSION_INT >= ((51<<16)+(8<<8)+0) av_dict_set #else av_metadata_set2 #endif ( &video_st->metadata, "timecode", vitc, 0 ); + + if ( strchr( vitc, ';' ) ) +#if LIBAVUTIL_VERSION_INT >= ((51<<16)+(8<<8)+0) + av_dict_set +#else + av_metadata_set2 +#endif + ( &video_st->metadata, "drop_frame_timecode", "1", 0 ); + }; }; }; -- 1.7.7.6
------------------------------------------------------------------------------ Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer http://pubads.g.doubleclick.net/gampad/clk?id=154622311&iu=/4140/ostg.clktrk
_______________________________________________ Mlt-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/mlt-devel
