Repository: Kitware/kwiver (language: python)

Issue:
What ffmpeg version to use? (Example of a working build environment?)
This isn't exactly a bug with your software, but it is not clear what the build environment should be.

I had compiled the latest version of ffmpeg for working with opencv but then that is not compatible with VXL.

Then I tried finding a version [suggested in this (probably too old) post](http://sourceforge.net/p/vxl/mailman/message/20620601/) but that revision -r11322 doesn't compile with your version of opencv from fletch.

Anyway, I just wanted to know what a working build environment is.

Thank you!!

Alex



Discussion / hints:
Supported FFMPEG versions are 3.3.3 and 2.6.2. For ease of use, these versions are included as part of Kitware's [Fletch](https://github.com/Kitware/fletch). Closing...

Fix patch:
diff --git a/arrows/core/applets/dump_klv.cxx b/arrows/core/applets/dump_klv.cxx
index fe2a12432e..8d6a7ae83c 100644
--- a/arrows/core/applets/dump_klv.cxx
+++ b/arrows/core/applets/dump_klv.cxx
@@ -8,8 +8,9 @@
 
 #include "dump_klv.h"
 
-#include <iostream>
 #include <fstream>
+#include <iomanip>
+#include <iostream>
 
 #include <vital/algo/image_io.h>
 #include <vital/algo/metadata_map_io.h>
@@ -236,7 +237,6 @@ ::run()
     return EXIT_FAILURE;
   }
 
-  int count(1);
   kv::timestamp ts;
   kv::wrap_text_block wtb;
   kv::metadata_map::map_metadata_t frame_metadata;
@@ -253,8 +253,11 @@ ::run()
   {
     if ( !quiet )
     {
-      std::cout << "========== Read frame " << ts.get_frame()
-                << " (index " << count << ") ==========" << std::endl;
+      std::cout
+        << "Frame # " << std::setw( 6 ) << std::setfill( ' ' ) << ts.get_frame()
+        << " @ " << std::fixed << std::setprecision( 6 )
+        << ts.get_time_seconds() << " sec" << std::endl
+        << std::string( 64, '-' ) << std::endl;
     }
 
     kv::metadata_vector metadata = video_reader->frame_metadata();
@@ -265,36 +268,41 @@ ::run()
       frame_metadata.insert( { ts.get_frame(), metadata } );
     }
 
-    if ( !quiet )
+    if( !quiet )
     {
-      for ( auto const& meta : metadata )
+      size_t packet_count = 1;
+      for( auto const& meta : metadata )
       {
-        std::cout << "\n\n---------------- Metadata from: "
-                  << meta->timestamp() << std::endl;
+        std::cout
+          << "Metadata packet #" << packet_count << std::endl
+          << std::string( 32, '-' ) << std::endl;
 
-        if ( detail )
+        if( detail )
         {
-          for ( auto const& ix : *meta )
+          for( auto const& entry : *meta )
           {
-            // process metada items
-            auto const& name = ix.second->name();
-            auto const& tag = ix.second->tag();
-            auto const& descrip = kv::tag_traits_by_tag( tag ).description();
+            auto const description =
+              kv::tag_traits_by_tag( entry.first ).description();
+            auto const value_string =
+              kv::metadata::format_string( entry.second->as_string() );
 
             std::cout
-                << "Metadata item: " << name << std::endl
-                << wtb.wrap_text( descrip )
-                << "Data: <" << ix.second->type().name() << ">: "
-                << kv::metadata::format_string(ix.second->as_string())
-                << std::endl;
+              << entry.second->name() << std::endl
+              << wtb.wrap_text( description )
+              << "Type:  " << entry.second->type_name() << std::endl
+              << "Value: " << value_string << std::endl << std::endl;
           }
         }
         else
         {
           print_metadata( std::cout, *meta );
         }
-      } // end for over metadata collection vector
-    } // The end of not quiet
+        std::cout << std::endl;
+        ++packet_count;
+      }
+
+      std::cout << std::endl;
+    }
 
     if( cmd_args.count( "frames" ) )
     {
@@ -322,9 +330,7 @@ ::run()
         task();
       }
     }
