diff --git a/src/zm_videostore.cpp b/src/zm_videostore.cpp index cd698c295..dfcd27036 100644 --- a/src/zm_videostore.cpp +++ b/src/zm_videostore.cpp @@ -76,20 +76,6 @@ VideoStore::VideoStore(const char *filename_in, const char *format_in, dsr = av_dict_set(&pmetadata, "title", "Zoneminder Security Recording", 0); if (dsr < 0) Warning("%s:%d: title set failed", __FILE__, __LINE__ ); - if ( orientation ) { - if ( orientation == Monitor::ROTATE_90 ) { - dsr = av_dict_set(&pmetadata, "rotate", "90", 0); - if (dsr < 0) Warning("%s:%d: title set failed", __FILE__, __LINE__ ); - } else if ( orientation == Monitor::ROTATE_180 ) { - dsr = av_dict_set(&pmetadata, "rotate", "180", 0); - if (dsr < 0) Warning("%s:%d: title set failed", __FILE__, __LINE__ ); - } else if ( orientation == Monitor::ROTATE_270 ) { - dsr = av_dict_set(&pmetadata, "rotate", "270", 0); - if (dsr < 0) Warning("%s:%d: title set failed", __FILE__, __LINE__ ); - } else { - Warning( "Unsupported Orientation(%d)", orientation ); - } - } oc->metadata = pmetadata; @@ -110,6 +96,20 @@ VideoStore::VideoStore(const char *filename_in, const char *format_in, if (oc->oformat->flags & AVFMT_GLOBALHEADER) { video_st->codec->flags |= CODEC_FLAG_GLOBAL_HEADER; } + if ( orientation ) { + if ( orientation == Monitor::ROTATE_90 ) { + dsr = av_dict_set( &video_st->metadata, "rotate", "90", 0); + if (dsr < 0) Warning("%s:%d: title set failed", __FILE__, __LINE__ ); + } else if ( orientation == Monitor::ROTATE_180 ) { + dsr = av_dict_set( &video_st->metadata, "rotate", "180", 0); + if (dsr < 0) Warning("%s:%d: title set failed", __FILE__, __LINE__ ); + } else if ( orientation == Monitor::ROTATE_270 ) { + dsr = av_dict_set( &video_st->metadata, "rotate", "270", 0); + if (dsr < 0) Warning("%s:%d: title set failed", __FILE__, __LINE__ ); + } else { + Warning( "Unsupported Orientation(%d)", orientation ); + } + } if (inpaud_st) {