View unanswered posts    View active topics

All times are UTC - 6 hours





Post new topic Reply to topic  [ 3 posts ] 
Print view Previous topic   Next topic  
Author Message
Search for:
PostPosted: Fri Apr 02, 2010 1:21 pm 
Offline
Joined: Fri Sep 15, 2006 12:16 pm
Posts: 292
EDIT1: Changed -bufsize from 1854k to 1835k for better tcrequant compatibility.

EDIT2 (final): Added "-strict 2" to get the tcrequant'ed set of video files to fit the dvd. Changed -bufsize to the exact value 1835008

The problem: You are trying to burn a DVD from a series of recordings. You are using the cutlist to skip the commercials in the DVD. The DVD creation fails with the following errors...

Errors are:
Quote:
ERROR: Failed while running dvdauthor. Result: 1
in the log viewer (/myth/tmp/logs/progress.log)

and these errors:
Quote:
++ WARN: [mplex] Stream e0: data will arrive too late sent(SCR)=156583497 required(DTS)=156583433
(SCR and DTS numbers vary)
...
**ERROR: [mplex] Too many frame drops -exiting
...
ERR: Cannot jump to chapter 8 of title 1, only 7 exist
(generally "Cannot jump to chapter X of title Y, only X-1 exist")
in /myth/tmp/logs/mythburn.log

I have fought this problem for years, it only happens on some recordings, and seems to only happen if you use the cutlist?

The reason: ffmpeg spikes the data rate too high for DVD during VBR encoding. This is due to glitches in the recording or lots of video motion.

The fix: Edit the python script to fix the way ffmpeg is called.

How:

Become superuser:
Code:
sudo su
(enter admin password)

Go to the directory where the python script resides and back it up for a fallback
Code:
cd /usr/share/mythtv/mytharchive/scripts
cp -a mythburn.py mythburn.py.original


Edit the python script (use whatever editor you like, I show nano here for ease of use):
Code:
nano mythburn.py

use Ctrl-W to search for
Code:
command += "-qmin
The full line you are looking for is
Code:
command += "-qmin %s -qmax %s -qdiff %s " % (qmin, qmax, qdiff)


Add this new line after the line you found
Code:
command += "-maxrate 9200000 -bufsize 1835008 -strict 2 "
Use spaces, not tabs, to space out and exactly match the indentation of the command += "-qmin line. Note there is a space after the 2 and before the "
Exit and save from nano.
Done.

A final hint:
I have found that adding a small cut (cut list entry) at the very beginning of a recording will help sometimes if you are burning with cutlists and have problems.

Technical details for the curious or programming inclined:
1 - mythtranscode reads the recording, strips the commercials, pipes the data to ffmpeg which creates the normal file newfile2.mpg at the recording profile compression ratio you wanted (SP, LP, etc.)
2 - mythreplex -demux reads newfile2.mpg and writes stream.mv2 and stream0.ac3 in case the audio needs to be converted (like to ac3) or the video further compressed (won't fit on DVD at the recording profile you asked for). A different set of these files exists for each recording to be put on the DVD.
3 - audio is converted to ac3 if needed?
4 - menus are created
5 - tcrequant is called to further compress stream.mv2 if calculation shows it won't fit on the DVD
6 - mplex is called to convert the stream.mv2 and stream0.ac3 into final.mpg. It also adds a sync offset if the video and audio are out of sync.
7 - dvdauthor is called to read the multiple final.mpg's and create a video DVD directory structure
8 - an ISO file is created from the DVD directory structure if you have this enabled. I am guessing it uses mkisofs.
9 - growisofs is used to burn the DVD from the DVD directory structure if you have this enabled.

The problem happens when there is a glitch or very high motion in the original recording. ffmpeg creates a newfile2.mpg with a very high data rate in just a few isolated places. Later, mplex starts dropping frames (one of the error messagtes) in these places because it knows the DVD can't keep up with the high data rate. When mplex hits 10 dropped frames, it gives up and exits (one of the error messages). If the final.mpg is less than 7/8ths complete, dvdauthor will not be able to generate a chapter picture from it and dvdauthor will fail, aborting the whole process. If more than 7/8ths done I will guess that the process completes without error, but you are missing the tail of that recording on the DVD. The 7/8ths discussed above comes from the 8 chapters. If you are using a simpler DVD menu style that has say 4 chapters it will be 3/4ths. If your DVD menu style does not have chapters, I am guessing that no matter how bad mplex fails, dvdauthor will succeed and you will get a DVD burned, but the recordings will be chopped off.

Please reply to this post if you are having this problem. Thanks.

Whew!!!

Cliff


Last edited by cliffsjunk on Thu Apr 08, 2010 9:32 am, edited 1 time in total.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Apr 03, 2010 9:24 am 
Offline
Joined: Fri Sep 15, 2006 12:16 pm
Posts: 292
EDIT1: Notes regarding change.

Changed -bufsize from 1854k to 1835k for better tcrequant compatibility. I.e. if you have too much video for the selected recording profile Mytharchive will shrink it to fit the DVD after the encode when it sees that it is too big. Sometimes it STILL wouldn't fit the DVD after the tcrequant. Still researching this.

http://www.mpeg.org/MPEG/DVD/Book_B/Video.html said use 1854k (1.8535008 mbits, sounds like they meant 1.835008) for DVD compatibility, but other posts on the web said 1835k. When using 1854k I found that if you selected an encoding profile that would not allow all your video to fit on a DVD (and thus it had to use tcrequant to get it to fit) that it wouldn't fit on the DVD even after the tcrequant. 1835k seems to allow it to fit better. The numbers don't add up for it to be a k=1000 vs. k=1024 issue.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 08, 2010 9:41 am 
Offline
Joined: Fri Sep 15, 2006 12:16 pm
Posts: 292
EDIT2: Notes regarding change.

Finished research. File set still would not fit the dvd after tcrequant which is supposed to shrink them so they WOULD fit. Found another frontend to ffmpeg that worked around ffmpeg's disregarding of the limits specified in the command line. This frontend used "-strict 2". That fixed the "won't fit the dvd even after shrinking with tcrequant" problem.

The page where I got the -bufsize setting (VBV) from on mpeg.org is wrong. The correct value is 1835008 which I now have entered exactly.

Changed -maxrate from 9300k to 9200k for a little more head room.

Some settings were not initialized by ffmpeg because mythburn.py does not do a "-target dvd" in the ffmpeg command line. The full addition that I use personally is:
Code:
command += "-maxrate 9200000 -bufsize 1835008 -muxrate 10080000 -packetsize 2048 -strict 2 "
more for aesthetic reasons than anything else. The line in the main article is the minimum necessary addition.

This should be the last change.

Cliff


Top
 Profile  
 

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


All times are UTC - 6 hours




Who is online

Users browsing this forum: No registered users and 1 guest


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