![]() |
Using other Matrix (e.g. Notch)?
Is it possible? I couldn't find anything on the web (there isn't a real documentation... is there?)
|
Re: Using other Matrix (e.g. Notch)?
Quote:
I'll take a look. It should only be a matter of changing the matrix in the source, and recompiling. -kwag |
Re: Using other Matrix (e.g. Notch)?
Quote:
> I tryed to replace the standard one in mpeg12data.h, but that didn't > work ut as I expected. ohh u can do that too, but u forgot to change the default matrixes of every other mpeg1/2 codec > Sorry to bother, but how do I use a custom matrix? set AVCodecContext.inter_matrix / intra_matrix Only I still don't know how to pass this to the commandline... :( |
It's perfectly possible using mencoder.
|
mencoder is based on ffmpeg?
I never really got it... Searching for ffmpeg always gave me various mencoder results... (looking for mplayer gave me too) |
Yes, mplayer/mencoder is heavily based on ffmpeg (only libavcodec).
Although you can encode with mencoder with divx or xvid too, encoding with the ffmpeg family is the recomended option. Since version 1.0pre1, they added the option to pass custom /inter/intra matrices to ffmpeg when encoding in mpeg1video or mpeg2video, even in the new documentation is an example using the kvcd notch matrix, which I have used since I saw it. Personally, I find it very convenient to encode with mencoder because it includes a series of filters (resizing, cropping, adding black bars, deblocking, deringing, denoise3d, etd). In my tests I am able to obtaing really surprising KSVCD encodes (480x756, mpeg2, notch matrix) with average bitrates of 1000 to 1500 (I never thought it was possible to get good quality with mpeg2 in this resolution with this bitrates, now I'm trying to lower it even more). The only problem I find is with the ratecontrol (I get peaks of more than 6000) but it's a problem in ffmpeg, I follow the development lists, and they are going to try a new ratecontrol system, I hope they honor in it the max bitrate! |
Can you please, please, please, share your commandline options with us? ;-)
|
mencoder -nosound -of mpeg -ovc lavc -lavcopts
vcodec=mpeg2video:vmax_b_frames=2:mbd=2:keyint=15: vpass=1:aspect=4/3:vbitrate=1500:vrc_maxrate=2500:vrc_minrate=128:v rc_buf_size=1840:vlelim=-4:vcelim=7:vstrict=1:precmp=2:cmp=2:subcmp=2:trell :cbp:vqcomp=0:intra_matrix=8,9,12,22,26,27,29,34,9 ,10,14,26,27,29,34,37,12,14,18,27,29,34,37,38,22,2 6,27,31,36,37,38,40,26,27,29,36,39,38,40,48,27,29, 34,37,38,40,48,58,29,34,37,38,40,48,58,69,34,37,38 ,40,48,58,69,79:inter_matrix=16,18,20,22,24,26,28, 30,18,20,22,24,26,28,30,32,20,22,24,26,28,30,32,34 ,22,24,26,30,32,32,34,36,24,26,28,32,34,34,36,38,2 6,28,30,32,34,36,38,40,28,30,32,34,36,38,42,42,30, 32,34,36,38,40,42,44 -vf pp=hb/vb/dr,hqdn3d,scale=480:432,expand=480:576 -sws 9 -o out_file.mpg Homeworld1024.avi Then, the same but with vpass=2 for the second pass. Here I have used keyint=15, that means one I-Frame every 15 = GOP of 15 frames, can be changed to whatever you want. Also vmax_b_frames=2, so 2 B frames (IBBPBBPBBPBBPBB) intra_matrix and inter_matrix are the notch matrices (I haven't checked, but the documentation says that in the example, and I just copied the matrices from there). vrc_maxrate and vrc_minrate are, supposedly, max and min bitrate, but they don't work as intended (I have got peaks of 6000 sometimes) -vf pp (Video Filters PostProcessing), hb= horizontal deblock, vb=vertical deblock, dr = deringing, hqdn3d = high quality denoise 3d, scale to 480x432, expand with black bars to 480x576 sws is the scaling algorithm (lanczlos) and buf_size is in kbits, so 1840 kbits=230 kBytes. vqcomp is to follow bitrate more than quality (although even with this I get exagerated peaks). Seems they are working on it, though. Then, you must do 'mplayer -dumpvideo -dumpfile out_file.m2v out_file.mpg' to get the m2v that will be muxed with the mp2. I get impressive quality... but these bitrate peaks give me headaches. Some people have posted all kind of tricks to make it follow the bitrate, but none of them works really OK. I wait for the new bitrate control code in ffmpeg, and hope it will be better! |
Encoding time is far below what ffmpeg itself does, I've made an kvcd (I hope) with:
Code:
mencoder -nosound -of mpeg -ovc lavc -lavcopts vcodec=mpeg1video:vmax_b_frames=2:mbd=2:keyint=15:aspect=4/3:vbitrate=1150:vrc_maxrate=2400:vrc_minrate=300:vrc_buf_size=320:vlelim=-4:vcelim=7:vstrict=1:precmp=2:cmp=2:subcmp=2:trell:cbp:vqcomp=0:intra_matrix=8,9,12,22,26,27,29,34,9,10,14,26,27,29,34,37,12,14,18,27,29,34,37,38,22,26,27,31,36,37,38,40,26,27,29,36,39,38,40,48,27,29,34,37,38,40,48,58,29,34,37,38,40,48,58,69,34,37,38,40,48,58,69,79:inter_matrix=16,18,20,22,24,26,28,30,18,20,22,24,26,28,30,32,20,22,24,26,28,30,32,34,22,24,26,30,32,32,34,36,24,26,28,32,34,34,36,38,26,28,30,32,34,36,38,40,28,30,32,34,36,38,42,42,30,32,34,36,38,40,42,44 -vf pp=hb/vb/dr,hqdn3d,scale=352:240 -sws 9 -o out_file.mpg Downloads/my_movie.aviIs there a way to add the matrix option to ffmpeg itself? (I've been looking in the source for that, but can't find any) |
Well, you have made something strange then, it's MUCH FASTER than mpeg2enc. It's exactly the same speed as ffmpeg, 'cause in fact it's ffmpeg.
Anopther thing is all the filters you are using, etc. Try using only the matrices, but taking out mbd, precmp, cmp and subcmp, trell, cbp, pp (all three) and hqdn3d and you'll see. If you activate the ffmpeg options (mbp, all three cmp, trell and cbp) in fmpeg, they have the same effect as here. And for the filters, both scaling and denoise3d are faster than the equivalents yuvscale and yuvdenoise from mjpegtools. I use this options (not always, sometimes others) for maximum quality, don't use them and nothing will rival on speed. |
Quote:
While encoding I viewed in the meentime with mplayer and it was showing me that after 10min. encoding the movie lasted 3min. I was a bit fooled by that. Is there a way to encode audio in the same line? |
Well. now I have been trying some more, and using only hqdn3d, taking out all other filters/special comparators/etc, it goes much faster and I don't see much difference in the final quality.
I'm finding now when trying to make SKVCDs at 1500, that they are at end at about 750/800 (it makes q=3 for I and P frames, q=5 for B frames), but with peaks of between 3000 and 4000. I don't know why but it makes some I frames q=2 even when I specify vqmin=3... When I have time I'll look to the ratecontrol code to see if something can be done about these peaks (no one seems to find a solution in the devel list, perhaps is because they are trying the new ratecontrol system). Well, if you look with mplayer, it will take the max bitrate for doing calculations (so, a 1 hour movie with medium bitrate 1000 and max bitrate 3000 will shou up as having only 20 min). Anyone knows how to 'repair' this thing? |
could you give me a "sample" command line...
2 much man pages *g* |
Hello all,
I've been using the two examples (KSVCD and KVCD) lemon and japie have given in this thread. The movie I'm trying to convert is a DivX/25 FPS. Problem is, the resulted .mpg video goes out of sync with audio. Also I get LOTS of weird messages during encoding (I'm encoding in 2 passes), something like these: Code:
Warning: DTS to SCR delay is too small 31min 275mb A-V:0.000 [881:0]1) Run both passes on the movie with either lemon's or japie's example commandlines. 2) Dump the video from the .mpg which came out of step 1. Command is this: Code:
mplayer -dumpvideo -dumpfile outfile.m2v test.mpgCode:
mkfifo -m 660 outfile.pcmCode:
tcmplex -i outfile.m2v -p outfile.mp2 -m 2 -o result.mpg/tetra |
I get these weird messages when the mpeg stream gets out of bitrate/buffersize specified.
I have managed to create one SVCD more or less 'compliant'. The audio was out of sync, bit I arranged it manually with the -O option of mplex. Right now, my commandline doesn't have ANY filter (except crop, resize and expand, of course), I seem to get more quality these way, strange, and of course much more speed. I have checked also that I get more quality if I don't use the knotch matrix. In both cases the final medium bitrate is much lower than what I specify, but with the normal matrix is is just a bit higher (just a bit) and I get much more quality. |
doesn't the 2 pass option create accurate results (as in ffmpeg)?
|
Nor in mencoder nor in ffmpeg creates acurate results.
Only medium bitrate is accurate. Maximum bitrate is not respected. |
Well, it seems that the new ratecontrol system respects now the limits. I have been able to create a standard SVCD without problems.
|
I've made a little script to create a full kvcd_3 stream, in the past I always stuck to 352x240 but I tryed the 528:480 this time.
http://japie.is.dreaming.org/ftp/KVC...d_ffmpeg.sh.gz It has a really nice quality untill the action start, very blocky. If someone has any ideas about this? p.s. You need mplayer-1.x, ffmpeg-0.4.8 and lsdvd http://acidrip.thirtythreeandathird.net/lsdvd.html |
|
Site design, images and content © 2002-2026 The Digital FAQ, www.digitalFAQ.com
Forum Software by vBulletin · Copyright © 2026 Jelsoft Enterprises Ltd.