Coder Social home page Coder Social logo

Comments (16)

Sibras avatar Sibras commented on July 17, 2024

The default project requires many additional projects to be available (zlib, sdl etc.) as it is configured using multiple dependencies. To use the project in its default state you will need to also download all the dependency projects as stated in the readme.txt.
If you dont want a ffmpeg build with all of the default dependencies enabled then you can use the project generator to create a new Visual Studio project with different options (again read the readme.txt).
If your still having issues with projects failing to load then post the error message here.

from ffmpeg.

david-sackstein avatar david-sackstein commented on July 17, 2024

Hi Oliver,
Thanks. I see I am not the only one who didn't notice the readme.txt. Is there some way you can provide a link to it directly from the home page of ffmpeg?
Indeed that solved some of my problems. I was able to install yasm which allowed all projects to load.
But I am still having difficulty getting all the dependencies in place.
What I actually need is only the functionality of H.264 decoding so I would like to disable EVERYTHING not needed for that.
I ran the project generator with no "--enable" options and noticed that I still need to provide libcdio.
(Is that the right thing to do - or do I need to write explicit "--disable"s?
OK, I can go and search for that manually on your page - and you have done a great job bringing all those projects into Visual Studio, but it doesn't seem to end there. There are still other dependencies I need. Sometimes I cant find a match between the header that is missing and the name of the git project on your page.
I am just going to have manually copy the git clone commands for EVERY one of your projects build them ALL and then try to run the ffmpeg.sln for the minimum "generate" as described above.
Then I will go and get all the external dependencies you point to (hope I can find them).
Hopefully then, I will be able to build.
You have done a great job enabling all these projects to build in VS2013 - but still this is SO tedious.
Can you recommend the simplest way for me to just get that minimum set of FFMPEG libraries building in VS2013 - or is this really what needs to be done ?
Thanks
David

from ffmpeg.

cxsup avatar cxsup commented on July 17, 2024

With all the SMP repos downloaded, you should be able to build the FFmpeg 2013 sln. You'll also need to grab SDL separately from SMP. If it's necessary to regenerate the FFmpeg projects, make sure the related SMP projects are first built using the correct platform (e.g., msvc64.) Then from the VS Command Prompt (x64 Native), append the c:\...\msvc64\include path to the INCLUDE environment variable. Finally, from the same command prompt, it should be possible to execute project_generate_msvc.bat.

I build the SMP projects using MSYS2 with the vcvars first setup using the following shortcut:

%comspec% /k ""C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat"" amd64 & C:\msys64\msys2_shell.bat

If using MSYS2, be sure to rename/hide the link.exe binary included with the MSYS64 since it can get in the way of the MS linker.

from ffmpeg.

cxsup avatar cxsup commented on July 17, 2024

Here's a modified bash script that's wired to download the SMP projects and do a few other things. I run it from MSYS2 with git support:

#!/bin/bash

TEMP=`getopt -o ufi:rc: --long config:,ignore,update,clean,rebuild,show,filter:,reset -- "$@"`

optstatus=$?

# Note the quotes around `$TEMP': they are essential!
eval set -- "$TEMP"

basedir=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
bname=$(basename ${BASH_SOURCE[0]})

help() {
  cat << EOF
  $bname
    -u, --update          update source
    -r, --reset           hard source update -- requires update option
    -i, --ignore          ignore errors -- continue building on error
        --clean           clean project(s)
        --rebuild         rebuild project(s)
        --show            show project(s)
    -f, --filter=PROJECT  project filter to work on
    -c, --config=CONFIG   required build configuration: Debug, ReleaseDLL, ReleaseDLLStaticDeps
EOF
  exit 1
}

if [ $optstatus != 0 ] 
then
  help 
  exit 1
fi

filter=
update=0
hardreset=0
config=
clean=
ignore=0
show=0

while true; do
  case "$1" in
    -u | --update ) update=1; shift ;;
    -r | --reset ) hardreset=1; shift ;;
    -i | --ignore ) ignore=1; shift ;;
    -i | --show ) show=1; shift ;;
    -f | --filter ) filter=$2; shift 2;;
    -c | --config ) config=$2; shift 2;;
         --clean ) clean=/target:Clean; shift ;;
         --rebuild ) clean=/target:Rebuild; shift ;;
    -- ) shift; break ;;
    * ) break ;;
  esac