-
-    ++count;
-  } // end while over video
+  }
 
   if ( log )
   {
diff --git a/doc/release-notes/master.txt b/doc/release-notes/master.txt
index 2f48bc8408..d6670af002 100644
--- a/doc/release-notes/master.txt
+++ b/doc/release-notes/master.txt
@@ -25,6 +25,8 @@ Arrows: Core
 * Added pass-throughs for uninterpreted video data in the metadata_filter and
   buffered_metadata_filter video inputs.
 
+* Cleaned up dump-klv's printed output.
+
 Arrows: FFmpeg
 
 * Added check for incoming raw video packets' timestamps and stream indices.
diff --git a/vital/types/geo_point.cxx b/vital/types/geo_point.cxx
index 31b471635b..6f629dc7b3 100644
--- a/vital/types/geo_point.cxx
+++ b/vital/types/geo_point.cxx
@@ -99,7 +99,6 @@ ::set_location( geo_3d_point_t const& loc, int crs )
 std::ostream&
 operator<<( std::ostream& str, vital::geo_point const& obj )
 {
-  str << "geo_point\n";
   if ( obj.is_empty() )
   {
     str << "[ empty ]";
diff --git a/vital/types/metadata.cxx b/vital/types/metadata.cxx
index 50f914e0f1..5785d7f669 100644
--- a/vital/types/metadata.cxx
+++ b/vital/types/metadata.cxx
@@ -10,6 +10,7 @@
 #include <vital/types/metadata_traits.h>
 #include <vital/util/demangle.h>
 
+#include <ios>
 #include <typeindex>
 
 #include <cmath>
@@ -51,6 +52,14 @@ struct print_visitor {
     return os << value;
   }
 
+  std::ostream& operator()( bool value ) const
+  {
+    auto flags = os.flags();
+    os << std::boolalpha << value;
+    os.flags( flags );
+    return os;
+  }
+
   std::ostream& os;
 };
 
@@ -482,23 +491,16 @@ ::format_string( std::string const& val )
 }
 
 // ----------------------------------------------------------------------------
-std::ostream& print_metadata( std::ostream& str, metadata const& metadata )
+std::ostream& print_metadata( std::ostream& os, metadata const& metadata )
 {
-  auto eix = metadata.end();
-  for ( auto ix = metadata.begin(); ix != eix; ix++)
+  for( auto const& entry : metadata )
   {
-    // process metada items
-   std::string name = ix->second->name();
-   kwiver::vital::any data = ix->second->data();
-
-   str << "Metadata item: "
-       << name
-       << " <" << demangle( ix->second->type().name() ) << ">: "
-       << metadata::format_string (ix->second->as_string())
+    os << entry.second->name() << ": "
+       << metadata::format_string( entry.second->as_string() )
        << std::endl;
-  } // end for
+  }
 
-  return str;
+  return os;
 }
 
 // ----------------------------------------------------------------------------
diff --git a/vital/types/metadata_traits.cxx b/vital/types/metadata_traits.cxx
index dc8971afea..9b6fe94a11 100644
--- a/vital/types/metadata_traits.cxx
+++ b/vital/types/metadata_traits.cxx
@@ -442,7 +442,17 @@ std::string
 metadata_tag_traits
 ::type_name() const
 {
-  return demangle( m_type.name() );
+  static std::map< std::type_index, std::string > const map = {
+    { typeid( bool ), "bool" },
+    { typeid( int ), "int" },
+    { typeid( uint64_t ), "uint64" },
+    { typeid( double ), "double" },
+    { typeid( std::string ), "string" },
+    { typeid( geo_point ), "geo_point" },
+    { typeid( geo_polygon ), "geo_polygon" },
+  };
+
+  return map.at( m_type );
 }
 
 // ----------------------------------------------------------------------------


