Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Transform360 #22

Closed
telganainy opened this issue Jan 2, 2017 · 9 comments
Closed

Transform360 #22

telganainy opened this issue Jan 2, 2017 · 9 comments

Comments

@telganainy
Copy link

Hi,

Thanks for keeping this codebase updated. Was wondering if you can provide more details on how to install the latest update you pushed, specifically on how to do the following:
"

  1. Checkout the source for the Transform360, openCV and ffmpeg.
  2. Build .cpp and .h files in Transform360, together with openCV, as a library, where these files are dependent on openCV.
  3. Add the Transform360 library file to the extra-libs of ffmpeg.
    "?

Thanks so much.

@rpenggithub
Copy link

Sure. Will also add the following steps to the README file once you successfully build it.

  1. To build Transform360:
    You can use, say, cmake (https://cmake.org/). Followed is an example of the CMakeLists.txt with different components:
    (1) Write first part of CMakeLists.txt:

cmake_minimum_required(VERSION 2.8)

project (libtransform360)
set(CMAKE_BUILD_TYPE Release)

set (SOURCE_DIR "${PROJECT_SOURCE_DIR}/")

SET(SOURCES
${SOURCE_DIR}/VideoFrameTransform.cpp
${SOURCE_DIR}/VideoFrameTransformHandler.cpp)

SET(HEADERS
${SOURCE_DIR}VideoFrameTransform.h
${SOURCE_DIR}VideoFrameTransformHandler.h
${SOURCE_DIR}VideoFrameTransformHelper.h)

add_library(Transform360 STATIC ${SOURCES} ${HEADERS})
target_link_libraries(Transform360 ${PROJECT_LINK_LIBS} )

install(TARGETS Transform360
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
COMPONENT library
)
install(DIRECTORY . DESTINATION include/Transform360 FILES_MATCHING PATTERN "*.h")


(2) Add OpenCV:
We used a Facebook compiling tool to add OpenCV (>2.4.8) as a dependency of Transform360. You can try to add the following lines to the above file.


find_package(OpenCV REQUIRED)
include_directories(${OpenCV_INCLUDE_DIRS})
target_link_libraries(MY_TARGET_NAME ${OpenCV_LIBS})


(3) Specify CXXFLAGS:
Please follow http://stackoverflow.com/questions/10851247/how-to-activate-c-11-in-cmake to add "CXXFLAGS" and "-std=c++11" to the above CMakeLists.txt file based on the versions you are using.

  1. Build Transform360 library with FFmpeg:
    The successful building of Transform360 (with OpenCV as dependency) will generate the library file. We need to add it to FFmpeg as an extra library, which can be done by adding the following information to your FFmpeg configure line
    '--extra-libs= -ltransform360_pic -lstdc++'

  2. Add other stuff related to Transform360 to FFmpeg:
    You can follow the "To Build And Use Transform360" section in the README file to add vf_transform360.c to FFmpeg

Please let us know if it works for you.

@telganainy
Copy link
Author

Thanks so much Renbin for your detailed reply. Yes, it works for me.

I just made very minor changes. Here is the final CMakeLists.txt I used to build libTransform360.a:

cmake_minimum_required(VERSION 2.8)

project (libtransform360)
set(CMAKE_BUILD_TYPE Release)

set (SOURCE_DIR "${PROJECT_SOURCE_DIR}/")

SET(SOURCES
${SOURCE_DIR}/VideoFrameTransform.cpp
${SOURCE_DIR}/VideoFrameTransformHandler.cpp)

SET(HEADERS
${SOURCE_DIR}VideoFrameTransform.h
${SOURCE_DIR}VideoFrameTransformHandler.h
${SOURCE_DIR}VideoFrameTransformHelper.h)

list(APPEND CMAKE_CXX_FLAGS "-std=c++11 ${CMAKE_CXX_FLAGS}")

add_library(Transform360 STATIC ${SOURCES} ${HEADERS})
target_link_libraries(Transform360 ${PROJECT_LINK_LIBS} )

find_package(OpenCV REQUIRED)
include_directories(${OpenCV_INCLUDE_DIRS})
target_link_libraries(Transform360 ${OpenCV_LIBS})

install(TARGETS Transform360
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
COMPONENT library
)
install(DIRECTORY . DESTINATION include/Transform360 FILES_MATCHING PATTERN "*.h")

Also, here is the configuration line that I used for ffmpeg:

./configure --prefix=/usr/local --enable-gpl --enable-nonfree --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxvid --enable-libopencv --extra-libs='-lTransform360 -lstdc++'

Thanks again.

@rpenggithub
Copy link

That is great. I will move the step to the README file in next update.

@kwuerl
Copy link

kwuerl commented Jan 18, 2017

For any OSX + Homebrew guys:

./configure --prefix=/usr/local --enable-gpl --enable-nonfree --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxvid --enable-libopencv --extra-libs='-lTransform360 -lstdc++ ' --extra-cflags='-I/usr/local/include/ -I/usr/local/Cellar/lame/3.99.5/include/ -I/usr/local/Cellar/theora/1.1.1/include/' --host-ldflags=-L/usr/local/lib

Maybe you need to adjust your 'lame' and 'theora' versions at a later time.

@michaelstrigy
Copy link

hi there,
when doing cmake is finished and we run 'make', what is the result we are getting? what should we do with it, that is, how will ffmpeg know 'lTransform360' to use from configure?

thanks.

@rpenggithub
Copy link

It will generate a transform360 lib which can be recognized by ffmpeg based on the setting of ffmpeg mentioned above.

@michaelstrigy
Copy link

thanks you,
I am working on OSX, what i got was a file with a ".a" extension, is that the lib? and do i need to copy it to the ffmpeg dir?

thanks.

@rpenggithub
Copy link

You can put it in a place where FFmpeg can pick it up

@michaelstrigy
Copy link

ok i think i did it, just added in the configure command:
--extra-ldflags="-L/Transform360-lib-file-dir" --extra-cflags="-I/Transform360-include-dir"

now i get strange errors for AudioHardware.h on mac OSX, i guess something with transform360 and mac.

thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants