twazerty
25th June 2010, 21:45
I am trying to bring AVCHDCoder to Mac OS X. I first need to tackle the encoding problem. I did some research and I found that x264 can be used through ffmpeg. After some more research I found the first option of compiling ffmpeg with x264. Macports have them in their system. But they don't deliver the latest version:
ffmpeg 0.5.1
x264 20100412
But for a first try this is good enough (I think :P)
So did some more research and finally I came up with these commandlines:
ffmpeg -y -i "/Users/twazerty/Desktop/Sample 1.m2ts" -pass 1 -threads 12 -s 1280x720 -maxrate 18000000 -bufsize 18000000 -b 4500000 -level 41 -g 24 -keyint_min 2 -i_qfactor 1.10 -b_qfactor 1.10 -r 23.976 -flags2 +aud -vcodec libx264 -vpre default "/Users/twazerty/Desktop/ouput_test_2.h264"
ffmpeg -y -i "/Users/twazerty/Desktop/Sample 1.m2ts" -pass 2 -threads 12 -s 1280x720 -maxrate 18000000 -bufsize 18000000 -b 4500000 -level 41 -g 24 -keyint_min 2 -me_method umh -i_qfactor 1.10 -b_qfactor 1.10 -r 23.976 -flags2 +aud -vcodec libx264 -vpre default "/Users/twazerty/Desktop/ouput_test_2.h264"
After it was created I threw the videostream into mediainfo and compaired it with a stream I created with x264.exe on windows. The result is not what I expected. I got the following:
cabac=1 / ref=3 / deblock=1:0:0 / analyse=0x3:0x113 / me=hex / subme=7 / psy=1 /
psy_rd=1.00:0.00 / mixed_ref=1 / me_range=16 / chroma_me=1 / trellis=1 / 8x8dct=1 /
cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=-2 / threads=12 /
sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / constrained_intra=0 /
bframes=3 / b_pyramid=0 / b_adapt=1 / b_bias=0 / direct=1 / wpredb=1 / wpredp=2 /
keyint=250 / keyint_min=25 / scenecut=40 / intra_refresh=0 / rc_lookahead=40 /
rc=2pass / mbtree=1 / bitrate=4500 / ratetol=0.9 / qcomp=0.60 / qpmin=10 /
qpmax=51 / qpstep=4 / cplxblur=20.0 / qblur=0.5 / vbv_maxrate=18000 /
vbv_bufsize=18000 / ip_ratio=1.41 / aq=1:1.00 / nal_hrd=none
These things that are totally wrong:
me=hex, I set -me_method umh
keyint=250, I set -g 24
keyint_min=25, I set -keyint_min 2
Why are those 2 settings applied to the encode??
And I expect the following:
cabac=1 / ref=3 / deblock=1:0:0 / analyse=0x3:0x113 / me=umh / subme=7 / psy=1 /
psy_rd=1.00:0.25 / mixed_ref=1 / me_range=16 / chroma_me=1 / trellis=1 / 8x8dct=1 /
cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=-4 / threads=12 /
sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / constrained_intra=0 /
bframes=3 / b_pyramid=2 / b_adapt=1 / b_bias=0 / direct=3 / weightb=1 / weightp=0 /
keyint=24 / keyint_min=2 / scenecut=40 / intra_refresh=0 / rc_lookahead=24 /
rc=2pass / mbtree=1 / bitrate=5000 / ratetol=1.0 / qcomp=0.60 / qpmin=10 /
qpmax=51 / qpstep=4 / cplxblur=20.0 / qblur=0.5 / vbv_maxrate=18000 /
vbv_bufsize=18000 / ip_ratio=1.10 / aq=1:1.00 / nal_hrd=vbr
How can I get the result I expect? What parameters to change/add?? And why is weightb=1 / weightp=0 totally missing in my result on mac?
Another problem:
According to mediainfo the framerate is Variable but I did set -r 23.976. Confused...
ffmpeg 0.5.1
x264 20100412
But for a first try this is good enough (I think :P)
So did some more research and finally I came up with these commandlines:
ffmpeg -y -i "/Users/twazerty/Desktop/Sample 1.m2ts" -pass 1 -threads 12 -s 1280x720 -maxrate 18000000 -bufsize 18000000 -b 4500000 -level 41 -g 24 -keyint_min 2 -i_qfactor 1.10 -b_qfactor 1.10 -r 23.976 -flags2 +aud -vcodec libx264 -vpre default "/Users/twazerty/Desktop/ouput_test_2.h264"
ffmpeg -y -i "/Users/twazerty/Desktop/Sample 1.m2ts" -pass 2 -threads 12 -s 1280x720 -maxrate 18000000 -bufsize 18000000 -b 4500000 -level 41 -g 24 -keyint_min 2 -me_method umh -i_qfactor 1.10 -b_qfactor 1.10 -r 23.976 -flags2 +aud -vcodec libx264 -vpre default "/Users/twazerty/Desktop/ouput_test_2.h264"
After it was created I threw the videostream into mediainfo and compaired it with a stream I created with x264.exe on windows. The result is not what I expected. I got the following:
cabac=1 / ref=3 / deblock=1:0:0 / analyse=0x3:0x113 / me=hex / subme=7 / psy=1 /
psy_rd=1.00:0.00 / mixed_ref=1 / me_range=16 / chroma_me=1 / trellis=1 / 8x8dct=1 /
cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=-2 / threads=12 /
sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / constrained_intra=0 /
bframes=3 / b_pyramid=0 / b_adapt=1 / b_bias=0 / direct=1 / wpredb=1 / wpredp=2 /
keyint=250 / keyint_min=25 / scenecut=40 / intra_refresh=0 / rc_lookahead=40 /
rc=2pass / mbtree=1 / bitrate=4500 / ratetol=0.9 / qcomp=0.60 / qpmin=10 /
qpmax=51 / qpstep=4 / cplxblur=20.0 / qblur=0.5 / vbv_maxrate=18000 /
vbv_bufsize=18000 / ip_ratio=1.41 / aq=1:1.00 / nal_hrd=none
These things that are totally wrong:
me=hex, I set -me_method umh
keyint=250, I set -g 24
keyint_min=25, I set -keyint_min 2
Why are those 2 settings applied to the encode??
And I expect the following:
cabac=1 / ref=3 / deblock=1:0:0 / analyse=0x3:0x113 / me=umh / subme=7 / psy=1 /
psy_rd=1.00:0.25 / mixed_ref=1 / me_range=16 / chroma_me=1 / trellis=1 / 8x8dct=1 /
cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=-4 / threads=12 /
sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / constrained_intra=0 /
bframes=3 / b_pyramid=2 / b_adapt=1 / b_bias=0 / direct=3 / weightb=1 / weightp=0 /
keyint=24 / keyint_min=2 / scenecut=40 / intra_refresh=0 / rc_lookahead=24 /
rc=2pass / mbtree=1 / bitrate=5000 / ratetol=1.0 / qcomp=0.60 / qpmin=10 /
qpmax=51 / qpstep=4 / cplxblur=20.0 / qblur=0.5 / vbv_maxrate=18000 /
vbv_bufsize=18000 / ip_ratio=1.10 / aq=1:1.00 / nal_hrd=vbr
How can I get the result I expect? What parameters to change/add?? And why is weightb=1 / weightp=0 totally missing in my result on mac?
Another problem:
According to mediainfo the framerate is Variable but I did set -r 23.976. Confused...