Author Topic: Appending several files doesn't work  (Read 460 times)

tom1632

  • Newbie
  • *
  • Posts: 16
Appending several files doesn't work
« on: June 16, 2018, 02:25:58 PM »
Hi,

I have several files which are serially numbered at the end: file-001.ts, file-002.ts, file-003.ts,....
In the past when I opened the first file I was asked if all these files should be opened and appended automatically.  Now just the first file will be opened and I have to append each single file manually which is quite time consuming. What can I do to get back the original behavior? I'm working with avidemux 2.7.1 and Ubuntu 18.04 - 64bit.

Thanks, Thomas

eumagga0x2a

  • Hero Member
  • *****
  • Posts: 2269
Re: Appending several files doesn't work
« Reply #1 on: June 16, 2018, 02:57:20 PM »
I have several files which are serially numbered at the end: file-001.ts, file-002.ts, file-003.ts,....
In the past when I opened the first file I was asked if all these files should be opened and appended automatically.

There are two ways to append sequential files, both very similar from the user perspective but fundamentally different in the implementation: auto-append in the demuxer and (manual) append in the editor. The former is mandatory for DVD video, the latter should be used for everything else. The auto-append for TS in the MpegTS demuxer didn't work right and was disabled for good.

Quote
Now just the first file will be opened and I have to append each single file manually which is quite time consuming.

Just select all files you are going to append and drag'n'drop them onto the Avidemux window in one go.

Quote
What can I do to get back the original behavior?

Replace #if 0 at https://github.com/mean00/avidemux2/blob/master/avidemux_plugins/ADM_demuxers/MpegTS/ADM_tsIndex.h#L47 with #if 1 and rebuild Avidemux.

But unless your TS files are fragments of a single stream (like VOBs on a video DVD), you will see that the feature is broken and thus unusable. If you could contribute a patch implementing a reliable detection of different streams vs. fragments of a single stream, you could have the best of both worlds :-)

tom1632

  • Newbie
  • *
  • Posts: 16
Re: Appending several files doesn't work
« Reply #2 on: June 18, 2018, 07:53:11 PM »
Many thanks for the fast reply. Drag&Drop works fine. In fact my ts-files are fragments of a single stream. Therefore I never had to face the problems you mentioned. But now I understand that auto-append was disabled.

Best regards, Thomas

eumagga0x2a

  • Hero Member
  • *****
  • Posts: 2269
Re: Appending several files doesn't work
« Reply #3 on: June 18, 2018, 09:13:07 PM »
In fact my ts-files are fragments of a single stream.

How do you know? Did they originate from an action cam like a GoPro, automatically split at 1GiB boundary? If concatenating the files like

Code: [Select]
cat file01.ts file02.ts file03.ts > appended.ts
and loading appended.ts in Avidemux results in a video of correct duration (not the duration of the last file but the sum of durations of the fragments), then they are indeed parts of a single stream.

tom1632

  • Newbie
  • *
  • Posts: 16
Re: Appending several files doesn't work
« Reply #4 on: June 20, 2018, 06:54:20 PM »
Well, my TS files come from a single source which cuts the video stream into 1 GB blocks. I'm very confident about this. I carried out your suggested test and the duration of append.ts is exactly the sum of the durations of each single fragment.

eumagga0x2a

  • Hero Member
  • *****
  • Posts: 2269
Re: Appending several files doesn't work
« Reply #5 on: June 20, 2018, 09:28:45 PM »
Are the blocks exactly 1GiB (1.073.741.824 bytes) in size? If they are, this could be used as an indication that we should use binary append in the demuxer.

eumagga0x2a

  • Hero Member
  • *****
  • Posts: 2269
Re: Appending several files doesn't work
« Reply #6 on: June 22, 2018, 09:28:05 PM »
I don't want to conceal that an answer to the question posed above would be highly appreciated.

tom1632

  • Newbie
  • *
  • Posts: 16
Re: Appending several files doesn't work
« Reply #7 on: June 23, 2018, 08:40:45 AM »
Sorry. I haven't forgotten but the the last days were very busy. The TS files (except the last one from each recording of course) have a size of 1.078.067.200 bytes. If you need any further information please ask.

eumagga0x2a

  • Hero Member
  • *****
  • Posts: 2269
Re: Appending several files doesn't work
« Reply #8 on: June 23, 2018, 10:52:37 AM »
Thank you. It means, an easy heuristic to detect whether we should use binary append is not viable.