You are not logged in.
I'm having strange problems encoding x264 video with avidemux:
http://www.youtube.com/watch?v=615_f6NAM1s
I used the default settings for "MPEG4 AVC" except an average video btitrate of 3659 kbps. Any suggestions what could be wrong?
Thanks,
lynix
Last edited by lynix (2010-11-09 19:12:58)
Offline
Jesus Christ that looks horrible! Does it look okay with any other codec???
Offline
Indeed it does Yes, with DivX for example everything is fine.
Offline
Have you tried handbrake-svn (in AUR) for encoding?
CPU-optimized Linux-ck packages @ Repo-ck • AUR packages • Zsh and other configs
Offline
No I didn't, because handbrake can only take DVD as input as far as I know.
I wanted to take a 1080p full-HD .mkv and scale it down to 720p for my HTPC.
Offline
I wanted to take a 1080p full-HD .mkv and scale it down to 720p for my HTPC.
Handbrake can do it. I recommend handbrake-svn as well as graysky.
Offline
The current handbrake-svn doesn't build, I'm trying to fix the PKGBUILD and give it a chance.
Thanks for the tip, you two
Offline
The current handbrake-svn doesn't build, I'm trying to fix the PKGBUILD and give it a chance.
Thanks for the tip, you two
You can always default to the "handbrake" package in [extra] but what problems are you experiencing with the svn package? Builds fine for me.
CPU-optimized Linux-ck packages @ Repo-ck • AUR packages • Zsh and other configs
Offline
Just use FFmpeg:
ffmpeg -i input.foo -vcodec libx264 -vpre medium -crf 22 -acodec copy -vf scale=1280:-1 -map_meta_data 0:0 -threads 0 output.mkv
Required reading: FFmpeg x264 encoding guide.
You could use x264 directly too, but I recommend compiling it with lavf or ffms support first.
Offline
You can always default to the "handbrake" package in [extra] but what problems are you experiencing with the svn package? Builds fine for me.
I tried handbrake from [extra], biut didn't find any way to select a file as input, instead of a disc. handbrake-svn fails like this:
libtool: link: ranlib .libs/libmp4v2.a
libtool: link: ( cd ".libs" && rm -f "libmp4v2.la" && ln -s "../libmp4v2.la" "libmp4v2.la" )
make[1]: Leaving directory `/tmp/yaourt-tmp-alex/aur-handbrake-svn/src/hb-trunk-build/build/contrib/mp4v2/mp4v2-trunk-r355'
touch contrib/mp4v2/.stamp.build
Aborting...
==> ERROR: Makepkg was unable to build handbrake-svn.
Just use FFmpeg:
ffmpeg -i input.foo -vcodec libx264 -vpre medium -crf 22 -acodec copy -vf scale=1280:-1 -map_meta_data 0:0 -threads 0 output.mkv
Thanks, will try that too
Last edited by lynix (2010-11-07 09:21:18)
Offline
@lynix
the problem is due do bad decoding of original file, not to encoding
try x264 alone like this
x264 myfile.mkv --pass 1 --bitrate 3659 --preset medium --tune film --video-filter crop:2,0,18,90/resize:640,416,method=spline --no-interlaced --output output.mkv
x264 myfile.mkv --pass 2 --bitrate 3659 --preset medium --tune film --video-filter crop:2,0,18,90/resize:640,416,method=spline --no-interlaced --output output.mkv
or decode using ffmpeg and pipe to x264 (use mkfifo or whatever...)
ffmpeg -i myfile.mkv -croptop 0 -cropbottom 90 -cropleft 2 -cropright 18 -s 640x416 -an -v 0 -pix_fmt yuv420p -f rawvideo - | x264 --pass 1 --bitrate 3659 --preset medium --tune film --output output.mkv - --input-res 640x416
ffmpeg -i myfile.mkv -croptop 0 -cropbottom 90 -cropleft 2 -cropright 18 -s 640x416 -an -v 0 -pix_fmt yuv420p -f rawvideo - | x264 --pass 2 --bitrate 3659 --preset medium --tune film --output output.mkv - --input-res 640x416
just pay attention to crop filter and output resolution
or use one of my gui (.. maybe i will post on aur )
BHH
HDConvertToX, AutoMen, AutoMKV author
Offline
I personally recommend using h264enc from AUR. It can take a DVD or any file as input and encode to H.264. I use it to encode DVDs or Blu-Rays to smaller H.264 files. The output files don't stutter, the only issue they have is if the input audio is DTS, then the output A/V sync is generally off. I work around that by re-encoding the DTS into AC3. People say that re-encoding degrades quality, but my eyes and ears can't tell the difference. h264enc uses mencoder to do the encoding, which I believe uses libx264 for the H.264 heavy lifting.
Offline
Thanks for all the replies
I finally re-encoded my file using ffmpeg:
ffmpeg -i infile.mkv -an -sn -vcodec libx264 -vpre slow_firstpass -b 5000k -pass 1 -vf scale=1280:-1 -threads 0 outfile.mkv
ffmpeg -i infile.mkv -an -scodec copy -vcodec libx264 -vpre slow -b 5000k -pass 2 -vf scale=1280:-1 -threads 0 -y outfile.mkv
Then I merged audio back in with mkvmerge. The remaining question is whether en- or decoding went wrong, and if the former is the case, why Avidemux failed while ffmpeg succeeded. I'll try the method buzzqw mentioned.
Also I wonder if there is no "easier" method of just changing the resolution (1080p -> 720p) without a completely new analysis. I mean, is there no shortcut when you keep the codec and just scale down the pictures? ^^
Anyway, I'll mark the thread as solved because the troubles are gone with ffmpeg. Thanks again
Offline
Thanks for all the replies
I finally re-encoded my file using ffmpeg:
ffmpeg -i infile.mkv -an -sn -vcodec libx264 -vpre slow_firstpass -b 5000k -pass 1 -vf scale=1280:-1 -threads 0 outfile.mkv ffmpeg -i infile.mkv -an -scodec copy -vcodec libx264 -vpre slow -b 5000k -pass 2 -vf scale=1280:-1 -threads 0 -y outfile.mkv
Unless you targeting a specific output file size you should use single-pass CRF in most cases as shown in my previous example.
Also I wonder if there is no "easier" method of just changing the resolution (1080p -> 720p) without a completely new analysis. I mean, is there no shortcut when you keep the codec and just scale down the pictures? ^^)
You could simply tell your player to scale the video upon decoding. Otherwise, you must re-encode the video if you want to scale the output.
Offline
Unless you targeting a specific output file size you should use single-pass CRF in most cases as shown in my previous example.
File size is the thing I was interested in: in my opinion disk capacities have not grown as fast as movie file sizes of recent quality. So I only keep 1080p for my favourite movies and prefer 720p for the rest, to save disk space.
I tried CRF but either the result quality or the file size was not satisfying, maybe I chose the wrong factor? ~10 - ~15?
Last edited by lynix (2010-11-09 20:55:41)
Offline
Hi lynix,
you should listen to buzzqw. Esp since he wrote AutoMKV
Personally I never had big success with Avidemux and h264-based sources.
Examples:
The captures from my HD camcorder are h264 plus AAC audio in AVI container. Avidemux (both under Ubuntu 9.10 as well as under arch) give me either green screen when I open the video or tend to be async.
After conversion of the audio to PCM I mainly use VirtualDub under WinXP to cut framebased. After this I reencode audio to MP3 and store the resulting video inside an MKV container.
Using Avidemux for shrinking oversized HD material also failed because the resulting MKV showed either strange image corruption during playback or became async after a while.
I used ffmpeg with big success and without any issues for shrinking those HD material. I´ve heared that peoples swear on h264 being much better than using ffmpeg for h264. I did some experiments and hardly can tell the difference between a 1080p video shrinked with both ffmpeg and h264.
Also I wonder if there is no "easier" method of just changing the resolution (1080p -> 720p) without a completely new analysis. I mean, is there no shortcut when you keep the codec and just scale down the pictures?
No, this is technically not possible. For MPEG2 there are compressed domain transcoders (e.g. requant / DVD Shrink) which can "compress" the video without full decoding and (re)encoding. I guess when not touching resolution then something similar might be possible to build a compressed domain transcoder for h264 stuff but I am not aware of one.
For 1080p->720p the simplest approach to speed up things is using a decoder which uses the acceleration features of your GPU. For Windows this is possible by using DGAVCIndex and an NVidia card. For Linux I can not tell what is possible.
Best regards,
D$
My archlinux x86_64 host:
AMD E350 (2x1.6GHz) / 8GB DDR3 RAM / GeForce 9500GT (passive) / Arch running from 16GB USB Stick
Offline