Page 110 of 231 FirstFirst ... 1060100108109110111112120160210 ... LastLast
Results 1,091 to 1,100 of 2306

Thread: HOWTO: Install and use the latest FFmpeg and x264

  1. #1091
    Join Date
    May 2007
    Beans
    141
    Distro
    Ubuntu

    Re: HOWTO: Install and use the latest FFmpeg and x264

    Quote Originally Posted by anafshalom View Post
    Is there a way to do a batch of files with one input command?

    Reuven
    Are you any good at bash? Since that is the easiest way to do it.

    This is how I do it. Create two files, once called trans.sh and one called ffmpeg.sh.

    In trans.sh put the following:

    Code:
    #!/bin/bash
    echo trans started on `date "+%m/%d/%y %l:%M:%S %p"` > ~/trans.log
    
    find /path/to/your/videos -name "*.$1" -exec ~/ffmpeg.sh "{}" \; 
    
    echo ffmpeg stopped on `date "+%m/%d/%y %l:%M:%S %p"` >> ~/trans.log
    Then in ffmpeg.sh put the following:

    Code:
    #!/bin/bash
    #CUSTOMISE THE FOLLOWING
    #change the ffmpeg command here to whatever you want, keeping "$1" as your input and output file names
    #FYI this command seems to produce fairly decent files from .mpg transport streams recorded from MythTV
    trans() {
    ffmpeg -deinterlace -y -i "$1" -vcodec libx264 -level 41 -vpre normal -crf 24 -threads 0 -sn -acodec libfaac -ab 128k -ac 2 -ar 48000 -vsync 1 -async 1000 -map 0.0:0.0 -map 0.1:0.1 "$1".mkv
    }
    
    echo conversion of "$1" started on `date "+%m/%d/%y %l:%M:%S %p"` > ~/trans.log
    #call the conversion and fork it
    trans "$1" &>> ~/ffmpeg.log &
    #get the PID of the conversion
    pid=$!
    echo "ffmpeg PID = $pid" >> ~/trans.log
    echo "ffmpeg PID = $pid"
    #this is a simple progress indicator
    while ps |grep $pid &>/dev/null; do
    	echo -n "."
    	echo -en "\b-"
    	sleep 1
    	echo -en "\b\\"
    	sleep 1
    	echo -en "\b|"
    	sleep 1
    	echo -en "\b/"
    	sleep 1
    done
    
    echo ffmpeg stopped on `date "+%m/%d/%y %l:%M:%S %p"` >> ~/trans.log
    
    exit
    Save both these files in your home folder and make them executable. You can do this from the command line:

    Code:
    chmod a+x ffmpeg.sh trans.sh
    Edit trans.sh where is says "/path/to/your/videos" and put in the path to your folder full of video files. Edit ffmpeg.sh to use the ffmpeg command you want to use, make sure that you keep "trans() {" before the comand and "}" after it as in my example. Also, make sure you keep "$1" as your input filename and "$1".mkv as your output filename, but change the extension if you want.

    Then, finally, to convert the files. Put all the files you want to convert in a folder. Then, to run all this, open a Terminal window and type:

    Code:
    ./trans.sh MPG
    Replace MPG with the file extension of the video files you are converting. It should then go off and do it's thing, with a little progress bar that shows you something is happening (it doesn't give an ETA of the file conversion, since that is such a b!tch to get right).

    This is probobly all far too complicated there are easy ways of doing it. Such as:

    Code:
    find /path/to/your/videos -name "*.MPG" -exec ~/ffmpeg -deinterlace -y -i "{}" -vcodec libx264 -level 41 -vpre normal -crf 24 -threads 0 -sn -acodec libfaac -ab 128k -ac 2 -ar 48000 -vsync 1 -async 1000 -map 0.0:0.0 -map 0.1:0.1 "{}".mkv \;
    Typing all that into one line of a command line will search for all .MPG files in /path/to/your/videos and convert them using the FFmpeg command as written.

  2. #1092
    Join Date
    Oct 2006
    Beans
    45

    Re: HOWTO: Install and use the latest FFmpeg and x264

    Quote Originally Posted by prupert View Post
    Are you any good at bash? Since that is the easiest way to do it.

    This is how I do it. Create two files, once called trans.sh and one called ffmpeg.sh.

    In trans.sh put the following:

    Code:
    #!/bin/bash
    echo trans started on `date "+%m/%d/%y %l:%M:%S %p"` > ~/trans.log
    
    find /path/to/your/videos -name "*.$1" -exec ~/ffmpeg.sh "{}" \; 
    
    echo ffmpeg stopped on `date "+%m/%d/%y %l:%M:%S %p"` >> ~/trans.log
    Then in ffmpeg.sh put the following:

    Code:
    #!/bin/bash
    #CUSTOMISE THE FOLLOWING
    #change the ffmpeg command here to whatever you want, keeping "$1" as your input and output file names
    #FYI this command seems to produce fairly decent files from .mpg transport streams recorded from MythTV
    trans() {
    ffmpeg -deinterlace -y -i "$1" -vcodec libx264 -level 41 -vpre normal -crf 24 -threads 0 -sn -acodec libfaac -ab 128k -ac 2 -ar 48000 -vsync 1 -async 1000 -map 0.0:0.0 -map 0.1:0.1 "$1".mkv
    }
    
    echo conversion of "$1" started on `date "+%m/%d/%y %l:%M:%S %p"` > ~/trans.log
    #call the conversion and fork it
    trans "$1" &>> ~/ffmpeg.log &
    #get the PID of the conversion
    pid=$!
    echo "ffmpeg PID = $pid" >> ~/trans.log
    echo "ffmpeg PID = $pid"
    #this is a simple progress indicator
    while ps |grep $pid &>/dev/null; do
    	echo -n "."
    	echo -en "\b-"
    	sleep 1
    	echo -en "\b\\"
    	sleep 1
    	echo -en "\b|"
    	sleep 1
    	echo -en "\b/"
    	sleep 1
    done
    
    echo ffmpeg stopped on `date "+%m/%d/%y %l:%M:%S %p"` >> ~/trans.log
    
    exit
    Save both these files in your home folder and make them executable. You can do this from the command line:

    Code:
    chmod a+x ffmpeg.sh trans.sh
    Edit trans.sh where is says "/path/to/your/videos" and put in the path to your folder full of video files. Edit ffmpeg.sh to use the ffmpeg command you want to use, make sure that you keep "trans() {" before the comand and "}" after it as in my example. Also, make sure you keep "$1" as your input filename and "$1".mkv as your output filename, but change the extension if you want.

    Then, finally, to convert the files. Put all the files you want to convert in a folder. Then, to run all this, open a Terminal window and type:

    Code:
    ./trans.sh MPG
    Replace MPG with the file extension of the video files you are converting. It should then go off and do it's thing, with a little progress bar that shows you something is happening (it doesn't give an ETA of the file conversion, since that is such a b!tch to get right).

    This is probobly all far too complicated there are easy ways of doing it. Such as:

    Code:
    find /path/to/your/videos -name "*.MPG" -exec ~/ffmpeg -deinterlace -y -i "{}" -vcodec libx264 -level 41 -vpre normal -crf 24 -threads 0 -sn -acodec libfaac -ab 128k -ac 2 -ar 48000 -vsync 1 -async 1000 -map 0.0:0.0 -map 0.1:0.1 "{}".mkv \;
    Typing all that into one line of a command line will search for all .MPG files in /path/to/your/videos and convert them using the FFmpeg command as written.
    I've never used bash, but I'll give it a try when I have a chance.

    Thanks

  3. #1093
    Join Date
    Sep 2006
    Beans
    3,490

    Re: HOWTO: Compile the latest ffmpeg and x264 from source

    Quote Originally Posted by Locke_99GS View Post
    Code:
    gcc -o x264 x264.o input/timecode.o input/yuv.o input/y4m.o output/raw.o output/matroska.o output/matroska_ebml.o output/flv.o output/flv_bytestream.o input/thread.o libx264.a -lm -lpthread -s 
    /usr/bin/ld.bfd.real: libx264.a(cabac-a.o): relocation R_X86_64_32 against `x264_cabac_range_lps' can not be used when making a shared object; recompile with -fPIC
    libx264.a: could not read symbols: Bad value
    collect2: ld returned 1 exit status
    make: *** [x264] Error 1
    Hmmm. I wonder what I did that caused x264 to fail all of a sudden. Has been failing for me for a few revisions.
    I just compiled x264 on x86_64 Ubuntu Lucid with no problems. Did you follow the guide word-for-word, or did you customize it at all? Did you forget to make distclean as shown in the Updating FFmpeg and x264 section of this guide? What version of Ubuntu are you using?

  4. #1094
    Join Date
    May 2010
    Beans
    3

    Re: HOWTO: Install and use the latest FFmpeg and x264

    Code:
    [ 74%] Building CXX object src/highgui/CMakeFiles/highgui.dir/grfmt_imageio.o
    Linking CXX shared library ../../lib/libhighgui.so
    /usr/bin/ld: /usr/local/lib/libavcodec.a(avpacket.o): relocation R_X86_64_32S against `av_destruct_packet_nofree' can not be used when making a shared object; recompile with -fPIC
    /usr/local/lib/libavcodec.a: could not read symbols: Bad value
    collect2: ld returned 1 exit status
    make[2]: ** [lib/libhighgui.so.2.1.0] Erro 1
    make[1]: ** [src/highgui/CMakeFiles/highgui.dir/all] Erro 2
    make: ** [all] Erro 2

  5. #1095
    Join Date
    Sep 2006
    Beans
    3,490

    Re: HOWTO: Install and use the latest FFmpeg and x264

    Quote Originally Posted by EkoBR View Post
    Code:
    [ 74%] Building CXX object src/highgui/CMakeFiles/highgui.dir/grfmt_imageio.o
    Linking CXX shared library ../../lib/libhighgui.so
    /usr/bin/ld: /usr/local/lib/libavcodec.a(avpacket.o): relocation R_X86_64_32S against `av_destruct_packet_nofree' can not be used when making a shared object; recompile with -fPIC
    /usr/local/lib/libavcodec.a: could not read symbols: Bad value
    collect2: ld returned 1 exit status
    make[2]: ** [lib/libhighgui.so.2.1.0] Erro 1
    make[1]: ** [src/highgui/CMakeFiles/highgui.dir/all] Erro 2
    make: ** [all] Erro 2
    I can not duplicate this on Lucid. What step of the installation process did this error occur? Did you follow the guide word-for-word, or did you customize it at all? What version of Ubuntu are you using?

    Update: Lots of guess work here and little information to work from. Is this an OpenCV error? I know nothing of OpenCV. Please create a new thread if this is for OpenCV as it is outside of the scope of this guide.
    Last edited by FakeOutdoorsman; June 29th, 2010 at 01:59 AM.

  6. #1096
    Join Date
    May 2010
    Beans
    3

    Re: HOWTO: Install and use the latest FFmpeg and x264

    Quote Originally Posted by FakeOutdoorsman View Post
    I can not duplicate this on Lucid. What step of the installation process did this error occur? Did you follow the guide word-for-word, or did you customize it at all? What version of Ubuntu are you using?

    Update: Lots of guess work here and little information to work from. Is this an OpenCV error? I know nothing of OpenCV. Please create a new thread if this is for OpenCV as it is outside of the scope of this guide.
    Ubuntu 10.04
    But yes, is an OpenCV compilation error.

    I will search a correct thread, Thanks.

    Update: Now I try compile ffmpeg with --enable-shared and...
    Code:
    LD    libavcodec/libavcodec.so.52
    /usr/bin/ld: /usr/local/lib/libvpx.a(vpx_codec.c.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
    /usr/local/lib/libvpx.a: could not read symbols: Bad value
    collect2: ld returned 1 exit status
    make: ** [libavcodec/libavcodec.so.52] Erro 1
    How I compile with -fPIC ??
    Last edited by EkoBR; June 29th, 2010 at 03:11 AM.

  7. #1097
    Join Date
    Dec 2005
    Location
    St. Petersburg, FL
    Beans
    525
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: HOWTO: Install and use the latest FFmpeg and x264

    Quote Originally Posted by EkoBR View Post
    Ubuntu 10.04
    But yes, is an OpenCV compilation error.

    I will search a correct thread, Thanks.

    Update: Now I try compile ffmpeg with --enable-shared and...
    Code:
    LD    libavcodec/libavcodec.so.52
    /usr/bin/ld: /usr/local/lib/libvpx.a(vpx_codec.c.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
    /usr/local/lib/libvpx.a: could not read symbols: Bad value
    collect2: ld returned 1 exit status
    make: ** [libavcodec/libavcodec.so.52] Erro 1
    How I compile with -fPIC ??
    --enable-pic

    You'll probably need to use it on libvpx, and ffmpeg. And x264, et al. According to the Gentoo Wiki at least, on AMD64 all shared builds must be position independent, meaning they have to use the --enable-pic option (or equivalent, since parameters can differ).

  8. #1098
    Join Date
    Apr 2008
    Location
    Houston, TX USA
    Beans
    589
    Distro
    Ubuntu Development Release

    Re: HOWTO: Compile the latest ffmpeg and x264 from source

    Quote Originally Posted by FakeOutdoorsman View Post
    I just compiled x264 on x86_64 Ubuntu Lucid with no problems. Did you follow the guide word-for-word, or did you customize it at all? Did you forget to make distclean as shown in the Updating FFmpeg and x264 section of this guide? What version of Ubuntu are you using?
    Ubuntu Lucid 64bit.

    I did make distclean, and everything is according to the first post here. I compiled it successfully several times before, but hasn't been compiling for a couple weeks for me.

    I do have my CFLAGS as "-O3 -pipe -fomit-frame-pointer", which may be different than many, and I acknowledge that I'd be more likely to get errors this way, but these have been my CFLAGS for years and ffmpeg, vpx, and x264 compiled successfully with these cflags previously. I will change my cflags to "-O2" and see if recent code changes aren't playing well with my current CFLAGS.
    Locke
    Try Dropbox, it's FREE! (gratis) http://db.tt/J7Sm9iC
    Try Dropbox experimental build updater http://forums.dropbox.com/topic.php?id=12153

  9. #1099
    Join Date
    May 2006
    Location
    Milwaukee,WI
    Beans
    6,107
    Distro
    Xubuntu 14.04 Trusty Tahr

    Re: HOWTO: Install and use the latest FFmpeg and x264

    Quote Originally Posted by prupert View Post
    Are you any good at bash? Since that is the easiest way to do it.

    This is how I do it. Create two files, once called trans.sh and one called ffmpeg.sh.

    In trans.sh put the following:

    Code:
    #!/bin/bash
    echo trans started on `date "+%m/%d/%y %l:%M:%S %p"` > ~/trans.log
    
    find /path/to/your/videos -name "*.$1" -exec ~/ffmpeg.sh "{}" \; 
    
    echo ffmpeg stopped on `date "+%m/%d/%y %l:%M:%S %p"` >> ~/trans.log
    Then in ffmpeg.sh put the following:

    Code:
    #!/bin/bash
    #CUSTOMISE THE FOLLOWING
    #change the ffmpeg command here to whatever you want, keeping "$1" as your input and output file names
    #FYI this command seems to produce fairly decent files from .mpg transport streams recorded from MythTV
    trans() {
    ffmpeg -deinterlace -y -i "$1" -vcodec libx264 -level 41 -vpre normal -crf 24 -threads 0 -sn -acodec libfaac -ab 128k -ac 2 -ar 48000 -vsync 1 -async 1000 -map 0.0:0.0 -map 0.1:0.1 "$1".mkv
    }
    
    echo conversion of "$1" started on `date "+%m/%d/%y %l:%M:%S %p"` > ~/trans.log
    #call the conversion and fork it
    trans "$1" &>> ~/ffmpeg.log &
    #get the PID of the conversion
    pid=$!
    echo "ffmpeg PID = $pid" >> ~/trans.log
    echo "ffmpeg PID = $pid"
    #this is a simple progress indicator
    while ps |grep $pid &>/dev/null; do
    	echo -n "."
    	echo -en "\b-"
    	sleep 1
    	echo -en "\b\\"
    	sleep 1
    	echo -en "\b|"
    	sleep 1
    	echo -en "\b/"
    	sleep 1
    done
    
    echo ffmpeg stopped on `date "+%m/%d/%y %l:%M:%S %p"` >> ~/trans.log
    
    exit
    Save both these files in your home folder and make them executable. You can do this from the command line:

    Code:
    chmod a+x ffmpeg.sh trans.sh
    Edit trans.sh where is says "/path/to/your/videos" and put in the path to your folder full of video files. Edit ffmpeg.sh to use the ffmpeg command you want to use, make sure that you keep "trans() {" before the comand and "}" after it as in my example. Also, make sure you keep "$1" as your input filename and "$1".mkv as your output filename, but change the extension if you want.

    Then, finally, to convert the files. Put all the files you want to convert in a folder. Then, to run all this, open a Terminal window and type:

    Code:
    ./trans.sh MPG
    Replace MPG with the file extension of the video files you are converting. It should then go off and do it's thing, with a little progress bar that shows you something is happening (it doesn't give an ETA of the file conversion, since that is such a b!tch to get right).

    This is probobly all far too complicated there are easy ways of doing it. Such as:

    Code:
    find /path/to/your/videos -name "*.MPG" -exec ~/ffmpeg -deinterlace -y -i "{}" -vcodec libx264 -level 41 -vpre normal -crf 24 -threads 0 -sn -acodec libfaac -ab 128k -ac 2 -ar 48000 -vsync 1 -async 1000 -map 0.0:0.0 -map 0.1:0.1 "{}".mkv \;
    Typing all that into one line of a command line will search for all .MPG files in /path/to/your/videos and convert them using the FFmpeg command as written.
    would this command follow symlinks? i use mythrename.pl to make symlinks in human readable form to watch my recordings original xbox with xbmc prior to xbmc having the myth protocol. i'd like to use the symlinks cause i only wanna try to transcode some of my shows instead of all .mpg's. so instead of using "*.MPG", could i use something like "It's*.MPG" which would only transcode my it's always sunny in philedelphia shows? looking to save some space on the server so i want to transcode them down smaller. not to mention, xbox 360 can't play the mpgs that i am sharing from linux using ushare but it can see the avi file, so maybe i could use avi container with xvid and mp3 audio like my other avi movies that xbox 360 can play. thoughts?
    Check out my Blog about my life and computer software and hardware. http://ubuntuaddicted.blogspot.com/
    My YouTube channel:
    http://www.youtube.com/ubuntuaddicted

  10. #1100
    Join Date
    May 2010
    Beans
    4

    Re: HOWTO: Install and use the latest FFmpeg and x264

    is there a reason why the "Install libvpx (optional)" instructions aren't in the Karmic Koala guide?

Page 110 of 231 FirstFirst ... 1060100108109110111112120160210 ... LastLast

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
  •