[mythtv-users] Joining MP4s

James jam at tigger.ws
Fri Feb 3 07:36:07 UTC 2023



> On 2 Feb 2023, at 11:31 pm, John Pilkington <johnpilk222 at gmail.com> wrote:
> 
> On 31/01/2023 15:43, Peter Bennett wrote:
>> On 1/31/23 10:10, James wrote:
>>> I recorded a movie that I want to save. Due to the whims of the Australian Open my 20 min post record failed by 2 minutes. Playing Amazon Prime in a VM I screen captured the last 2 min of the movie..
>>> 
>>> I now have my movie-2min with commercials cut stored as a 'Movie' It plays perfectly.
>>> I have the last 2 minues as a clip. It too plays perfectly.
>>> 
>>> Each is 720x576 16:9 24.99 Hz. Both are h264 in a mp4 container. The OTA recordings are interlaced.
>>> 
>>> How on earth can I append the end.mp4?
>>> 
>>> I tried shotcut which re-rendered giving perfect video but lip sync of 500ms variable, with the end clip in sync
>>> I tried mythffmpeg which muddled everything ie repeated sections general chaos
>>> 
>>> mythffmpeg -f concat -safe 0 -i /store/TScut_work/file -c copy /store/Movies/Myth-V/Thur\ Vow.mp4
>>> 
>>> Any experts with handbrake et al
>>> 
>>> Of interest *some* OTA 720 and 1080 videos maintain lip sync, some do not. I've not looked why I occasionally shotcut a snip to put the MOV atom at the front of the file for downloads.
>>> 
>>> EG http://tigger.ws/downloads/qna.mp4
>>> 
>>> James
>>> _______________________________________________
>> I use mkvmerge, which can split and append, as long as the parts use the same tracks, resolution, etc. It reads any type of input and creates an mkv file. mkv files can be played by most players including mythtv. You can also adjust the audio sync if necessary. I have used it for editing out the commercials in a show, by splitting and joining parts.
>> Peter
> 
> Going back in this thread:  this was the bit of the issue #600 text I was pointing to
> 
> {{{
> 
> ----Segments are  (cat seglist_184524)
> 
> file /var/RSG4/TScut_work/20055_20220702074100_184524_001.ts
> file /var/RSG4/TScut_work/20055_20220702074100_184524_002.ts
> file /var/RSG4/TScut_work/20055_20220702074100_184524_003.ts
> 
> File segments have been written, Concatenating.
> 
> ionice -c3 mythffmpeg -hide_banner -ignore_unknown -fflags +genpts -f concat -safe 0 -i seglist_184524 -c copy /mnt/sdb1/Vids/20055_20220702074100_184524.ts
> Output file is /home/john/SGs/RecsSG3/20055_20220702074100.ts
> 
> I think the essential difference from the raw recording format is ' fflags +genpts '
> 
> }}}
> 
> The list of segments would now be your two segments, in the 'file' format as shown, and in a filename replacing the 'seglistxxxx' above, and with the output file_name_conforming_to_your_system.mp4.  It might work, if you can get the input segments compatible  :-)

In a roundabout way you have totally solved my problem.
I wax lyrical incase it helps someone else:

Adding my end segment with your flags shows the error

[mpegts @ 0x895880] Non-monotonous DTS in output stream 0:1; previous: 425255154, current: 241752704; changing to 425255155. This may result in incorrect timestamps in the output file.

And the resultant file is AFU in the extreme. A 2 hour file becomes 4 hours long. vlc plays but wont skip forward, then plays segments out of order.

Combining .ts not .mp4 segments results in perfect lip sync in shotcut
Adding my end segment and telling shotcut to transcode and create an mp4 (that is how it works) results in an output with perfect lip sync, end properly appended that plays with VLC and mythfrontend

James



More information about the mythtv-users mailing list