Test patch:
diff --git a/python/kwiver/vital/tests/test_geo_point.py b/python/kwiver/vital/tests/test_geo_point.py
index e016fd2d5f..8fc7845800 100644
--- a/python/kwiver/vital/tests/test_geo_point.py
+++ b/python/kwiver/vital/tests/test_geo_point.py
@@ -181,7 +181,7 @@ def test_conversion(self):
 
     def test_to_str_empty(self):
         p1 = gp.GeoPoint()
-        nt.assert_equals(str(p1), "geo_point\n[ empty ]")
+        nt.assert_equals(str(p1), "[ empty ]")
         print("empty geo_point to string:", str(p1), sep='\n')
 
     # Also make sure the doubles roundtrip
@@ -193,25 +193,24 @@ def test_to_str(self):
         split_str = str(p1).split()
 
         # Initial strings
-        nt.assert_equals(split_str[0], "geo_point")
-        nt.assert_equals(split_str[1], "[")
+        nt.assert_equals(split_str[0], "[")
 
         # Parsing easting
-        easting_out, comma = split_str[2][:-1], split_str[2][-1]
+        easting_out, comma = split_str[1][:-1], split_str[1][-1]
         nt.assert_equals(comma, ",")
         np.testing.assert_almost_equal(float(easting_out), easting_in, decimal=15)
 
         # Parsing northing
-        northing_out, comma = split_str[3][:-1], split_str[3][-1]
+        northing_out, comma = split_str[2][:-1], split_str[2][-1]
         nt.assert_equals(comma, ",")
         np.testing.assert_almost_equal(float(northing_out), northing_in, decimal=15)
 
         # Altitude (0)
-        altitude_out = split_str[4]
+        altitude_out = split_str[3]
         nt.assert_almost_equal(float(altitude_out), 0)
 
-        nt.assert_equals(split_str[5], "]")
-        nt.assert_equals(split_str[6], "@")
-        nt.assert_equals(int(split_str[7]), self.crs_ll)
+        nt.assert_equals(split_str[4], "]")
+        nt.assert_equals(split_str[5], "@")
+        nt.assert_equals(int(split_str[6]), self.crs_ll)
 
         print("geo_point with data:", str(p1), sep='\n')
diff --git a/python/kwiver/vital/tests/test_metadata_traits.py b/python/kwiver/vital/tests/test_metadata_traits.py
index 771a8550b7..dfed0312f2 100644
--- a/python/kwiver/vital/tests/test_metadata_traits.py
+++ b/python/kwiver/vital/tests/test_metadata_traits.py
@@ -43,7 +43,6 @@
 from kwiver.vital.types import (
     metadata_tags as mt,
 )
-from kwiver.vital.tests.cpp_helpers import type_check as tc
 
 
 class TestVitalMetaTraits(unittest.TestCase):
@@ -66,7 +65,7 @@ def test_vital_meta_traits(self):
                                     mt.tags.VITAL_META_UNIX_TIMESTAMP,
                                     "Unix Timestamp (microseconds)",
                                     "UNIX_TIMESTAMP",
-                                    tc.get_uint64_rep(),
+                                    "uint64",
                                     "Number of microseconds since the Unix epoch, not counting leap seconds.")
 
         self.check_are_valid_traits(tag_traits_by_tag( mt.tags.VITAL_META_SLANT_RANGE ),
diff --git a/vital/tests/test_geo_point.cxx b/vital/tests/test_geo_point.cxx
index 5ce291b923..b42fe2acf1 100644
--- a/vital/tests/test_geo_point.cxx
+++ b/vital/tests/test_geo_point.cxx
@@ -172,7 +172,7 @@ TEST(geo_point, insert_operator_empty)
   std::stringstream str;
   str << p_empty;
 
-  EXPECT_EQ( "geo_point\n[ empty ]", str.str() );
+  EXPECT_EQ( "[ empty ]", str.str() );
 }
 
 // ----------------------------------------------------------------------------
@@ -216,7 +216,6 @@ TEST_P(geo_point_roundtrip, insert_operator)
   int crs;
   std::string dummy;
 
-  in >> dummy; // geo_point\n
   in >> dummy; // [
   in >> easting;
   in >> northing;