Results 1 to 3 of 3

Thread: 10.04: Openshot (mlt+ffmpeg) for Theora ogv - 'portable' build from latest source

  1. #1
    Join Date
    Sep 2009
    Beans
    72

    10.04: Openshot (mlt+ffmpeg) for Theora ogv - 'portable' build from latest source

    Hi all,

    I was having some trouble trying to get video editing directly with Theora OGVs on Ubuntu 10.04. To be honest, the default Lucid video editor Pitivi (which is a front-end for gstreamer) actually works fine with ogv - but you cannot do video overlays (compositing) in Pitivi.

    So I looked at Cinelerra, LiVES, OpenShot and Kdenlive as editors that may offer overlays/compositing. They can all be sudo apt-get install-ed, but none of them wanted to run properly with ogvs - especially the ogv video preview didn't work. Looking for a solution, the following bugs came up:



    Etc - you get the picture. The thing is, that both Openshot and Kdenlive use melt from the MLT framework; melt in turn uses ffmpeg to gain access to Theora ogv encoding and decoding (via libvorbis/libtheora/libogg ).

    The key issue is described - and apparently a bugfix - is given here:
    Quote Originally Posted by https://bugs.launchpad.net/ubuntu/+source/ffmpeg/+bug/305286
    /comments/21:
    Most likely the problem lies here:

    r18986 | conrad | 2009-05-29 14:43:22 -0700 (Fri, 29 May 2009) | 1 line
    Support block-level quantization in Theora

    Lucid has apparently updated the Theora encoder library without updating the decoder to support the new features, resulting in obvious problems.

    /comments/25:
    aha, this means that recordmydesktop uses a newer feature of ogg (block
    level quantization). ... I'm
    therefore inclined to reject this patch for ffmpeg 0.5.2 and therefore
    the ubuntu package.

    /comments/27:
    This bug was fixed in the package ffmpeg - 4:0.6~svn20100505-1ubuntu1

    ---------------
    ffmpeg (4:0.6~svn20100505-1ubuntu1) maverick; urgency=low

    /comments/28:
    Is there any chance to get an update/bugfix for lucid? ... Because Lucid is an LTS-Version, IMHO there should be a Bugfix for the Version 0.5.1
    However, since it doesn't seem a bugfix will be released for Lucid - that pretty much means only one thing, if we want video editing of ogv in Lucid: build from source. If we build all dependencies for Theora ogv video from the latest source:
    • melt
    • ffmpeg
    • vorbis
    • theora
    • ogg

    then, in principle, working with ogv in Openshot and/or Kdenlive should (and does) work - if these video editors are directed to use these new binaries (built from source). Note that Openshot is basically a python frontend for melt, and it does not need compiling as such (though some precautions should be taken, see below) - so once the above sources are built, a test with Openshot can be done.

    The reference post I used for building these sources is

    This HOWTO uses checkinstall in order to generate .deb packages from source, which are then installed into the running OS, to allow for satisfying of dependencies. However, I'd like to keep my system 'vanilla' clean, and experiment with sources outside of my system (i.e. as in a "portable installation") - and this post outlines that approach.
    '

    Basically, we download the sources, and build them in order of dependency - and since ogg/vorbis/theora source already uses it, we can use pkg-config to configure some other source dependencies as well: by writing *-uninstalled.pc files in respective source directories; and then adding these directories to the PKG_CONFIG_PATH environment variable. However, some manual changes to source files will be needed too.

    Finally, for each source package, we will run only 'make', but not 'make install' - and then in the end, we will collect all binaries (libraries and executables) in a single folder; and add a couple of scripts, that will setup an environment referring to these binaries, so that Openshot/Kdenlive (when called from this environment) may work correctly with ogv.

    The full list of sources built using this approach are:
    • ogg
    • vorbis
    • theora
    • x264
    • vpx (libvpx)
    • ffmpeg
    • mltframework / melt
    • openshot
    • oggvideotools


    Both x264, and libvpx (for VP8/WebM), have been added as recommended in the HOWTO; while Ogg Video Tools are added mostly for the (relatively new) tool oggTranscode.

    The approach to building these sources is given below, in the form of a commented bash script - since its quite big, it is included in the reply to this post.

    Well, hope this can help someone,
    Cheers!


    References:

  2. #2
    Join Date
    Sep 2009
    Beans
    72

    Re: 10.04: Openshot (mlt+ffmpeg) for Theora ogv - 'portable' build from latest source

    Note that:

    • after the build, the 'videosrc' folder would be around 570 MB in size;
    • the 'binout' ("portable") folder would take up about 160 MB from it.
    • You could save the script below as buildvidsrc.sh; then 'chmod +x buildvidsrc.sh' and run this script. It should run and complete (although not unnatended - sudo asks for password, etc) the entire procedure succesfully - but note that has not been tested (i.e. remember no warranty - script could break )



    Here is the script:
    Code:
    set -x # if you want debug printout of commands
    
    # location where you want the videosrc source folder created
    # change as desired
    LOC=/path/to/wherever
    
    # create videosrc folder, and get its path in SDIR
    cd $LOC
    mkdir videosrc
    cd videosrc
    SDIR=$(pwd)
    
    # get source code management tools (if you don't have 'em)
    sudo apt-get install subversion bzr git-core
    
    # get all the latest sources
    # the following folders are created in videosrc:
    # ogg vorbis theora x264 libvpx ffmpeg mlt openshot oggvideotools
    svn co http://svn.xiph.org/trunk/ogg
    svn co http://svn.xiph.org/trunk/vorbis
    svn co http://svn.xiph.org/trunk/theora
    git clone git://git.videolan.org/x264.git
    git clone git://review.webmproject.org/libvpx.git
    svn checkout svn://svn.ffmpeg.org/ffmpeg/trunk ffmpeg
    git clone http://mltframework.org/mlt.git # melt is here
    bzr branch lp:openshot
    svn co https://oggvideotools.svn.sourceforge.net/svnroot/oggvideotools/trunk oggvideotools 
    
    # create binary output folder
    mkdir binout
    
    # remove scm tools
    sudo apt-get remove --purge subversion bzr git-core
    
    
    # libtool needed for all installs
    sudo apt-get install libtool
    
    
    # *** build ogg ***
    # *****************
    
    cd ogg
    # less README # if you want to 
    ./autogen.sh
    make
    find . | grep "libogg.\(a\|la\|so\)"
    #~ ## expected output:
    #~ ./src/.libs/libogg.a
    #~ ./src/.libs/libogg.so.0.7.1
    #~ ./src/.libs/libogg.so
    #~ ./src/.libs/libogg.lai
    #~ ./src/.libs/libogg.so.0
    #~ ./src/.libs/libogg.la
    #~ ./src/libogg.la
    #~ ## 
    # add this diretory to PKG_CONFIG_PATH
    export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:$(pwd) ; echo $PKG_CONFIG_PATH
    # check 
    pkg-config ogg --cflags --libs
    #~ ## expected output:
    #~ -I/$SDIR/ogg/include  -L/$SDIR/ogg/src/.libs -logg  
    #~ ## 
    
    # go back to $SDIR:
    cd ..
    
    
    # *** build vorbis ***
    # *****************
    
    cd vorbis
    # less README # if you want to 
    ./autogen.sh
    make 
    find . | grep "libv\(.*\)\.\(a\|la\|so\)"
    #~ ## expected output:
    #~ ./lib/libvorbisfile.la
    #~ ./lib/libvorbis.la
    #~ ./lib/libvorbisenc.la
    #~ ./lib/.libs/libvorbisenc.so.2.0.7
    #~ ./lib/.libs/libvorbis.so.0
    #~ ./lib/.libs/libvorbis.a
    #~ ./lib/.libs/libvorbisfile.so
    #~ ./lib/.libs/libvorbisfile.la
    #~ ./lib/.libs/libvorbisenc.lai
    #~ ./lib/.libs/libvorbisfile.so.3
    #~ ./lib/.libs/libvorbisfile.lai
    #~ ./lib/.libs/libvorbis.lai
    #~ ./lib/.libs/libvorbis.so.0.4.4
    #~ ./lib/.libs/libvorbis.la
    #~ ./lib/.libs/libvorbisenc.a
    #~ ./lib/.libs/libvorbis.so
    #~ ./lib/.libs/libvorbisfile.a
    #~ ./lib/.libs/libvorbisenc.la
    #~ ./lib/.libs/libvorbisfile.so.3.3.3
    #~ ./lib/.libs/libvorbisenc.so.2
    #~ ./lib/.libs/libvorbisenc.so
    #~ ## 
    # add this diretory to PKG_CONFIG_PATH
    export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:$(pwd) ; echo $PKG_CONFIG_PATH
    # check 
    pkg-config vorbis --cflags --libs
    #~ ## expected output:
    #~ -I/$SDIR/ogg/include -I/$SDIR/vorbis/include  -L/$SDIR/ogg/src/.libs -L/$SDIR/vorbis/lib/.libs -lvorbis -lm -logg    
    #~ ## 
    
    # go back to $SDIR:
    cd ..
    
    
    # *** build theora ***
    # *****************
    
    # for theora and ffplay: 
    # needed to compile example players:
    sudo apt-get install libsdl1.2-dev  # 17 extra packages
    
    cd theora
    # less README # if you want to 
    ./autogen.sh
    make
    
    # test theora
    make check # all 9 tests should pass
    ./examples/player_example /path/to/somefile.ogv # should play ok
    
    find . | grep "\(.*\)\.\(a\|so\)\([\.*[0-9]*]*\)$" 
    #~ ## expected output:
    #~ ./lib/.libs/libtheora.so.0
    #~ ./lib/.libs/libtheoraenc.so
    #~ ./lib/.libs/libtheoraenc.so.1
    #~ ./lib/.libs/libtheora.a
    #~ ./lib/.libs/libtheoraenc.so.1.1.2
    #~ ./lib/.libs/libtheoradec.so.1
    #~ ./lib/.libs/libtheoradec.a
    #~ ./lib/.libs/libtheoraenc.a
    #~ ./lib/.libs/libtheoradec.so
    #~ ./lib/.libs/libtheora.so.0.3.10
    #~ ./lib/.libs/libtheoradec.so.1.1.4
    #~ ./lib/.libs/libtheora.so
    #~ ## 
    
    # add this diretory to PKG_CONFIG_PATH
    export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:$PWD ; echo $PKG_CONFIG_PATH
    # check 
    pkg-config theora --cflags --libs
    #~ ## expected output:
    #~ -I/$SDIR/ogg/include -I/$SDIR/theora/include  -L/$SDIR/ogg/src/.libs -L/$SDIR/theora/lib/.libs -ltheora -logg   
    #~ ## 
    
    # go back to $SDIR:
    cd ..
    
    
    # *** build x264 ***
    # *****************
    
    # for x264, libvpx, ffmpeg, melt - yasm is needed
    sudo apt-get install yasm
    
    cd x264
    ./configure
    make
    ./x264 --help # should be ok
    
    # x264 does use pkg-config, but it 
    # doesn't have -uninstalled.pc - so generate it
    cat > x264-uninstalled.pc <<EOF
    prefix=
    exec_prefix=
    libdir=\${pcfiledir}/
    includedir=\${pcfiledir}/
    
    Name: x264
    Description: H.264 (MPEG4 AVC) encoder library
    Version: 0.104.1683 62997d6
    Libs: -L\${libdir} -lx264 -lpthread
    Cflags: -I\${includedir}
    EOF
    # add x264 diretory to PKG_CONFIG_PATH
    export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:$(pwd) ; echo $PKG_CONFIG_PATH
    # check 
    pkg-config x264 --cflags --libs
    
    # go back to $SDIR:
    cd ..
    
    
    # *** build libvpx ***
    # *****************
    
    cd libvpx/
    ./configure
    make
    
    # libvpx does not use pkg-config, so we must
    #  generate a .pc file for it - so ffmpeg can find it.
    # just having -uninstalled.pc should be enough 
    cat > vpx-uninstalled.pc <<EOF
    prefix=
    exec_prefix=
    libdir=\${pcfiledir}/
    includedir=\${pcfiledir}/
    
    Name: vpx
    Description: vpx is a library ... v0.9.1
    Version: 0.9.1
    Requires:
    Conflicts:
    Libs: -L\${libdir} -lvpx
    Cflags: -I\${includedir}
    EOF
    # add libvpx diretory to PKG_CONFIG_PATH
    export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:$(pwd) ; echo $PKG_CONFIG_PATH
    # check 
    pkg-config vpx --cflags --libs
    
    # go back to $SDIR:
    cd ..
    
    
    # *** build ffmpeg ***
    # *****************
    
    # we are currently still in videosrc - if not:
    cd $SDIR
    
    
    # *** FFMPEG hacks ******************
    
    # first, we must hack the 'uninstalled.pc' files for ogg/vorbis/theora
    # so that ffmpeg can link against them ; use 'sed':
    
    # ogg-uninstalled.pc
    # preview line:
    sed -n "s/\(Libs: \)\(\${libdir}\/\)\(.*\)/\1-L\2.libs -logg  # \1\2\3 #/p" ogg/ogg-uninstalled.pc
    #~ ## expected output:
    #~ Libs: -L${libdir}/.libs -logg  # Libs: ${libdir}/libogg.la #  
    #~ ## 
    # execute line:
    sed -i "s/\(Libs: \)\(\${libdir}\/\)\(.*\)/\1-L\2.libs -logg  # \1\2\3 #/" ogg/ogg-uninstalled.pc
    
    # vorbis-uninstalled.pc
    sed -n "s/\(Libs: \)\(-lm \)\(\${libdir}\/\)\(.*\)/\1-L\3.libs -lvorbis \2 # \1\2\3\4 #/p" vorbis/vorbis-uninstalled.pc
    sed -i "s/\(Libs: \)\(-lm \)\(\${libdir}\/\)\(.*\)/\1-L\3.libs -lvorbis \2 # \1\2\3\4 #/" vorbis/vorbis-uninstalled.pc
    # vorbisenc-uninstalled.pc
    sed -n "s/\(Libs: \)\(\${libdir}\/\)\(.*\)/\1-L\2.libs -lvorbisenc  # \1\2\3 #/p" vorbis/vorbisenc-uninstalled.pc
    sed -i "s/\(Libs: \)\(\${libdir}\/\)\(.*\)/\1-L\2.libs -lvorbisenc  # \1\2\3 #/" vorbis/vorbisenc-uninstalled.pc
    # vorbisfile-uninstalled.pc
    sed -n "s/\(Libs: \)\(\${libdir}\/\)\(.*\)/\1-L\2.libs -lvorbisfile  # \1\2\3 #/p" vorbis/vorbisfile-uninstalled.pc
    sed -i "s/\(Libs: \)\(\${libdir}\/\)\(.*\)/\1-L\2.libs -lvorbisfile  # \1\2\3 #/" vorbis/vorbisfile-uninstalled.pc
    # theora-uninstalled.pc
    sed -n "s/\(Libs: \)\(\${libdir}\/\)\(.*\)/\1-L\2.libs -ltheora  # \1\2\3 #/p" theora/theora-uninstalled.pc
    sed -i "s/\(Libs: \)\(\${libdir}\/\)\(.*\)/\1-L\2.libs -ltheora  # \1\2\3 #/" theora/theora-uninstalled.pc
    # theoradec-uninstalled.pc  
    sed -n "s/\(Libs: \)\(\${libdir}\/\)\(.*\)/\1-L\2.libs -ltheoradec  # \1\2\3 #/p" theora/theoradec-uninstalled.pc
    sed -i "s/\(Libs: \)\(\${libdir}\/\)\(.*\)/\1-L\2.libs -ltheoradec  # \1\2\3 #/" theora/theoradec-uninstalled.pc
    # theoraenc-uninstalled.pc
    sed -n "s/\(Libs: \)\(\${libdir}\/\)\(.*\)/\1-L\2.libs -ltheoraenc  # \1\2\3 #/p" theora/theoraenc-uninstalled.pc
    sed -i "s/\(Libs: \)\(\${libdir}\/\)\(.*\)/\1-L\2.libs -ltheoraenc  # \1\2\3 #/" theora/theoraenc-uninstalled.pc
    
    # *** FFMPEG hacks end ******************
    
    # prerequisites - we keep libraries as in HOWTO - and for all those
    #  libraries we don't build here, we get Ubuntu's -dev packages: 
    sudo apt-get install libfaac-dev libmp3lame-dev libopencore-amrnb-dev libopencore-amrwb-dev libxvidcore-dev
    
    # now we can go into ffmpeg:
    cd ffmpeg
    
    # configure: note for configure that:
    # we must supply the extra source libraries (we just built)
    #   via --extra-cflags and --extra-ldflags ;
    # we must enable libraries explicitly ;
    # we must --enable-ffplay to have ffplay be built ;
    # we must --enable-shared to have *.so objects built 
    #   (melt will need them) ; else only 
    #   static libraries (*.a) are built
    ./configure --extra-cflags="$(pkg-config theora vorbis vpx x264 --cflags)" --extra-ldflags="$(pkg-config theora vorbis vpx x264 --libs)" --enable-gpl --enable-version3 --enable-nonfree --enable-postproc --enable-pthreads --enable-libfaac --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxvid --enable-x11grab --enable-ffplay --enable-shared
    
    # make it - this takes a while 
    make 
    
    # optionally, also: 
    make alltools 
    
    # test ffmpeg - ffplay
    ./ffplay /path/to/somefile.ogv 
    #~ should give:
    #~   error while loading shared libraries 
    #~ so we'll test it after copying.. 
    
    find . -name "*.so" -or -name "*.a"
    #~ ## expected output:
    #~ ./libavdevice/libavdevice.so
    #~ ./libavdevice/libavdevice.a
    #~ ./libavcodec/libavcodec.a
    #~ ./libavcodec/libavcodec.so
    #~ ./libavformat/libavformat.a
    #~ ./libavformat/libavformat.so
    #~ ./libpostproc/libpostproc.a
    #~ ./libpostproc/libpostproc.so
    #~ ./libswscale/libswscale.so
    #~ ./libswscale/libswscale.a
    #~ ./libavcore/libavcore.so
    #~ ./libavcore/libavcore.a
    #~ ./libavfilter/libavfilter.a
    #~ ./libavfilter/libavfilter.so
    #~ ./libavutil/libavutil.a
    #~ ./libavutil/libavutil.so
    #~ ## 
    
    # we will need pkg-config for ffmpeg too (melt / mlt
    #   will need it), so may as well make it here...
    # note, though - just "ffmpeg-uninstalled.pc" doesn't help anything! :) 
    # we need: libavformat-uninstalled.pc libavdevice-uninstalled.pc 
    #   libavcodec-uninstalled.pc libavutil-uninstalled.pc 
    # (note: I copy pasted the actual version numbers from SVN here)
    cat > libavformat-uninstalled.pc <<EOF
    prefix=
    exec_prefix=
    libdir=\${pcfiledir}/
    includedir=\${pcfiledir}/
    
    Name: libavformat
    Description: libavformat library SVN-r24538
    Version: 52.77.0-SVN-r24538
    # -lavformat
    Libs: -L\${libdir}/libavformat -L\${libdir}/libavcodec -L\${includedir}/libavutil -L\${includedir}/libswscale 
    Cflags: -I\${includedir} -I\${includedir}/libavformat -I\${includedir}/libavcodec -I\${includedir}/libswscale
    EOF
    
    cat > libavdevice-uninstalled.pc <<EOF
    prefix=
    exec_prefix=
    libdir=\${pcfiledir}/
    includedir=\${pcfiledir}/
    
    Name: libavdevice
    Description: libavdevice library SVN-r24538
    Version: 52.2.0-SVN-r24538
    Libs: -L\${libdir}/libavdevice -lavdevice
    Cflags: -I\${includedir} -I\${includedir}/libavdevice
    EOF
    
    cat > libavcodec-uninstalled.pc <<EOF
    prefix=
    exec_prefix=
    libdir=\${pcfiledir}/
    includedir=\${pcfiledir}/
    
    Name: libavcodec
    Description: libavcodec library SVN-r24538
    Version: 52.84.1-SVN-r24538
    Libs: -L\${libdir}/libavcodec -lavcodec
    Cflags: -I\${includedir} -I\${includedir}/libavcodec
    EOF
    
    cat > libavutil-uninstalled.pc <<EOF
    prefix=
    exec_prefix=
    libdir=\${pcfiledir}/
    includedir=\${pcfiledir}/
    
    Name: libavutil
    Description: libavutil library SVN-r24538
    Version: 50.23.0-SVN-r24538
    Libs: -L\${libdir}/libavutil -lavutil
    Cflags: -I\${includedir} -I\${includedir}/libavutil
    EOF
    
    # add ffmpeg diretory to PKG_CONFIG_PATH
    export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:$(pwd)
    # check 
    pkg-config libavutil libavcodec libavdevice libavformat --cflags --libs
    
    # go back to $SDIR:
    cd ..
    
    
    # *** build mlt framework - melt ***
    # *****************
    
    # prerequisites for melt 
    sudo apt-get install libbz2-dev
    sudo apt-get install swig # to generate a python interface for melt - needed by openshot
    sudo apt-get install python-dev # to be abe to run --swig-languages=python
    sudo apt-get install libxml2-dev libdv-dev frei0r-plugins-dev libsox-dev 
    sudo apt-get install libsamplerate-dev libquicktime-dev jack-rackNO libjack-dev ladspa-sdk-dev #if 'enable gpl'
    
    # now we can go into mlt:
    cd mlt
    # less README # if you want to 
    # configure as shared - needs ffmpeg shared objects
    ./configure --avformat-shared=${SDIR}/ffmpeg/ --enable-gpl --swig-languages=python 
    
    make
    # if the make fails with: 
    # mlt_wrap.cxx:149:20: error: Python.h: No such file or directory mlt_wrap.cxx:2748:4: error: #error "This python version requires swig to be run with the '-classic' option"
    # then correct (by uncommenting / running 
    #   the below two sed lines:
    #~ sed -n "s/\(swig -c++ \)\(.*\)/\1-classic \2/p" src/swig/python/build
    #~ sed -i "s/\(swig -c++ \)\(.*\)/\1-classic \2/" src/swig/python/build
    
    # go back to $SDIR:
    cd ..
    
    
    
    # *** build openshot ***
    # *****************
    
    # we already checked out openshot; which 
    # is in python (and doesn't need building) 
    # will handle it in 'populate binary folder' below
    
    
    # *** build oggvideotools ***
    # *****************
    # we will skip build of oggvideotools, 
    # until we have built the binout folder
    # (in order to make linking easier) 
    
    
    
    # *** populate binary folder (binout) ***
    # *****************
    
    # if not already there:
    cd $SDIR
    
    # copy all shared and static library object files to binout:
    # -a -> preserve symlinks 
    for ix in $(find . -name '*.so*' -or -name '*.a'); do echo $ix; cp -av $ix binout/; done
    
    # copy almost all executables
    for ix in $(find {mlt/src/melt,theora/tests,theora/examples,ogg/src,vorbis/examples,x264,ffmpeg,ffmpeg/tools} -maxdepth 1 -and -executable -and -type f -and \( ! -path '*\.svn*' \) -and \( ! -name '*config*' \) -and \( ! -name '*version*' \) ); do echo $ix; cp -av $ix binout/; done
    
    # this player_example for theora is a script - rename it...
    mv binout/player_example binout/player_example.sh
    # ... as there is also an executable with same name:
    cp -v theora/examples/.libs/* binout
    
    
    # create vidport bash script
    cat > binout/vidport.sh <<EOF
    rl=\$(readlink -e \$0) #-e for symlinks in /usr/bin
    abspath="\$(cd "\${rl%/*}" 2>/dev/null; echo "\$PWD"/"\${0##*/}")"
    RUNDIR="\${abspath%/*}"
    echo \$RUNDIR/\$*
    # eval LD_LIBRARY_PATH=\$RUNDIR "\$RUNDIR/\$*"
    export LD_LIBRARY_PATH=\$RUNDIR 
    # melt needs these:
    export MLT_PROFILES_PATH=\$RUNDIR/profiles
    export MLT_REPOSITORY=\$RUNDIR 
    export MLT_DATA=\$RUNDIR 
    eval "\$RUNDIR/\$*"
    EOF
    chmod +x binout/vidport.sh
    sudo ln -s $SDIR/vidport.sh /usr/bin/vidport
    # now can do something like:
    #  $ vidport ffplay 
    # in bash - and the ffplay in binout will be called...
    
    # create vidport2 bash script
    cat > binout/vidport2.sh <<EOF
    rl=\$(readlink -e \$0)
    abspath="\$(cd "\${rl%/*}" 2>/dev/null; echo "\$PWD"/"\${0##*/}")"
    RUNDIR="\${abspath%/*}"
    echo \$RUNDIR/\$*
    # eval LD_LIBRARY_PATH=\$RUNDIR "\$RUNDIR/\$*"
    export LD_LIBRARY_PATH=\$RUNDIR 
    # melt needs these:
    export MLT_PROFILES_PATH=\$RUNDIR/profiles
    export MLT_REPOSITORY=\$RUNDIR 
    export MLT_DATA=\$RUNDIR 
    export PATH=\$PATH:\$RUNDIR
    eval "\$*"
    EOF
    chmod +x binout/vidport2.sh
    sudo ln -s $SDIR/vidport2.sh /usr/bin/vidport2
    # now can do something like:
    #  $ vidport2 kdenlive 
    # in bash - and the kdenlive you have installed
    #  will be called in binout environment - using the latest
    #  melt / ffmpeg / theora for work with ogv files...
    # or you can simply source vidport2.sh:
    #  $ cd binout && . vidport2.sh
    # if you want to work in terminal 
    
    # copy necessities for mlt/melt
    mkdir binout/core
    cp -v mlt/src/modules/core/loader.* binout/core # loader.dict, loader.ini
    cp -v mlt/src/modules/core/data_fx.properties binout/core
    cp -av $SDIR/mlt/profiles binout/
    
    # create melt.sh bash script
    cat > binout/melt.sh <<EOF
    #!/usr/bin/env bash
    rl=\$(readlink -e \$0) #-e for symlinks in /usr/bin
    abspath="\$(cd "\${rl%/*}" 2>/dev/null; echo "\$PWD"/"\${0##*/}")"
    RUNDIR="\${abspath%/*}"
    # echo \$RUNDIR/\$*
    export LD_LIBRARY_PATH=\$RUNDIR 
    # melt needs these:
    export MLT_PROFILES_PATH=\$RUNDIR/profiles
    export MLT_REPOSITORY=\$RUNDIR 
    export MLT_DATA=\$RUNDIR 
    \$RUNDIR/melt \$*
    EOF
    chmod +x binout/melt.sh
    # symlink as 'melts' to avoid possible naming conflicts
    # will need to enter it as executable link for openshot
    sudo ln -s /media/linext3/videosrc/binout/melt.sh /usr/bin/melts
    
    # copy openshot directory (python source files)
    cp -av openshot/openshot binout/
    
    # copy python interface for mlt framework (python-mlt2)
    # i.e. http://dk.archive.ubuntu.com/ubuntu/pool/universe/m/mlt/python-mlt2_0.5.4-1_i386.deb
    cp -v mlt/src/swig/python/{_mlt.so,mlt.py} binout/openshot
    
    # HACK for openshot:
    # the new interface to mlt may not be understood by openshot;
    # (i.e. now we have 'Factory_init' instead of old 'Factory.init')
    # thus the below is to correct it (only in the folder copied to binout):
    COLLECT="$(grep -r 'Factory\.init' binout/openshot | cut -d':' -f1)"
    CSORT=$(echo "$COLLECT" | sort -u)
    for ix in $CSORT;  do echo $ix; sed -n "s/Factory\.init()/Factory_init() ## Factory.init()/gp" $ix; sed -i "s/Factory\.init()/Factory_init() ## Factory.init()/g" $ix; done
    
    # create openshot.sh bash script
    cat > binout/openshot.sh <<EOF
    rl=\$(readlink -e \$0) #-e for symlinks in /usr/bin
    abspath="\$(cd "\${rl%/*}" 2>/dev/null; echo "\$PWD"/"\${0##*/}")"
    RUNDIR="\${abspath%/*}"
    echo python \$RUNDIR/openshot/openshot.py \$*
    
    python \$RUNDIR/openshot/openshot.py \$*
    EOF
    chmod +x binout/openshot.sh
    
    # NOTE: if something goes wrong with 
    # openshot settings, use:
    #~ rm -rf ~/.openshot/ 
    # to delete your user profile and start anew.. 
    
    # for independence - copy *.so files from Ubuntu -dev packages we installed
    cp -av /usr/lib/libxvidcore* binout
    cp -av /usr/lib/libopencore-amr* binout
    cp -av /usr/lib/libmp3lame.* binout
    cp -av /usr/lib/libfaac.* binout
    
    
    # *** build oggvideotools ***
    # *****************
    # we do it now, after binout folder is created
    # (on order to make linking easier) 
    
    # if not already there:
    cd $SDIR
    
    # prerequisites for oggvideotools
    sudo apt-get install cmake
    sudo apt-get install libgd2-xpm-dev # install libgd-dev says to choose, and I have already -xpm installed
    
    # now we can go into oggvideotools:
    cd oggvideotools/
    
    # autogen/cmake for oggvideotools will be able to find 
    # cflags (include directories) from pkg-config, 
    # but not link directories 
    # to fix that, we add 'binout' as a LINK_DIRECTORIES
    # (since 'binout' already has all *.so files needed) 
    # in oggvideotools/CMakeLists.txt:
    # also, use different sed delimiter (~) here, 
    # since we will use path character (/) in a variable: 
    sed -n "s~\(SET ( PACKAGE_BUGREPORT\)\(.*\)~\1\2\n\nLINK_DIRECTORIES ( $(readlink -f ../binout) )~p" CMakeLists.txt 
    sed -i "s~\(SET ( PACKAGE_BUGREPORT\)\(.*\)~\1\2\n\nLINK_DIRECTORIES ( $(readlink -f ../binout) )~" CMakeLists.txt 
    
    # call autogen - that one simply calls cmake 
    #   which calls make...
    ./autogen.sh 
    
    # after build, copy the files we got to binout 
    cp -v build/src/{ogg*,liboggvideotools.so} $SDIR/binout/ 
    
    # go back to $SDIR:
    cd ..
    
    
    # cleanup packages / restore original state
    
    sudo apt-get remove --purge subversion bzr git-core
    sudo apt-get -y --force-yes remove --purge libtool
    sudo apt-get -y --force-yes remove --purge libsdl1.2-dev  # 17 extra packages
    sudo apt-get -y --force-yes remove --purge yasm
    sudo apt-get -y --force-yes remove --purge libfaac-dev libmp3lame-dev libopencore-amrnb-dev libopencore-amrwb-dev libxvidcore-dev
    sudo apt-get -y --force-yes remove --purge libbz2-dev
    sudo apt-get -y --force-yes remove --purge swig 
    sudo apt-get -y --force-yes remove --purge python-dev
    sudo apt-get -y --force-yes remove --purge libxml2-dev libdv-dev frei0r-plugins-dev libsox-dev 
    sudo apt-get -y --force-yes remove --purge libsamplerate-dev libquicktime-dev jack-rackNO libjack-dev ladspa-sdk-dev
    sudo apt-get -y --force-yes remove --purge cmake
    sudo apt-get -y --force-yes remove --purge libgd2-xpm-dev
    
    sudo apt-get -y --force-yes autoremove --purge
    
    # done
    Now you should be able to do something like this, from a command-line terminal:
    Code:
    # if the script/executable is in binout folder, use vidport:
    $ vidport openshot.sh
    
    # ... or ...
    
    # if the script/executable is installed elsewhere, use vidport2:
    $ vidport2 kdenlive
    ... and have the latest Openshot/Kdenlive start, calling on the latest mlt/ffmpeg/theora versions - which means that:

    • preview while work with ogv videos will work in these video editors (although slow and still buggy at times), and
    • export to ogv should reference the latest libraries as well.

  3. #3
    Join Date
    May 2006
    Location
    Ontario, Canada
    Beans
    2
    Distro
    Ubuntu Breezy 5.10

    Re: 10.04: Openshot (mlt+ffmpeg) for Theora ogv - 'portable' build from latest source

    It is my understanding that Theora upgraded to 1.1 from 0.2 and recordmydesktop, cheese and other programs that use Theora will not work. I am a newbie so what do I know. My hope is that someone will take over the upkeep of recordmydesktop. Please

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •