[vtkusers] FFMPEG latest release in VTK

Berk Geveci berk.geveci at kitware.com
Tue Dec 1 16:05:01 EST 2009


Is this backwards compatible (i.e. would it work with older version of
ffmpeg)? I have some local changes to make VTK work with the latest
ffmpeg as well as older versions. If yours is not backwards
compatible, I'll probably ignore it and commit my stuff. Otherwise, I
can compare the two codes and commit the one that looks better.

-berk

On Tue, Dec 1, 2009 at 3:47 PM, Nicolas Rannou
<Nicolas_Rannou at hms.harvard.edu> wrote:
> Hello,
>
> so far, we have to use old versions of FFMPEG in order to make it usable
> with vtkFFMPEGWriter.cxx.
> here is a solution to use FFMPEG latest release in VTK (note that we checked
> with ffmpeg folks and we only used LGPL components).
>
> It has been tested on Linux and Mac so far.
>
> You only need to replace:
>  - FindFFMPEG.cmake in /VTK/CMake/
>  - CMakeLists.txt in /VTK/IO/
>  - vtkFFMPEGWriter.cxx in /VTK/IO/
>
> Would it be possible to integrate it in VTK? Indeed, the previous FFMPEG
> working version is more than 2 years old and it would be nice to upgrade to
> the next versions. I am not sure if old versions of ffmpeg with vtk properly
> work on mac, and windows...
> Since VTK is a visualization tool, easily recording video using FFMPEG would
> be very usefull!!!
>
> Few days back, I also asked if it was possible to add:
> SET( VTK_USE_FFMPEG_ENCODER "@VTK_USE_FFMPEG_ENCODER@" ) in
> /VTK/VTKConfig.cmake.in
> indeed, it appears that this variable is missing.
>
> Do I need to open a request/bug on Mantis for that?
>
> Thanks,
>
> Nicolas
>
>
> Nicolas Rannou wrote:
>>
>> Mathieu Malaterre wrote:
>>
>>>
>>> On Tue, Dec 1, 2009 at 3:36 PM, David E DeMarle
>>> <dave.demarle at kitware.com> wrote:
>>>
>>>>
>>>> The recommended way to get ffmpeg to work with vtk is to download the
>>>> old version of ffmpeg that is known to work with VTK from from
>>>> http://www.vtk.org/VTK/resources/software.html#addons, and follow the
>>>> directions in the README.
>>>>
>>>> If you need to use a modern ffmpeg then FFMPEG_INCLUDE should point to
>>>> a directory that has ffmpeg/avformat.h in it. If you can't find that
>>>> in /usr/include, find out where ubuntu's ffmpeg package puts it.Note,
>>>> some linux distributions have separate developer and user packages and
>>>> you generally have to install the developer package to get the header
>>>> files, but I do not suspect that is the problem in this case.
>>>>
>>>> You will also have to change the vtk ffmpeg exporter class to work
>>>> with the new ffmpeg library. I recall seeing a patch on the mailing
>>>> list or the bug tracker that does that, but I can't seem to track it
>>>> down right now.
>>>>
>>>
>>> debian is using this one:
>>>
>>>
>>> http://patch-tracker.debian.org/patch/misc/view/vtk/5.2.1-13/IO/vtkFFMPEGWriter.cxx
>>>
>>> HTH
>>>
>>
>> We just fixed this in linux.
>> You should remplace
>>
>> -FindFFMPEG.cmake in VTK/CMake/
>> -CMakeLists in VTK/IO/
>> -vtkFFMPEGWriter.cxx in VTK/IO/
>>
>> We still have to check that it works properly in mac and windows...
>>
>> HTH
>>
>
> IF(VTK_USE_METAIO)
>  SET(_VTK_METAIO_LIB vtkmetaio)
>  SET(_VTK_METAIO_SOURCES vtkMetaImageReader.cxx vtkMetaImageWriter.cxx )
> ELSE(VTK_USE_METAIO)
>  SET(_VTK_METAIO_LIB)
>  SET(_VTK_METAIO_SOURCES)
> ENDIF(VTK_USE_METAIO)
>
> SET(KIT IO)
> SET(UKIT IO)
> SET(KIT_TCL_LIBS vtkFilteringTCL)
> SET(KIT_PYTHON_LIBS vtkFilteringPythonD)
> SET(KIT_JAVA_LIBS vtkFilteringJava)
> SET(KIT_INTERFACE_LIBRARIES vtkFiltering)
> SET(KIT_LIBS vtkDICOMParser vtkNetCDF ${_VTK_METAIO_LIB} vtksqlite
>  ${VTK_PNG_LIBRARIES} ${VTK_ZLIB_LIBRARIES} ${VTK_JPEG_LIBRARIES}
>  ${VTK_TIFF_LIBRARIES} ${VTK_EXPAT_LIBRARIES}
>  ${KWSYS_NAMESPACE})
>
> SET( Kit_SRCS
> vtkAbstractParticleWriter.cxx
> vtkAVSucdReader.cxx
> vtkBMPReader.cxx
> vtkBMPWriter.cxx
> vtkBYUReader.cxx
> vtkBYUWriter.cxx
> vtkBase64InputStream.cxx
> vtkBase64OutputStream.cxx
> vtkBase64Utilities.cxx
> vtkCGMWriter.cxx
> vtkChacoReader.cxx
> vtkCosmoReader.cxx
> vtkDEMReader.cxx
> vtkDICOMImageReader.cxx
> vtkDataCompressor.cxx
> vtkDataObjectReader.cxx
> vtkDataObjectWriter.cxx
> vtkDataReader.cxx
> vtkDataSetReader.cxx
> vtkDataSetWriter.cxx
> vtkDataWriter.cxx
> vtkDelimitedTextWriter.cxx
> vtkEnSight6BinaryReader.cxx
> vtkEnSight6Reader.cxx
> vtkEnSightGoldBinaryReader.cxx
> vtkEnSightGoldReader.cxx
> vtkEnSightMasterServerReader.cxx
> vtkEnSightReader.cxx
> vtkFLUENTReader.cxx
> vtkFacetWriter.cxx
> vtkGenericDataObjectReader.cxx
> vtkGenericDataObjectWriter.cxx
> vtkGESignaReader.cxx
> vtkGAMBITReader.cxx
> vtkGaussianCubeReader.cxx
> vtkGenericEnSightReader.cxx
> vtkGenericMovieWriter.cxx
> vtkGlobFileNames.cxx
> vtkGraphReader.cxx
> vtkGraphWriter.cxx
> vtkIVWriter.cxx
> vtkImageReader.cxx
> vtkImageReader2.cxx
> vtkImageReader2Collection.cxx
> vtkImageReader2Factory.cxx
> vtkImageWriter.cxx
> vtkInputStream.cxx
> vtkJavaScriptDataWriter.cxx
> vtkJPEGReader.cxx
> vtkJPEGWriter.cxx
> vtkMFIXReader.cxx
> vtkMaterialLibrary.cxx
> vtkMCubesReader.cxx
> vtkMCubesWriter.cxx
> vtkMedicalImageProperties.cxx
> vtkMedicalImageReader2.cxx
> ${_VTK_METAIO_SOURCES}
> vtkMINCImageAttributes.cxx
> vtkMINCImageReader.cxx
> vtkMINCImageWriter.cxx
> vtkMultiBlockPLOT3DReader.cxx
> vtkMoleculeReaderBase.cxx
> vtkNetCDFCOARDSReader.cxx
> vtkNetCDFReader.cxx
> vtkOBJReader.cxx
> vtkOutputStream.cxx
> vtkOpenFOAMReader.cxx
> vtkPDBReader.cxx
> vtkPLOT3DReader.cxx
> vtkPLY.cxx
> vtkPLYReader.cxx
> vtkPLYWriter.cxx
> vtkPNGReader.cxx
> vtkPNGWriter.cxx
> vtkPNMReader.cxx
> vtkPNMWriter.cxx
> vtkParticleReader.cxx
> vtkPolyDataReader.cxx
> vtkPolyDataWriter.cxx
> vtkPostScriptWriter.cxx
> vtkRectilinearGridReader.cxx
> vtkRectilinearGridWriter.cxx
> vtkRTXMLPolyDataReader.cxx
> vtkRowQuery.cxx
> vtkSESAMEReader.cxx
> vtkShaderCodeLibrary.cxx
> vtkSLACParticleReader.cxx
> vtkSLACReader.cxx
> vtkSQLDatabase.cxx
> vtkSQLDatabaseSchema.cxx
> vtkSQLiteDatabase.cxx
> vtkSQLiteQuery.cxx
> vtkSQLQuery.cxx
> vtkSLCReader.cxx
> vtkSTLReader.cxx
> vtkSTLWriter.cxx
> vtkSimplePointsReader.cxx
> vtkSortFileNames.cxx
> vtkStructuredGridReader.cxx
> vtkStructuredGridWriter.cxx
> vtkStructuredPointsReader.cxx
> vtkStructuredPointsWriter.cxx
> vtkTableReader.cxx
> vtkTableWriter.cxx
> vtkTecplotReader.cxx
> vtkTIFFReader.cxx
> vtkTIFFWriter.cxx
> vtkTreeReader.cxx
> vtkTreeWriter.cxx
> vtkUGFacetReader.cxx
> vtkUnstructuredGridReader.cxx
> vtkUnstructuredGridWriter.cxx
> vtkVolume16Reader.cxx
> vtkVolumeReader.cxx
> vtkWriter.cxx
> vtkXMLCompositeDataReader.cxx
> vtkXMLDataParser.cxx
> vtkXMLDataReader.cxx
> vtkXMLDataSetWriter.cxx
> vtkXMLFileReadTester.cxx
> vtkXMLHierarchicalBoxDataReader.cxx
> vtkXMLHierarchicalDataReader.cxx
> vtkXMLImageDataReader.cxx
> vtkXMLImageDataWriter.cxx
> vtkXMLHyperOctreeReader.cxx
> vtkXMLHyperOctreeWriter.cxx
> vtkXMLMaterial.cxx
> vtkXMLMaterialParser.cxx
> vtkXMLMaterialReader.cxx
> vtkXMLMultiBlockDataReader.cxx
> vtkXMLMultiGroupDataReader.cxx
> vtkXMLCompositeDataWriter.cxx
> vtkXMLMultiBlockDataWriter.cxx
> vtkXMLHierarchicalBoxDataWriter.cxx
> vtkXMLPDataReader.cxx
> vtkXMLPDataSetWriter.cxx
> vtkXMLPDataWriter.cxx
> vtkXMLPImageDataReader.cxx
> vtkXMLPImageDataWriter.cxx
> vtkXMLPPolyDataReader.cxx
> vtkXMLPPolyDataWriter.cxx
> vtkXMLPRectilinearGridReader.cxx
> vtkXMLPRectilinearGridWriter.cxx
> vtkXMLPStructuredDataReader.cxx
> vtkXMLPStructuredDataWriter.cxx
> vtkXMLPStructuredGridReader.cxx
> vtkXMLPStructuredGridWriter.cxx
> vtkXMLPUnstructuredDataReader.cxx
> vtkXMLPUnstructuredDataWriter.cxx
> vtkXMLPUnstructuredGridReader.cxx
> vtkXMLPUnstructuredGridWriter.cxx
> vtkXMLParser.cxx
> vtkXMLPolyDataReader.cxx
> vtkXMLPolyDataWriter.cxx
> vtkXMLReader.cxx
> vtkXMLRectilinearGridReader.cxx
> vtkXMLRectilinearGridWriter.cxx
> vtkXMLShader.cxx
> vtkXMLStructuredDataReader.cxx
> vtkXMLStructuredDataWriter.cxx
> vtkXMLStructuredGridReader.cxx
> vtkXMLStructuredGridWriter.cxx
> vtkXMLUnstructuredDataReader.cxx
> vtkXMLUnstructuredDataWriter.cxx
> vtkXMLUnstructuredGridReader.cxx
> vtkXMLUnstructuredGridWriter.cxx
> vtkXMLUtilities.cxx
> vtkXMLWriter.cxx
> vtkXMLWriterC.cxx
> vtkXYZMolReader.cxx
> vtkZLibDataCompressor.cxx
> )
>
> SET_SOURCE_FILES_PROPERTIES(
> vtkAbstractParticleWriter
> vtkDataCompressor
> vtkEnSightReader
> vtkGenericMovieWriter
> vtkMoleculeReaderBase
> vtkRowQuery
> vtkSQLDatabase
> vtkSQLQuery
> vtkVolumeReader
> vtkWriter
> vtkXMLCompositeDataReader.cxx
> vtkXMLCompositeDataWriter
> vtkXMLDataReader
> vtkXMLPDataReader
> vtkXMLPDataWriter
> vtkXMLPStructuredDataReader
> vtkXMLPStructuredDataWriter
> vtkXMLPUnstructuredDataReader
> vtkXMLPUnstructuredDataWriter
> vtkXMLReader
> vtkXMLStructuredDataReader
> vtkXMLStructuredDataWriter
> vtkXMLUnstructuredDataReader
> vtkXMLUnstructuredDataWriter
> vtkXMLWriter
> ABSTRACT
> )
>
> INSTALL(FILES
>  ${CMAKE_CURRENT_SOURCE_DIR}/vtkMINC.h
>  DESTINATION ${VTK_INSTALL_INCLUDE_DIR_CM24}
>  COMPONENT Development
>  )
>
> # Set up dependencies on the header files generated by
> # Utilities/MaterialLibrary
> SET_SOURCE_FILES_PROPERTIES(vtkXMLShader.cxx PROPERTIES OBJECT_DEPENDS
>  ${MATERIAL_LIBRARY_SHADER_MACRO_HEADER})
> SET_SOURCE_FILES_PROPERTIES(vtkXMLMaterial.cxx PROPERTIES OBJECT_DEPENDS
>  ${MATERIAL_LIBRARY_MATERIAL_MACRO_HEADER})
>
> IF(WIN32)
>  IF(VTK_USE_VIDEO_FOR_WINDOWS)
>    SET(Kit_SRCS ${Kit_SRCS} vtkAVIWriter.cxx)
>    SET(KIT_LIBS ${KIT_LIBS} vfw32)
>  ENDIF(VTK_USE_VIDEO_FOR_WINDOWS)
> ENDIF(WIN32)
>
> #-----------------------------------------------------------------------------
> # FFMPEG
> # If the ffmpeg library is available, compile vtkFFMPEGWriter.
> IF (VTK_USE_FFMPEG_ENCODER)
>  INCLUDE_DIRECTORIES(${FFMPEG_INCLUDE_DIR})
>  SET(Kit_SRCS ${Kit_SRCS} vtkFFMPEGWriter.cxx)
>  SET(KIT_LIBS ${KIT_LIBS} ${FFMPEG_LIBRARIES}
> #    ${FFMPEG_avformat_LIBRARY}
> #    ${FFMPEG_avcodec_LIBRARY}
> #    ${FFMPEG_avutil_LIBRARY})
> )
> ENDIF (VTK_USE_FFMPEG_ENCODER)
>
> #-----------------------------------------------------------------------------
> # MPEG2
> #
> # Only include the vtkMPEG2Writer if the user has explicitly turned on
> # VTK_USE_MPEG2_ENCODER. If so, user should also have set
> # vtkMPEG2Encode_INCLUDE_PATH and vtkMPEG2Encode_LIBRARIES.
> #
> IF (VTK_USE_MPEG2_ENCODER)
>  INCLUDE_DIRECTORIES(${vtkMPEG2Encode_INCLUDE_PATH})
>  SET(Kit_SRCS ${Kit_SRCS} vtkMPEG2Writer.cxx)
>  SET(KIT_LIBS ${KIT_LIBS} ${vtkMPEG2Encode_LIBRARIES})
> ENDIF (VTK_USE_MPEG2_ENCODER)
>
> #-----------------------------------------------------------------------------
> # PostgreSQL
> # build the PostgreSQL database backend (if the PostgresSQL and pqxx
> libraries are available)
> #
> OPTION( VTK_USE_POSTGRES "Build the PostgreSQL driver for vtkSQLDatabase."
> OFF)
> MARK_AS_ADVANCED(VTK_USE_POSTGRES)
> IF ( VTK_USE_POSTGRES )
>  FIND_PACKAGE( POSTGRES REQUIRED )
>  IF ( BUILD_TESTING )
>    SET ( VTK_PSQL_TEST_URL "" CACHE STRING "A URL for a PostgreSQL server of
> the form psql://[[username[:password]@]hostname[:port]]/[dbname]" )
>  ENDIF ( BUILD_TESTING )
> ENDIF ( VTK_USE_POSTGRES )
> #
> # Only include the Postgres backend if the user has explicitly turned on
> # VTK_USE_POSTGRES. If so, user must also have set POSTGRES_LIBRARIES
> # and POSTGRES_INCLUDE_DIRECTORIES to valid values.
> IF ( VTK_USE_POSTGRES AND POSTGRES_FOUND )
>  INCLUDE_DIRECTORIES( ${POSTGRES_INCLUDE_DIRECTORIES} )
>  SET( Kit_SRCS
>    ${Kit_SRCS}
>    vtkPostgreSQLDatabase.cxx
>    vtkPostgreSQLQuery.cxx
>  )
>  LINK_LIBRARIES( ${POSTGRES_LIBRARIES} )
> ENDIF ( VTK_USE_POSTGRES AND POSTGRES_FOUND )
>
> #-----------------------------------------------------------------------------
> # MySQL
> # build the MySQL database backend (if the MySQL libraries are available)
> #
> OPTION( VTK_USE_MYSQL "Build the MySQL driver for vtkSQLDatabase." OFF)
> MARK_AS_ADVANCED(VTK_USE_MYSQL)
> IF ( VTK_USE_MYSQL )
>  FIND_PACKAGE( MySQL REQUIRED )
>  IF ( BUILD_TESTING )
>    SET ( VTK_MYSQL_TEST_URL "" CACHE STRING "A URL for a MySQL server of the
> form mysql://[[username[:password]@]hostname[:port]]/[dbname]" )
>  ENDIF ( BUILD_TESTING )
> ENDIF ( VTK_USE_MYSQL )
> #
> # Only include the MySQL backend if the user has explicitly turned on
> # VTK_USE_MYSQL. If so, user must also have set MYSQL_LIBRARIES
> # and MYSQL_INCLUDE_DIRECTORIES to valid values.
> IF ( VTK_USE_MYSQL AND MYSQL_FOUND )
>  INCLUDE_DIRECTORIES( ${MYSQL_INCLUDE_DIRECTORIES} )
>  SET( Kit_SRCS
>    ${Kit_SRCS}
>    vtkMySQLDatabase.cxx
>    vtkMySQLQuery.cxx
>  )
>  LINK_LIBRARIES( ${MYSQL_LIBRARY}  ${MYSQL_EXTRA_LIBRARIES} )
> ENDIF ( VTK_USE_MYSQL AND MYSQL_FOUND )
>
> #-----------------------------------------------------------------------------
> # ODBC
> # Build the ODBC database backend only if ODBC driver manager is available
> #
> OPTION (VTK_USE_ODBC "Build the ODBC database interface" OFF)
> MARK_AS_ADVANCED(VTK_USE_ODBC)
> IF ( VTK_USE_ODBC )
>  FIND_PACKAGE( ODBC REQUIRED )
>  IF ( BUILD_TESTING )
>    SET ( VTK_ODBC_TEST_DSN "" CACHE STRING "A data source name (DSN) for an
> ODBC database connection to use for testing." )
>  ENDIF ( BUILD_TESTING )
> ENDIF ( VTK_USE_ODBC )
>
> IF ( VTK_USE_ODBC AND ODBC_FOUND )
>  INCLUDE_DIRECTORIES( ${ODBC_INCLUDE_DIRECTORIES} )
>  SET( Kit_SRCS
>    ${Kit_SRCS}
>    vtkODBCDatabase.cxx
>    vtkODBCQuery.cxx
>    )
>  LINK_LIBRARIES( ${ODBC_LIBRARIES} )
>  # Note: Strange things happen on 64-bit machines.  We must compile
>  # ODBC code with -DBUILD_REAL_64_BIT_MODE in order to have the driver
>  # work properly.
>  INCLUDE(CheckTypeSize)
>  CHECK_TYPE_SIZE("unsigned long" CMAKE_SIZEOF_LONG)
>  IF ( "${CMAKE_SIZEOF_LONG}" STREQUAL "8" )
> #    MESSAGE( STATUS "Building ODBC driver with 64-bit flag." )
>    ADD_DEFINITIONS( -DBUILD_REAL_64_BIT_MODE )
>  ENDIF ( "${CMAKE_SIZEOF_LONG}"  STREQUAL "8" )
> ENDIF ( VTK_USE_ODBC AND ODBC_FOUND )
>
> #-----------------------------------------------------------------------------
> # Add these classes only if vtkTypeUInt64Array exists
> IF(VTK_HAS_UINT64_ARRAY)
>  SET(Kit_SRCS
>    ${Kit_SRCS}
>    vtkRowQueryToTable.cxx
>  )
> ENDIF(VTK_HAS_UINT64_ARRAY)
>
>
> #-----------------------------------------------------------------------------
> SET_SOURCE_FILES_PROPERTIES(
>  vtkPLY
>  vtkXMLWriterC
>  WRAP_EXCLUDE
> )
>
> #-----------------------------------------------------------------------------
> # N-WAY ARRAYS READER AND WRITER
> IF(VTK_USE_N_WAY_ARRAYS)
>
>  SET(Kit_SRCS
>    ${Kit_SRCS}
>    vtkArrayReader.cxx
>    vtkArrayWriter.cxx
>    )
>
> ENDIF(VTK_USE_N_WAY_ARRAYS)
> #-----------------------------------------------------------------------------
>
> SET(Kit_EXTRA_SRCS)
> SET(Kit_EXTRA_CMDS)
> SET(Kit_TCL_EXTRA_SRCS)
> SET(Kit_PYTHON_EXTRA_SRCS)
> SET(Kit_JAVA_EXTRA_SRCS)
> SET(KIT_TCL_DEPS)
> SET(KIT_PYTHON_DEPS)
> SET(KIT_JAVA_DEPS)
>
> #-----------------------------------------------------------------------------
> # Include CMake code common to all kits.
> INCLUDE(${VTK_CMAKE_DIR}/KitCommonBlock.cmake)
> #-----------------------------------------------------------------------------
> # Add target dependency.
> ADD_DEPENDENCIES(vtkIO
>  vtkMaterialLibraryConfiguredFiles)
> #-----------------------------------------------------------------------------
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
>



More information about the vtkusers mailing list