done

if [ 1 -eq 0 ] 
then
  echo filter=$filter
  echo update=$update
  echo reset=$hardreset
  echo config=$config
  echo ignore=$ignore
fi

if [[ !  ",DebugDLL,Debug,DebugDLLStaticDeps,ReleaseDLL,Release,ReleaseDLLStaticDeps," =~ ",$config," ]]  && [ $update -eq 0 ]
then
  echo Invalid config: $config
  echo
  help
fi


SHIFTMEDIA=git://github.com/ShiftMediaProject

libiconv=libiconv
libs=( 
  zlib=libz
  libiconv=
  libcdio=
  libcdio-paranoia=
  modplug=libmodplug
  libgpg-error=
  libgcrypt=
  libssh=
  liblzma=
  libxml2=
  freetype2=libfreetype2
  fontconfig=libfontconfig
  libbluray=
  gmp=libgmp
  nettle=nettle
  gnutls=libgnutls
  bzip2=libbz2
  rtmpdump=librtmp
  game-music-emu=libgme
  soxr=libsoxr
  enca=libenca
  fribidi=libfribidi
  harfbuzz=libharfbuzz
  libass=
  fdk-aac=libfdk-aac
  lame=libmp3lame
  libilbc=
  x264=
  x265=
  opus=libopus
  speex=libspeex
  ogg=libogg
  theora=libtheora
  libvpx=
  vorbis=libvorbis
  xvid=libxvidcore
  ffmpeg=,0,0
)



