Thanks for the more in-depth explanations about the codecs and containers, been a little while since I fussed with any of it but the whole concept is not too hard to understand.
I found the article BuZz posted
Here on the development history of ffmpeg to be extremely interesting and I do recommend anyone to give it a read, In short the way I understand it the original developers got locked out of the project and it was hijacked and forked with the same name, and you might find it interesting to know that the version of ffmpeg that ships with many linux distros like ubuntu actually have this forked version that is not as robust and might handle the command parameters differently or in my case gave me a very poor "blocky" output file.
Solution: Remove these "inferior" libav versions that came with my ubuntu 12.04 and and compile and install the "True" ffmpeg packages from source, in fact this "true" version is the same ffmpeg source that is used to compile ffmpeg in xbmc4xbox (according to a very strange man from the U.K.

)
The Commands:
1)Remove the existing packages
Code: Select all
sudo apt-get remove ffmpeg x264 libav-tools libvpx-dev libx264-dev
2)Get the dependencies
Code: Select all
sudo apt-get -y install autoconf build-essential checkinstall git libfaac-dev libgpac-dev \
libjack-jackd2-dev libmp3lame-dev libopencore-amrnb-dev libopencore-amrwb-dev \
librtmp-dev libsdl1.2-dev libtheora-dev libtool libva-dev libvdpau-dev libvorbis-dev \
libx11-dev libxext-dev libxfixes-dev pkg-config texi2html yasm zlib1g-dev
Installation:
x264 - H.264 video encoder (not necessary but may be useful for other packages that might depend on it)
Enter the following to fetch the source, compile and install the x264 package
Code: Select all
git clone --depth 1 git://git.videolan.org/x264
*TIP* - You can reduce the time it takes to compile code by splitting the job across multiple processor threads with the -j command flag, so if you have a dual core cpu you might want to use the "make -j 4" command instead of just "make", I used "make -j 8" myself on all of the make commands with a dual core cpu without problems, you can adjust this parameter to whatever you feel is necessary. Thank buZz for pointing this out too
Code: Select all
sudo checkinstall --pkgname=x264 --pkgversion="3:$(./version.sh | \
awk -F'[" ]' '/POINT/{print $4"+git"$5}')" --backup=no --deldoc=yes \
--fstrans=no --default
fdk-aac - AAC audio encoder - (again not completely necessary but it may be required for other packages that depend on it)
Code: Select all
git clone --depth 1 git://github.com/mstorsjo/fdk-aac.git
Code: Select all
sudo checkinstall --pkgname=fdk-aac --pkgversion="$(date +%Y%m%d%H%M)-git" --backup=no \
--deldoc=yes --fstrans=no --default
libvpx - VP8 video encoder and decoder ( again not completely necessary but it may be required for other packages that depend on it)
Code: Select all
git clone --depth 1 http://git.chromium.org/webm/libvpx.git
Code: Select all
sudo checkinstall --pkgname=libvpx --pkgversion="1:$(date +%Y%m%d%H%M)-git" --backup=no \
--deldoc=yes --fstrans=no --default
FFmpeg - The Meat&Potatoes
Code: Select all
git clone --depth 1 git://source.ffmpeg.org/ffmpeg
Code: Select all
./configure --enable-gpl --enable-libfaac --enable-libfdk-aac --enable-libmp3lame \
--enable-libopencore-amrnb --enable-libopencore-amrwb --enable-librtmp --enable-libtheora \
--enable-libvorbis --enable-libvpx --enable-x11grab --enable-libx264 --enable-nonfree \
--enable-version3
Code: Select all
sudo checkinstall --pkgname=ffmpeg --pkgversion="7:$(date +%Y%m%d%H%M)-git" --backup=no \
--deldoc=yes --fstrans=no --default
hash x264 ffmpeg ffplay ffprobe
Finnish ffmpeg is now ready for use and the command that BuZz posted earlier to re-encode 1080p videos (or any size/format videos) into 720p mkv files will work correctly any give nice crisp output files that in my case got reduced to half the file size in MB and guaranteed to playback on xbmc4xbox without dropping frames, you might see slight artifacts on very rare occasions but it wont drop frames
Here is that command again
Code: Select all
ffmpeg -i some_1080p_h264_video.mkv -scodec copy -acodec copy -vcodec mpeg4 -b:v 3000k -maxrate 5000k -bufsize 4096k -s 1280x720 -f matroska -y outfile.mkv