[mythtv-users] concatenating recordings?

John Pilkington J.Pilk at tesco.net
Fri Oct 28 19:46:27 UTC 2011

On 28/10/11 19:10, John Pilkington wrote:
> On 28/10/11 18:45, Simon Hobson wrote:
>> I may be missing something big here, and be on completely the wrong tack ...
>> I was under the impression that a recording (at least for those of us
>> using DVB) is simply a capture of a broadcast bitstream over a
>> period. Thus concatenating two recordings ought to be just a matter
>> of joining the two files together :
>> cat file1 file2>   bigfile
>> I'd imagine worst case is there's something on the front of the file,
>> and so you'd have a bit in the middle that wasn't a valid stream.
>> Since the decoder has to cope with dropouts and serious errors, it
>> ought to be able to cope and pick up at the next key frame - ie it
>> would treat the bit at the join as just a burst of transmission noise.
>> Or have I missed something ?
> I've tried cat approach (for dvb-t) but when I then processed it with
> project-x I got the first part only back because of timestamp
> incompatibility.  Project-x will demux and concatenate properly and I've
> sometimes used a custom-tweaked derivative of mythcutprojectx to do the
> job, and just drop the new file back in place of the first segment.
> That gets the right file size into the DB too.   mythtranscode --mpeg2
> alone doesn't do that; I haven't tried commflag --rebuild recently.  But
> the script does it by direct insertion into the DB; is there a better way?
> John P

The sequence to do this is essentially, from the directory holding the 
recordings, and using the ionice -c3 prefix to reduce system impact:
  ionice -c3 java -jar ~/projectx -name tempmerge  infile1.mpg 
infile2.mpg infile3.mpg       # demux in sequence, as many as needed.

  mv infile1.mpg infile1.mpg.old                 # rename first 
recording to stop it being overwritten

  ionice -c3  mplex -o infile1.mpg -V -f 9 tempmerge.m2v tempmerge.mp2 
       # remux to get the concatenated output (as infile1.mpg) !!

This assumes all the input files are compatible and perhaps that they 
have only one audio track, here assumed to be mp2

Then do the rebuild seek table thing, reset file size, run mythpreviewgen.

Needs java, projectx, mplex (from mjpegtools).

Maybe that would help someone!

John P

More information about the mythtv-users mailing list