clone_or_update() {

  ar=(${1//\=/ })
  module=${ar[0]}

  shopt -s nocasematch
  if [ ! -z $filter ] && [[ ! $module =~ $filter ]]
  then
    #echo skipping $module
    shopt -u nocasematch
    return 0
  fi
  shopt -u nocasematch

  cd $basedir > /dev/null

  url=$SHIFTMEDIA/$module
  if [ -d $module ]; then
    echo Updating $module...
    pushd $module > /dev/null
    if [ $hardreset -eq 1 ]
    then
      git clean -xfd
      git fetch
      git reset --hard origin/master
    else
      git stash
      git pull origin master
      git stash pop
    fi
    popd > /dev/null
  else
    echo Cloning $module...
    git clone $url $module
    pushd $module > /dev/null
    git config --local core.autocrlf false
    git rm --cached -r .
    git reset --hard
    popd > /dev/null
  fi
}

show() {

  ar=(${1//,/ })

  slib=${ar[1]:-1}
  build=${ar[2]:-1}

  ar=${ar[0]}
  ar=(${ar//\=/ })
  module=${ar[0]}

  shopt -s nocasematch
  [ ! -z $filter ] && [[ ! $module =~ $filter ]] && return 0
  shopt -u nocasematch

  #echo ${ar[@]} ${ar[1]}

  if [ $slib -eq 0 ]; then cfg=$config; else cfg=${config%DLLStaticDeps}; fi

  if [ -z ${ar[1]} ]; then url=$module; else url=${ar[1]}; fi

  echo $module: $url, cfg: $cfg, build: $build
}

build() {

  ar=(${1//,/ })

  slib=${ar[1]:-1}
  build=${ar[2]:-1}
  [ $build -eq 0 ] && return 0

  ar=${ar[0]}

  ar=(${ar//\=/ })
  module=${ar[0]}
  if [ -z ${ar[1]} ]; then sln=$module; else sln=${ar[1]}; fi

  shopt -s nocasematch
  [ ! -z $filter ] && [[ ! $module =~ $filter ]] && return 0
  shopt -u nocasematch

#echo ${ar[@]} ${ar[1]}


  cd $basedir > /dev/null
  smp=$module/SMP
  if [ ! -d $smp ]
  then
    echo invalid project $smp
    return 1
  fi

  if [ $slib -eq 0 ]; then cfg=$config; else cfg=${config%DLLStaticDeps}; fi

  pushd $smp  > /dev/null
  if [ -f $sln.sln ] 
  then
    msbuild.exe "$sln.sln"  /maxcpucount:4 $clean /property:Configuration=$cfg /property:Platform=x64 && err=0
    typeset e=$?
  else
    echo -n missing $sln  ---- 
    dir *.sln
    typeset e=1
  fi
  popd  > /dev/null
  return $e
}


#clone_or_update libiconv
if [ $update -eq 1 ]
then
  for lib in ${libs[@]}
  do 
    clone_or_update $lib
  done
fi

results=()

# build
if [ ! -z $config ]
then
  for lib in ${libs[@]}
  do 
    if [ $show -eq 1 ]
    then
      show $lib
    else
      build $lib
    fi
    typeset e=$?
    if [ $e -ne 0 ]
    then
      results+=("build returned $e for $lib")
      if [ $ignore -eq 0 ]
      then
        break
      fi
    fi
  done
fi


echo ${results[@]}


from ffmpeg.

cxsup avatar cxsup commented on July 17, 2024

Also, a few pre-build projects require a correction to the Intermediate Directory in order to avoid compilation collisions. The desdata and eccdata projects in the nettle sln are examples of this. The corrected path should look like:

$(ProjectDir)\obj\$(Configuration)\$(Platform)\$(ProjectName)\

Another issue I noticed involves installation of the includes and licenses upon completion of linking the FFmpeg projects. I noticed post-build scripts weren't running due to the unresolved external symbol work-around which results in the link step returning in error despite /FORCE:UNRESOLVED. So to get around this issue, for each project in the FFmpeg sln, I moved the installation scripts to the Pre-Link phase. The project generator code and templates can be modified to support this if it's more convenient.

from ffmpeg.

david-sackstein avatar david-sackstein commented on July 17, 2024

Thanks. I am moving forward building all the SMP projects.
When I build harfbuzz, VS2013 crashes.
(I have downloaded Ragel and put it in C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin)
Do you know how I can fix this?

from ffmpeg.

cxsup avatar cxsup commented on July 17, 2024

Don't recall setting up Ragel, but I'm building through a MSYS2 shell which has a variety of dev tools.

You may not need harfbuzz depending on how you configure FFmpeg. If you're using the above script, you can disable building it by setting the build flag to zero:

harfbuzz=libharfbuzz,0,0

FWIW, I disabled a number of the SMP packages when regenerating the FFmpeg project.

from ffmpeg.

david-sackstein avatar david-sackstein commented on July 17, 2024

I am using VS2013 and ffmpeg needs libavfilter which needs libass.lib (great name by the way) which needs harfbuzz ...

from ffmpeg.

david-sackstein avatar david-sackstein commented on July 17, 2024

OK. Solved that. You can configure libass.lib to not require harfbuzz by commenting out the line #define CONFIG_HARFBUZZ 1 in libass\SMP\config.h.
It is not enough to change the define to 0 because the code in libass checks #ifdef CONFIG_HARFBUZZ which it will be regardless of its value.

from ffmpeg.

Sibras avatar Sibras commented on July 17, 2024

OK Ill try and address every issue raised so far.

  1. The project_generator uses the same configure options as the default FFmpeg configure script. There are many options that are constantly changing so the project refers to the upstream FFmpeg project for the available configure options. However if you wish to build without any dependencies then the correct command line is provided in project_generators readme.txt:
    "ffmpeg_generator.exe --enable-gpl --enable-version3 --disable-bzlib --disable-iconv --disable-zlib --disable-lzma --disable-sdl --toolchain=msvc"

  2. The output directory of the pre-build projects has been corrected in the repo so you shouldnt have to change it any more. However you should note that none of the pre-build projects are actually required. These projects just re-generate already generated files in case you manually change something in the source code. If you wish to use the source code as is then you do not need to regenerate anything (the same goes for things like needing Ragel) as generated files are already provided in the repo.

  3. Not sure why VS will crash compiling harfbuzz as I havnt seen any errors like that before. If you have some error output I may be able to debug the problem. Of course if you go the above route of disabling dependencies then it does not matter.

  4. I do plan on putting the readme.txt contents as the visible description on the github page and providing a script to download all the dependencies but havnt as yet had time. It is however on the todo list.

from ffmpeg.

david-sackstein avatar david-sackstein commented on July 17, 2024

Hi Mathew,
That's great. Indeed I hadn't read the readme on the project_generator project itself (even after reading the readme on the ffmpeg project). This does emphasize again the need to put it up on the front page :)
But indeed, using the options you specify there for a no-dependency build I was able to create the projects and build ffmpeg with no issues. (except for the unresolved external symbols errors which you explained can be ignored).
However, these options create static libraries. I tried to add "--enable-shared" in order to created DLLs projects, but this did not set the "Configuration Type" on the ffmpeg projects' property pages to "DLL". None of the dlls were created.
When I change the setting on the projects myself, the result was many unresolved symbols that could not be ignored and still none of the dlls were created.
How can I create dlls for the FFMPEG libraries?

from ffmpeg.

Sibras avatar Sibras commented on July 17, 2024

You dont need to use things like --enable-shared" as the projects are generated to support building both shared/static.
So dont change the settings on the projects as there is already a configuration supplied. Just change the configuration to "ReleaseDLL" for shared or "Release" for static (or the Debug variants if you want slower debug builds). The release variants dont have any of the linker errors that debug versions do so they are recommended unless absolutely needed.

from ffmpeg.

david-sackstein avatar david-sackstein commented on July 17, 2024

Got it!
I have what I need now.
This is a fantastic project and I thank you very much for spending the effort to make it available.
For many years I have wanted to run (and debug) ffmpeg in Visual Studio and now you have made it possible. Thank you.
Another question: If I need to debug an earlier version of ffmpeg, do you think I can check out that version from github, copy over ffmpeg/SMP into that branch, build and run the generator and build the ffmpeg tree as I can with your snapshot of ffmpeg? If not, what problems would you expect?

from ffmpeg.

Sibras avatar Sibras commented on July 17, 2024

The project generator should be able to run on older versions of ffmpeg source. However it does make some assumptions about the layout of configure and Makefile's. So It may not work if you go back to far in FFmpegs history (anything from the last couple of years should be fine).
I was thinking of making the project generator a standalone repo to help facilitate just this use case.

from ffmpeg.

david-sackstein avatar david-sackstein commented on July 17, 2024

I tried generating VS2013 projects for version v2.8 of ffmpeg:
I cloned ffmpeg and then checked out release 2.8:
git checkout origin/release/2.8
Then I copied the SMP folder from ShiftMediaProject to the same location in the FFMPEG project.

I ran the project generator with minimum dependencies:
--enable-gpl --enable-version3 --disable-bzlib --disable-iconv --disable-zlib --disable-lzma --disable-sdl --toolchain=msvc

There was an access violation in projectGenerator::buildInterDependenciesHelper when called by:
buildInterDependenciesHelper( { "scale2ref_filter" }, { "swscale" }, vLibs );
on line 92 of projectGenerator_build.cpp.

I resolved it by adding a check for the end() iterator being returned from m_ConfigHelper.getConfigOption(*itI).
This resolved the access violation and the resulting projects worked for me, but I don't know if there is a more correct solution you might want to implement.

The new code at line 28 is now:

    auto vector_iterator = m_ConfigHelper.getConfigOption(*itI);
    bFound = 
            vector_iterator != m_ConfigHelper.m_vConfigValues.end() && 
            vector_iterator->m_sValue.compare("1") == 0;
        if( !bFound )
        {
            break;
        }

from ffmpeg.

Sibras avatar Sibras commented on July 17, 2024

Thanks for the feedback. This has been fixed in the repo.

from ffmpeg.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.