View unanswered posts    View active topics

All times are UTC - 6 hours





Post new topic Reply to topic  [ 15 posts ] 
Print view Previous topic   Next topic  
Author Message
Search for:
PostPosted: Wed Nov 30, 2005 11:45 am 
Offline
Joined: Wed Apr 20, 2005 7:50 pm
Posts: 35
Location: Germany
I noticed that newer version of mythburn are able to shrink a movie in order to fit a DVD, using tcrequant. Very fine, good idea, but is itpossible to calculate the requant factor after cutting the movie and not before?
I have commercials in nearly all of my recorded shows and there is always a lot of space left on the DVD cause commercials are not included in the calculation of the requantization factor.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 30, 2005 9:38 pm 
Offline
Joined: Tue Oct 25, 2005 9:23 pm
Posts: 3
I was struggling with the same problem. The only way I know of to get around this is to manually edit the mythtvburn script. I came up with a quick hack to do this. (note: Always make sure you back up the original script before editing it. You'll be glad you did if you really mess it up and don't know how to fix it.)

Disclaimer: You will be editing your main mythburn script to fix this, do so at your own risk. In the root of your mythburn directory (for me its /myth/mythburn/mythburn) you'll find the mythtvburn.sh script. This is what you'll have to edit. Here's a file of the diff results between my code and the original.

Code:
189d188
< idx=0
199,204d197
< if [ "${cutflags[$idx]}" == "cut" ];
< then
<       reduce=.70
<       size=`perl -e "printf \"%d\", $size * $reduce;"`
<       echo "Cutlist assumed to reduce size by $reduce"
< fi
206d198
< idx=$((idx+1))


In short, code is only being inserted, but in 3 different locations (although their all close to one another).

It seems lately that most television shows contain about 25% commercials and thats not even including opening or closing credits. I find that by the time burning and everything else is done, I can get away with using a value of .7 for 'reduce' and just about maximize usage of a DVD. If you want to be more conservative you could use .75 or something even higher. If you record something off of a comercial free station and then use a cutlist to trim the beginning and end of the show, you'll definately need a value close 1.0. If you don't use a cutlist, this won't interfere.

Like I said, its a quick hack. It would be possible to do this more precisely, but its not easy since this is done early in the dvd creation process and the cutlist has not been fetched yet. Hopefully this functionality will be added to the script soon.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 01, 2005 7:46 am 
Offline
Joined: Wed Apr 20, 2005 7:50 pm
Posts: 35
Location: Germany
Thanks for posting your solution. Seems to be very usable. I'll try it out, soon.
But I hope too, that there will be a solution, which calculates the exakt value for the requantisation factor.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 01, 2005 9:57 pm 
Offline
Joined: Thu Mar 25, 2004 11:00 am
Posts: 9551
Location: Arlington, MA
Shouildn't be that hard. Query the DB to get the start and end marks and the cut list then do a little math...


Top
 Profile  
 
 Post subject:
PostPosted: Sun Dec 04, 2005 8:17 pm 
Offline
Joined: Sun Oct 16, 2005 9:24 pm
Posts: 61
Sorry, I must be missing something here as to why the original file size has to be used to calculate the tcrequant factor. I'm no programmer, but couldn't you get the final file size from processing output written to the mythburn.log? From my reading of the mythburn.log file, it's quite clear what the final file size is AFTER the commercial cuts are applied, and the tcrequant program does not run until after all this happens. At least it would be a better estimate that just using the original file size or just guessing. As it stands now, the factor used by tcrequant is not good anyway; WITHOUT applying the commercial cuts, a four hour movie, which ended up as an 8.811GB file, was turned into a 4.739GB .iso file, which is too big to fit on a DVD-R. (By the way, all the file sizes reported above are the sizes reported in the mythburn.log converted from bytes to GB.)

Here are the sections of the mythburn.log file that I'm referring to:

From the 8.811GB file that DID have the commercial cuts applied:

Code:
---> new File: ./1068_20051126190000_20051126230000.mpa



summary of created media files:

.Video (m2v):   303433 Frames   02:48:44.540      './1068_20051126190000_20051126230000.m2v'

Audio 0 (mp2):   421856 Frames   02:48:44.544   0/0/0/4   './1068_20051126190000_20051126230000.mpa'

=> 6159417908 bytes written...
Requantizing with factor 2.078605 to fit onto DVD
/usr/local/bin/tcrequant -i 1068_20051126190000_20051126230000.m2v.big -o 1068_20051126190000_20051126230000.m2v -d 2 -f 2.078605
[tcrequant] MPEG2 Requantiser by Makira.
[tcrequant] Using 2.078605 as factor.


