which formats do you prefer and use for your media encoding/transcoding?
It's i want to encode some dvds and i am not able to decide what to use - mkv or ogm?; x264, ffmpeg, Huffyuv, theora?; ac3 or ogg? /maybe others?/..i know that depends on what i want to do so it's only for movie encoding/transcoding. The license is important for me too.
and the second..what apps do you use for encoding/transcoding your media files?..it's every app supports mp3/divx/avi but there's not a lot which supports e.g. ogm, x264, ...
I use x264 through FFMPEG or Mencoder to do nearly all of my encoding, and GPAC to make them ISO compliant. Generally I use MP4 containers for portability, but have been playing with MKV lately to test out menus. If you use the above software, you can make files compatible with MPlayer, VLC, and Quicktime, which covers most systems. Although a ton of quality is lost when played back through Quicktime.
Last edited by skottish (2007-07-13 21:59:09)
thank you, Skottish
(this is not the first time you are helping me)
could you post me some overall syntax example (x264+ogg=mkv) which can i apply? /mencoder/x264 are very powerfull and i don't understand all these options at all/
I hope you wanted a lengthy response...
I'm currently only using H264 (MPEG-4 Part 10) for video and AAC (MPEG-4 Part 14) for audio in MP4 containers for my videos. I use FFMPEG to drive x264 and FAAC to accomplish this. I was using GPAC to make the resulting file ISO compliant, but I think FFMPEG may do that on it's own now. (And when I want MKV videos, mkvtoolnix will happily take these streams and transmux them losslessly! FFMPEG will be able to do it in a matter of days.)
I'm using this setup because at the moment it's highly portable, and it looks more and more like this will be implemented into newer home players; H264 in MP4 for sure, that's a done deal. And I know that more manufacturers are looking at AAC support in parallel to AC3.
I haven't done a whole lot of video transcoding, but what I've done has been really beautiful. I used the following command in FFMPEG to transcode the movie "The Fountain":
ffmpeg -map 0:0 -map 0:2 -i fountain.mpg -threads 2 -b 3100k -vcodec h264 -ac 2 -ab 256k -ar 44100 -acodec mpeg4aac -coder 1 -flags +loop -cmp +chroma -partitions +parti4x4+partp8x8+partb8x8 -me hex -subq 5 -me_range 16 -g 250 -keyint_min 25 -sc_threshold 40 -i_qfactor 0.71 -vol 400 fountain.mp4
Pretty, isn't it?
Here's what happened.
I used MPlayer to grab the title track of the movie by doing this:
mplayer dvd://1 -dumpstream -dumpfile fountain.mpg
I didn't use 'vob' because in the past both FFMPEG and Mencoder have had strange sync issues with the file type. Funny, it's exactly the same file (vob=mpeg2).
That video has all of the movie's tracks: video (including angles), audio (including multiple languages), and subtitles of all kinds. For my needs, I only wanted the main movie plus the English language tracks. I also don't need surround sound.
To figure out what the language track ID is, I simply opened the file in VLC and selected each track down the list. English is the second track.
So, this is what that command means:
-map tells FFMPEG to grab the video track (0:0), and the second audio track (0:2) only.
-i is the input source
-threads is because I have a multi-processor system
-b is the video bitrate. The 'k' for kb/s is necessary.
-vcodec is for H264 (uses x264)
-ac 2 will encode only the two primary audio tracks (stereo)
-ab is the audio birate.
-ar is the audio frequency in khz.
-acodec is for AAC (uses FAAC). Note: My copy of FFMPEG is never more than a week old. The command in the version in the repos may still be 'aac' instead of 'mpeg4aac'.
-coder does some magic to keep the strange gray box away (That's all I know)
-flags through i_qfactor is something I read on a website that said that one should always use. It produces great results, I won't argue...
Actually, it's all the stuff that tells x264 how to make predictions in and around the current frame for compression. It's some fairly complicated stuff that I'm slowly learning about.
-vol 400 tells FFMPEG to bring the volume way up. For some reason MPEG-2 files have really low audio when dumped onto my computer. This fixes that.
fountain.mp4 is the resulting file.
The original mpg file was ~4.6GB. The resulting file is ~2.1GB. It looks nearly identical to the original.
I also used the exact same command line with much lower bitrates to get a another movie of similar lengths onto one CD, and it still was very watchable. I think I had the video bitrate at 700k, and the audio at 96k.
By the way, just about anything you could ever want to know about video encoding can be found at http://forum.doom9.org
Last edited by skottish (2007-07-14 05:26:52)
Hi I´m doing a lot of encoding of HDTV Tv Shows to 720p x264 + aac in a mp4 container.
This way I can watch them on my PS3.
If you change some settings and change the scale you can use this also for DVDs or mpgs or what ever.
mkfifo audiodump.wav faac -q 100 -b 160 -R 48000 -X audiodump.wav --mpeg-vers 4 --obj-type LC -o audio.mp4 & mplayer $1 -vc dummy -vo null -ao pcm:waveheader mencoder $1 -sws 9 -vf filmdint=dint_thres=256/comb_thres=280/sad_thres=1180,crop=1904:1064:8:8,scale=1280:720,harddup -nosound -ovc x264 -x264encopts pass=1:turbo=2:bitrate=$2:threads=2:bframes=3:ref=3:subq=1:me=umh:trellis=1:analyse=p8x8,b8x8,i4x4:b_pyramid:bime:weight_b:no_psnr:no_ssim:level=41 -ofps 24000/1001 -of rawvideo -o video.264 mencoder $1 -sws 9 -vf filmdint=dint_thres=256/comb_thres=280/sad_thres=1180,crop=1904:1064:8:8,scale=1280:720,harddup -nosound -ovc x264 -x264encopts pass=2:bitrate=$2:threads=2:bframes=3:ref=3:subq=1:me=umh:trellis=1:analyse=p8x8,b8x8,i4x4:b_pyramid:bime:weight_b:no_psnr:no_ssim:level=41 -ofps 24000/1001 -of rawvideo -o video.264 MP4Box -add video.264 -add audio.mp4 -fps 23.976 $3
save it as a script. For example. enc720pmp4
this script wants 3 parameters:
Input bitrate output.
So: enc720pmp4 file.ts 4100 file.720p.x264.aac.mp4
will give you after some hours a top notch quality file.
Last edited by mic64 (2007-07-14 10:02:07)
You may want to do some tests and see if 2 pass encoding is producing useful results for you (as opposed to single pass). I can't tell any difference at all. And one of x264's developers, who goes by the name akupenguin on doom9's forum, was saying a while back that it's simply not necessary with x264; That it won't really change anything for better or for worse. If you want, I can dig up the thread.
Here it is:
Last edited by skottish (2007-07-14 17:20:04)
I know thios thread and wanted to start testing with some new parameters and only 1 pass.
But 2pass encoding is an old habit from good old xvid times :-)
This thread rocks - thanks for all the good input skottish!
Unthinking respect for authority is the greatest enemy of truth.
This thread rocks - thanks for all the good input skottish!
I'll second that. I have never seen such a detailed guide to 'perfection' using ffmpeg.
Intel Core2Duo E6300 @ 1.86 GHz
KDEmod current repository