Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion. Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules. |
![]() |
#1 | Link |
Registered User
Join Date: Sep 2004
Posts: 29
|
Convert an h264/mp3 video for DVD playback
Hello,
My wife has a private concert(h264/mp3 3.5 gb 1080p) she would like to convert to make it readable by dvd player. Since I had to do some authoriting for the menu, I have used Nero Video. This one allow me to add chapter, menu,... but has very few option for encoding. I found I could choose a VBR wich adapt to the target size but that was nearly all. Can't choose bitrate for audio encoding. For this reason, I have used ffmpeg to encode manually video part with the following parameter: Code:
ffmpeg -i input.avi -target pal-dvd -bf 2 -mbd rd -trellis 2 -cmp 2 -subcmp 2 -me_method epzs -threads 4 -vf zscale=w=720:h=576 -qscale:v 1 -aspect 16:9 output.mpg My oritginal file was in 1080p so I guess that the downscaling to 720x576 explain a part of the shrink(original was 3.5 gb in h264/mp3) but still I think it's a lot compare to the nero encoding which propose me around 6gb with Highest quality(8000kb/s). here is the ouptut of ffmpeg Code:
frame=146679 fps= 27 q=1.0 Lsize= 2783430kB time=01:37:47.12 bitrate=3886.4kbits/s speed=1.07x video:2398535kB audio:320857kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 2.354862% Is it a problem for dvd playback(does it need constant bitrate ??) I wanted to use this file but nero seems to reencode it(didn't find a way to just copy it) but with a far less size than with direct nero encoding... Is it possible to create the whole dvd structure with nero(including menu) and after replace video/audio file by the ffmeg encode ? |
![]() |
![]() |
![]() |
#2 | Link |
Registered User
Join Date: Apr 2010
Location: I have a statue in Hakodate, Japan
Posts: 760
|
The problem I have is you're trying to encode a DVD and does not meet their standards, or are not doing only one DVD authoring with Nero. When you only authorship should not recode the program but only verify compliance with the DVD standard.
There should be no problem to put -target pal-dvd but in the particular rather I put each option separately to comply with standard DVD. Add -vcodec mpeg2video -b:v 8000000 -bufsize 1835000. |
![]() |
![]() |
![]() |
#4 | Link | |
Registered User
Join Date: Sep 2003
Location: Berlin, Germany
Posts: 3,113
|
Hi thetrueavatar,
your FFMpeg command line encodes the source at constant quality (VBR), a value of 1 will give you the highest quality (but it will not be lossless). You did not say how long your source file is, but if it is quite short then the result will not fill the DVD because the DVD bitrate has an upper limit (~9000 kbps). Here is an FFMpeg command line which will encode a source to a DVD compliant MPEG file and fill up the DVD as much as possible. It uses the FOX Home Theater matrix (suitable for very high bitrates). Audio is converted to AC3at 224 kbps. You need to edit the command line for your input and output, and also set the desired video bitrate (it is set to 8000 kbps). Quote:
The other problem is that Nero has the tendency to always reencode the source even if it is already DVD compliant. This is an old Nero issue, not much you can do about it. But there is a way to use the Nero menu which you already made with an already authored menuless VIDEO_TS structure. This method uses PGCEdit. You would need to author your FFMpeg encoding result to a DVD structure first (demux the .mpg file, then use MuxMan for authoring). I uploaded a short tutorial about this method here: http://www61.zippyshare.com/v/FQm48QTQ/file.html If the menu you already made with Nero is not too elaborate and you wouldn't mind starting over, then my recommendation would be to forget Nero altogether. Use AVStoDVD instead, it can create nice menus, it encodes at very high quality (HCenc), and it is easy to use (much easier than Nero IMO). Good luck manolito |
|
![]() |
![]() |
![]() |
#5 | Link |
Registered User
Join Date: Sep 2004
Posts: 29
|
Well my source is 97 min longth so quite reasonable but not enough to encode @9000kbps. My encoding with ffmpeg gave me a 3 361 Kbps average bitrate. Is the encoder that powerfull to compress it like that ??? I have tried with avstoDVD and had some trouble with menu editing but may try once again. Basically I just want a home with play and chapter link. Each page of chapter has a 4 link each to a given song(chapter). So not complex at all but can't found how to create multiple page...
Btw is HCenc better than the one provided with ffmpeg ? Last edited by thetrueavatar; 18th January 2016 at 21:04. |
![]() |
![]() |
![]() |
#6 | Link |
Registered User
Join Date: Sep 2003
Location: Berlin, Germany
Posts: 3,113
|
My bitrate calculator says that (with an audio bitrate of 224) your video bitrate should be 6081 kbps. If you include a menu you should lower this bitrate a little bit.
From my own experience with 1-pass VBR FFMpeg encodes I learned that it has a tendency to undersize using default parameters. You can overcome the undersizing by adding this: -qmin 1 -lmin 175 to the command line. AVStoDVD at its current state cannot create chapter selection menus. This will probably change in the near future, but not right now... You could try DVDStyler for this, it can create powerful menus and is still easy to use. Out of the box it can only encode with FFMpeg in CBR mode, but for higher quality there is a plugin which can use 1-pass and 2-pass VBR modes, can use High Quality parameters and supports Custom Quant Matrices (incidentally written by me...) I won't get into a dispute about if FFMpeg or HCenc is the better encoder. To beat a HCenc encode in 2-pass VBR mode using the BEST profile and a suitable matrix is not so easy IMO (maybe CCE SP3, but you pay $$$). At least for lower bitrates (below 3500) FFMpeg can be just as good or even better in HQ 2-pass VBR mode. Got to try it for yourself... Cheers manolito |
![]() |
![]() |
![]() |
#7 | Link |
Registered User
Join Date: Sep 2004
Posts: 29
|
Ok will give a try to dvdstyler. I have tried to use it under linux but it was a complete nightmaire to get all dependencies working and had core dump. I will test it under windows then.
Btw that's a pity that avstodvd doesn't yet support multi page since there is a next page arrow(in grey) in their tools...i6 3h63 Kbpst EDIT: with your parameter and a v:qscale:1 I have indeed a bigger file with an overal of 6 363 Kbps which is a little bit to big for my DVD. BTW do we agree that 2 pass VBR is not better for quality but just to fit the bitrate/size asked ? Last edited by thetrueavatar; 19th January 2016 at 13:38. |
![]() |
![]() |
![]() |
#8 | Link | |||
Registered User
Join Date: Sep 2003
Location: Berlin, Germany
Posts: 3,113
|
Quote:
The menu capabilities of AVStoDVD rely on BatchMux. The latest version just came out a few weeks ago, and this version does support chapter menus. But it will take some time until MrC will incorporate these new features into AVStoDVD, Quote:
-b:v 6050000 -maxrate:v 8500000 Quote:
There is a 1-pass VBR method which first does a couple of sample encodes (typically 5% to 10% of the source) to determine the compressibility. Then a CQ (Constant Quality) encode is performed using the quantizer which has been determined by the sample passes. The method was known under the name "Robshot Bach". If you succeed to fill the DVD using this method, then yes, the quality will be very close to a 2-pass VBR encode. The 1-pass VBR method used by FFMpeg is more like an Average Bitrate method. There are no sample passes. The encode starts with a certain quantizer, and then the quantizer is dynamically adjusted during the encode to achieve the desired bitrate. With this method the bitrate distribution will not be as good, but the method is much faster. HCenc uses a different 1-pass VBR method. Basically it works like a 2-pass method, but the first pass only encodes a percentage of the source, and the the compression curve which results from this first pass gets smoothed. Bitrate distribution will be less precise than a real 2-pass VBR. Cheers manolito Last edited by manolito; 19th January 2016 at 16:39. |
|||
![]() |
![]() |
![]() |
#9 | Link | |
Registered User
Join Date: Sep 2004
Posts: 29
|
Thanks for the explanation about VBR. I have been a bit confused by ffmpeg irc chan which were speaking of ABR(adaptive bitrate) and told me that VBR only mean that frame can have different bitrate. With your explanation I guess that a pure 2 pass VBR does a better balance with bitrate than the 1pass abr like the one defined with the CRF in X264 ?
Quote:
Last edited by thetrueavatar; 19th January 2016 at 17:28. |
|
![]() |
![]() |
![]() |
#10 | Link |
Registered User
Join Date: Mar 2004
Location: Italy
Posts: 948
|
Not sure if I properly understand your needs, but AFAIK AVStoDVD should be already able to produce a multipage menu for your case, with a little trick... If you cut your video asset (the movie, with well defined chapters) into individual chunks, then you may achieve the job, maybe. The production of the different "Titles" (whell, they are actually the original chapters, but let's call these pieces in this way) is easily feasible with Cuttermaran, for instance, or other video editing applications...
Once you have prepared the individual titles (audio+video), the current menuing features of AVStoDVD should allow you to create a first page menu containing the "PlayAll" button + the arrow button leading to the second page with 4 more titles + the arrow, and so on... Maybe... Last edited by Sir Didymus; 19th January 2016 at 19:53. |
![]() |
![]() |
![]() |
#12 | Link | |
Registered User
Join Date: Sep 2003
Location: Berlin, Germany
Posts: 3,113
|
Quote:
Glad you like DVDStyler, it does have a few rough edges, but for menu creation I think that it has just the right balance between power and ease of use. Cheers manolito |
|
![]() |
![]() |
![]() |
#13 | Link |
Registered User
Join Date: Sep 2004
Posts: 29
|
About your quantization matri I was wondering were does it comes from ? When we specify quantizer =2 does it mean that the while matrix is fille with 2 or is it a reference to a kind of matrix. Maybe silly question but I'm digging into the jpeg compression theory and I wasn't clear for me.
|
![]() |
![]() |
![]() |
#14 | Link |
Registered User
Join Date: Sep 2003
Location: Berlin, Germany
Posts: 3,113
|
You really need to do some reading to understand the basic concepts of video encoding. Some buzzwords are Discrete Cosine Transformation (DCT), Quantization and of course Quantization Matrices.
I found this old thread very helpful: http://forum.doom9.org/showthread.ph...91#post1465291 Specifying a quantizer value influences all frequencies the same way. With a Quantization Matrix the quantizer is modified depending on the frequency. This way it is possible for example to use a higher quantization for high frequencies (high detail, lots of movement) and a lower quantization for dark and static scenes. In such a matrix the lower frequencies are represented by the values on top and to the left, while the values at the bottom and to the right represent the higher frequencies. The HCenc PDF manual has a matrix section where you can see a lot of the popular MPEG2 matrices. If you do not specify a matrix for the encode, every encoder will use a default matrix, but this can be different for different encoders. FFMpeg uses the MPEG Standard matrix by default (the one where all non-intra coefficients are 16). This is a bad idea for DVD compliant encodes, the normal MPEG matrix (sometimes called MPEG Adapted) is a much better choice. Modern encoders like CCE or HCenc can adapt the matrix they use on the fly during the encode (in HCenc the parameter is called AQM). Some experts say that (at least for encoders which use an exponential quantizer scale like CCE or HC) the influence of custom quant matrices on the encoding quality is overrated. Please read the dispute between Dark Shikari and Manono in the old thread I linked to. Cheers manolito Last edited by manolito; 20th January 2016 at 14:30. |
![]() |
![]() |
![]() |
#15 | Link | |
Registered User
Join Date: Sep 2004
Posts: 29
|
Quote:
I'm must admit however that I have trouble to figure out what frequencies mean for a video while it was pretty obvious for me for an audio signal(high frequency=highpitched, low frequency=low pitched). I know the Shannon theorem which allow the decomposition of a signal in a linear sum of sinus but does represent the signal for a picture. Anyway I will try to read more to figure out. I'm interested in any pointer to documentation even with a lot of maths. Thanks a lot for the given information. Best Regards, Last edited by thetrueavatar; 20th January 2016 at 16:38. |
|
![]() |
![]() |
![]() |
#16 | Link | ||
Registered User
Join Date: Sep 2003
Location: Berlin, Germany
Posts: 3,113
|
Quote:
http://www.cs.cf.ac.uk/Dave/Multimed..._Transform.pdf After the conversion into the frequency domain the next step is the data reduction by quantization. First of all you specify an average quantizer value like 2, but the quantizer which is actually used is not the same for each frequency, it is calculated by using the matrix coefficients. If you use a matrix where all coefficients have the same value (like 8 or 16) then your given quantizer value of 2 would indeed influence all frequencies the same. Quote from Dark Shikari from the old thread I linked to above: Quote:
Have fun studying all that stuff... manolito Last edited by manolito; 21st January 2016 at 07:04. |
||
![]() |
![]() |
![]() |
#17 | Link |
Registered User
Join Date: Sep 2004
Posts: 29
|
Hello there,
I'm coming back to you for a little problem with dvdstyler. I don't know why but the menu encoding is quite crappy. I have used a custom image in 1080p as background but after menu creation we can barely read the text written on it... I have set the menu bitrate to the max 9K but it's still unreadable while I don't have the problem with nero... Any tought ? |
![]() |
![]() |
![]() |
#18 | Link |
Registered User
Join Date: Sep 2003
Location: Berlin, Germany
Posts: 3,113
|
In the DVDStyler forum I found several complaints about blurred background images. Have a look here:
https://sourceforge.net/p/dvdstyler/...read/8fee0457/ https://sourceforge.net/p/dvdstyler/...read/3f3e13d8/ Keep in mind that your HiRes image must be converted to the DVD supported SD size (720 x 480/576). When you compose your menu on a HiRes monitor using a HiRes background image, of course it will look much better than the final DVD. You probably should prepare your background image in the final SD resolution. Then you can play with different (larger) fonts and make it look as good as possible in this resolution. Cheers manolito |
![]() |
![]() |
![]() |
Thread Tools | Search this Thread |
Display Modes | |
|
|