The final .iso file that was created was only 3.268GB. The factor of 2.078605 was calculated from the original file size of 8.811GB. If 6.159GB had been used as the original file size, then a much more accurate factor would have resulted.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 08, 2005 8:19 am 
Offline
Joined: Wed Apr 20, 2005 7:50 pm
Posts: 35
Location: Germany
hmm good point. It should be possible to do it this way.
If I have a bit of free time I'll try to implement it.
Shouldn't be too hard


Top
 Profile  
 
 Post subject:
PostPosted: Mon Dec 12, 2005 9:06 am 
Offline
Joined: Fri Dec 09, 2005 12:10 pm
Posts: 5
Actually, getting the size after the fact doesn't seem to work quite as well. Because it seems that you need to do the tcrequant midstream, after the commericial cut, and before the mplex. I'm not sure why exactly, since what I know has come only from experimentation, and in this case experiments take a long while, but it seems like doing projectx for cuts, and then mplex to recombine, and then mpeg2desc to separate again for tcrequant, and then mplex to recombine seems to not agree with the stream and causes some problems when trying to create menus.

My solution was to create a "first" pass that calculates the sizes by looking at each file, and if there's a cut list, it applies the cutlist via projectx, and once it gets the size, it throws the separated streams away. For a 1.2 GB (1/2 hr show), this added about 2 minutes, so for a 7 show disc, this would add roughly 15 minutes to the mythburn process.

I also had to build in an additional fudge factor, as it seems that the mythburn authors assumption of 1.05 was not quite great enough when generating several small shows. So, I added a clause that would add in an additional 1% of requant required for each show (so, for 7 shows, the "total size" would be increased by 1.07). This seems to allow the disc to stay below 4450. Using his formula, if I tried to process 9 1/2 hour shows, my disc iso image was coming out ~ 5,000,000,000 +/- 1/2%. Too big.

If people are interested, I can post the patches I made to get my mythburn to work with multiple shows and using projectx cutlist processing.

This patch will have stuff applied to work with the 0.90.2 project-X, so it will either need to be back-leveled for the 0.82.x project-x, or people will need to to upgrade to 0.90.2.

Also, if others have more insight into the whole burn process, I would love to hear it. I'm not familiar with the technical details of the individual components, so when I ran into difficulties, I just figured out an unobtrusive way to make it work, without having to "get into the guts" of reworking the scripts.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 13, 2005 5:24 am 
Offline
Joined: Wed Apr 20, 2005 7:50 pm
Posts: 35
Location: Germany
mgpaulus wrote:
If people are interested, I can post the patches I made to get my mythburn to work with multiple shows and using projectx cutlist processing.


Sure I'm interested. I think it would be the best to post the changes in this thread, so everbody who wants to use your modifications can change their script. Or a link to your mythtvburn.sh if you have a bit webspace available.

TIA


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 15, 2005 3:45 pm 
Offline
Joined: Fri Dec 09, 2005 12:10 pm
Posts: 5
Ok, I posted my patch to more closely calculate the size of programs under the patches subsection on the sourceforge site:

http://www.sourceforge.net/projects/mythburn


Top
 Profile  
 
PostPosted: Wed Dec 21, 2005 4:29 am 
Offline
Joined: Mon Nov 29, 2004 7:59 am
Posts: 25
Location: Hoogland, The Netherlands
Hi all,

dowloaded the patch, but results in a slightly too large image
builtin_dd of=/dev/dvd obs=32k seek=0'
:-( /dev/dvd: 2295104 blocks are free, 2333489 to be written
the iso is
4778985472 Dec 21 11:21 mythburndvd.iso and doesn't fit
This is from 2 nuv files with not much to cut


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 21, 2005 8:34 am 
Offline
Joined: Wed Apr 20, 2005 7:50 pm
Posts: 35
Location: Germany
I downloaded the patch too, thx for publishing.
I suppose that the calculation is correct, but tcrequant is not able to compress to any size. I selected 10 files to burn to DVD and the resulting Isofile was about 5.9 Gb. So I looked at the Logfile and the result should only have 4 GB. The 700 hundred megs are for the menu and a little reserve I think.


Top
 Profile  
 
PostPosted: Fri Dec 23, 2005 4:00 pm 
Offline
Joined: Wed Nov 09, 2005 1:21 pm
Posts: 161
Location: Manchester UK
Hi everyone,

bube wrote:
I noticed that newer version of mythburn are able to shrink a movie in order to fit a DVD, using tcrequant. Very fine, good idea, but is itpossible to calculate the requant factor after cutting the movie and not before?
I have commercials in nearly all of my recorded shows and there is always a lot of space left on the DVD cause commercials are not included in the calculation of the requantization factor.


Had noticed this shortfall in the burn script, i posted a couple of sugestions on calculating the requantisation faction. using a flat recalculation factor wont work efficiently. ie saying all programs hat 25% adverts etc I have sone programs with almost no adverts and some with 50%.

The problem is the reqantization is done one file at a time at the multiplex time. you can calculate the target size of each program its quite easy and ive managed to do this in access. but trying to do this is beyond me in bash. it would mean accessing the cutlist field in the recorded table calculating the number of frames to be droped not too difficult as cutlist easily lends itself to this, then devide this by 50 or (60 for Ntsc recordings) this gives you the number of seconds to be droped. you then need to calculate the total length in sec by taking starttime from endtime in secs. the rest of the calculation is easy. but as i say the database side is beyond me in bash.

I have thought of a simple cludge which should be easy? although far from perfect. it would involve a 'simple edit' to mpeg2cut-px.sh, basicly my plan is simple! The mythtvburn.sh script still calculates the requadrant factor (for the whole project) and if there is a cut-list mpeg2cut-px.sh is called. then after the cutlist is applied we calculate the new size and divide it by the origonal size then adjust the requadrent factor by this sqewing factor.

I have identified the bit of the script that needs to be altered here

Code:
if [ "$factor" != "0" ]
then
   mv ${base}.m2v ${base}.m2v.big
   echo "Requantizing with factor $factor to fit onto DVD";
   echo "${tcrequant} -i ${base}.m2v.big -o ${base}.m2v -d 2 -f $factor"
   nice -n 19 ${tcrequant} -i ${base}.m2v.big -o ${base}.m2v -d 2 -f $factor
   rm ${base}.m2v.big
fi


basicly we need to do something like

factor = factor * sizeof(${base}.*)/sizeof(${file}) before this section

and the if then statement changing to if $factor>1 then

sorry not written any bash before so am struggling with the coding

have found how to do sizeof thing

Code:
sizeof=`ls -s --size --block-size=M "$file" | cut --delimiter=M --fields=1`


anyhow i will try to write the bash for this after a little trying will post if i figure it out !!


Meanwhile i have rewritten the php for the mythburn to include either DVD5 & DVD9 and no requadrenting. got all the php to work including saving defaults to the xml file :P i then altered the mythtvburn.sh using my windows box and a samba share (probably a big mistake) because it now wont run. comes back with either permission denied or file not found when trying to run the script. messed arround with chown and chmod but cant get it to go please tel me how to set the permisions to get a script to run :(

Also i assume there is a way of genneration diff files so i can share my alterations, info would also be helfull. the problem I have is all my alterations are done remote through a samba share as i dont have easy access to my mythbox.

think this is a gr8 piece of software good work all

_________________
Running:-
Intel 930 3GHz dual Core
Thermaltake Fanless CPU Cooler
Asus P5GS
Samsung 750G Sata HDD
8400 512m Video Card
2 * jetway DVB-t
1 * Haupage DVB-S2 Card
Samsung Sata 16x DVDRW
2048M Ram
1 * Netop Ion 330


Top
 Profile  
 
 Post subject: Redone mythburn script
PostPosted: Fri Dec 30, 2005 6:40 am 
Offline
Joined: Wed Nov 09, 2005 1:21 pm
Posts: 161
Location: Manchester UK
Hi everyone

Finaly got my adjusted myhttvburn.sh to work. once i had edited it with wordpad on my samba share and it didnt work so i reinstalled and used linux editor. Anyhow my web page & new script allows you to turn off requadrent or set it for dvd5 or dvd9.

I will try to do the same for the requadrant script over the new year still could do with knowing how to publish the work so far.

_________________
Running:-
Intel 930 3GHz dual Core
Thermaltake Fanless CPU Cooler
Asus P5GS
Samsung 750G Sata HDD
8400 512m Video Card
2 * jetway DVB-t
1 * Haupage DVB-S2 Card
Samsung Sata 16x DVDRW
2048M Ram
1 * Netop Ion 330


Top
 Profile  
 
PostPosted: Sat Dec 31, 2005 9:31 am 
Offline
Joined: Wed Nov 09, 2005 1:21 pm
Posts: 161
Location: Manchester UK
Hi these script changes will allow you to select either dvd5 dvd9 or unrequantised using mythweb burn

Code:
> diff /myth/mythburn/mythburn/mythtvburn.sh  /myth/mythburn/mythtvburn.sh
109a110,128
> # added by simon flanagan to give dvd9 options
>
>
> targetsize=$1
> shift
> # default size big enough so ne requadrant takesplace
>
> targetsz=200000;
>
>
> if [ "$targetsize" == "DVD5" ];
> then
>    targetsz=4300;
> fi
>
> if [ "$targetsize" == "DVD9" ];
> then
>    targetsz=8600;
> fi
125a145
> echo Target size         = $targetsz
211c231
< if [[ $filesize -gt 4450 ]];
---
> if [[ $filesize -gt $targetsz ]];
213c233
< factor=`perl -e "printf \"%f\", $filesize / 4300;"`
---
> factor=`perl -e "printf \"%f\", $filesize / $targetsz;"`
396c416,417
< echo "<video format='$videoformat' aspect='4:3' />"  >> $myxml
---
> #echo "<video format='$videoformat' aspect='4:3' />"  >> $myxml
> echo "<video format='$videoformat' />"  >> $myxml




Code:
> diff -b -B --speed-large-files  /myth/mythburn/mythwebburn/mythtvburndvd_confirm.php.old /myth/mythburn/mythwebburn/mythtvburndvd_confirm.php
37a38,39
>    $targetsize_default = '';
>
53a56,57
>    $targetsize_default = $vals[$index['TARGETSIZE'][0]]['value'];
>



Code:
> diff -b -B --speed-large-files  /myth/mythburn/mythburn/mythwebburn/mythtvburndvd_createdvd.php /myth/mythburn/mythwebburn/mythtvburndvd_createdvd.php
54a55,67
> // Added by S Flanagan 22 DEC 2005
> //
>
>
>
>    if (isset($_GET['targetsize'])) {
>    $targetsize=$_GET['targetsize']; }
>    else {
>    $targetsize="none"; }
>
>
>
>
111a125
>    '<targetsize>'.$targetsize.'</targetsize>'.
128a143
>          escapeshellarg($targetsize).' '.



Code:
> diff -b -B --speed-large-files  /myth/mythburn/mythburn/mythwebburn/themes/Default/mythtvburndvd_confirm.php /myth/mythburn/mythwebburn/themes/Default/mythtvburndvd_confirm.php
30a31
>         global $targetsize_default;
91,92c92
< <input <?php if ($filenames[$i] === $highlight_default) echo 'checked="true"'; ?> type="radio" name="highlightimage" value="<?php echo $filenames[$i]; ?>">
< <small><?php echo $filenames[$i]; ?></small>
---
> <input <?php if ($filenames[$i] === $highlight_default) echo 'checked="true"'; ?> type="radio" name="highlightimage" value="<?php echo $filenames[$i]; ?>"><small><?php echo $filenames[$i]; ?></small>
127,128c127
< <input <?php if ($filenames[$i] ===  $music_default) echo 'checked="true"'; ?> type="radio" name="backgroundmusic" value="<?php echo $filenames[$i]; ?>">
< <small><?php echo $filenames[$i]; ?></small>
---
> <input <?php if ($filenames[$i] ===  $music_default) echo 'checked="true"'; ?> type="radio" name="backgroundmusic" value="<?php echo $filenames[$i]; ?>"><small><?php echo $filenames[$i]; ?></small>
163a163,170
> <td colspan="1" align="right">Requadrant to fit</td>
> <td colspan="2"><SELECT name="targetsize">
> <OPTION <?php if ($targetsize_default==='none') echo 'SELECTED' ?>>none</OPTION>
> <OPTION <?php if ($targetsize_default==='DVD5') echo 'SELECTED' ?>>DVD5</OPTION>
> <OPTION <?php if ($targetsize_default==='DVD9') echo 'SELECTED' ?>>DVD9</OPTION></SELECT></td>
> </tr>
>
> <tr class="menu">


I hope this is usefull to some of you it allows me to turn off resizeing when i need then i can use dvdshrink to resize the final output

_________________
Running:-
Intel 930 3GHz dual Core
Thermaltake Fanless CPU Cooler
Asus P5GS
Samsung 750G Sata HDD
8400 512m Video Card
2 * jetway DVB-t
1 * Haupage DVB-S2 Card
Samsung Sata 16x DVDRW
2048M Ram
1 * Netop Ion 330


Top
 Profile  
 
 Post subject: Question
PostPosted: Sun Feb 12, 2006 3:26 pm 
Offline
Joined: Sun Jan 29, 2006 1:50 pm
Posts: 14
Location: Franklin, MA
Can anyone tell me if this change will be available if I update mythburn from CVS? I have Mythburn working exactly as I want it with the exception of this issue, and I am really apprehensive to edit the script myself.

_________________
PVR 150 MCE
Dell 4100 / P3 933
256 meg RAM


Top
 Profile  
 

Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 15 posts ] 


All times are UTC - 6 hours




Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group

Theme Created By ceyhansuyu