Avidemux 2.7.8 increasing file size even in copy mode

Started by GreenDevil, November 14, 2021, 09:54:34 PM

Previous topic - Next topic

GreenDevil

Dear all,

at first a big thanks to the developer for making avidemux available free of charge!

I am not a regular user, but from time to time enjoy being able to quickly cut a few videos and remove unnecessary parts.

However, today I encountered a problem, or at least something which I don't understand. I had recorded a TV program in .ts format. I opened the file in avidemux and cut some passages, then saved the result. The result was bigger than expected, so I became curious and conducted a very simple test:

I opened the same file, did not edit it in any way, and saved it again. The file size grew from 4.13 GB (original file) to 4.40 GB (saved file). Could anybody please explain that?

Notes:

I had chosen "Video Output: Copy", "Audio Output: Copy" and "Output Format: Mpeg TS Muxer (ff)" in both cases. I don't understand how the file size can increase by nearly 8% when I literally copy the audio and video streams.

There is an additional understanding problem at my side. The TS muxer can be configured to use VBR or a constant bit rate. What does that mean? From what I have understood, muxing is the process of "interleaving" audio and video packets / streams, where the streams' bit rate is not altered any more (this might have happened in an earlier stage, though).

I have verified that turning off VBR and using high bit rates in the TS muxer configuration leads to very large files whose size seems to be proportional to the bit rate. Could anybody explain what a "muxing bitrate" is?

To summarize, I've got the following two questions:

1) Why does the file size increase if I load a .ts file and save it again without having changed it and with audio and video set to "Copy", and how can I prevent its growth?

2) What is the "muxing" bitrate in the TS muxer's configuration?

Thank you very much in advance!

eumagga0x2a

#1
Quote from: GreenDevil on November 14, 2021, 09:54:34 PMI opened the same file, did not edit it in any way, and saved it again. The file size grew from 4.13 GB (original file) to 4.40 GB (saved file). Could anybody please explain that?

To determine the exact reason, it would be necessary to have a look at a sample of the original stream. It is possible that the source omitted some structures of the stream which usually should be present and get recreated by the libavformat-based MPEG-TS muxer in Avidemux.

In general, depending on use case, a MPEG transport stream (MPEG-TS) needs to keep bitrate constant. This is achieved by padding the stream with empty filler packets. Unless you plan to stream the file over a fixed-bandwidth medium, you should either keep VBR mode of the MPEG-TS muxer enabled or export it to a format with less overhead like MP4 or MKV straight away. Avidemux drops subtitles and all other types of streams other than video and audio anyway.

GreenDevil

Thank you very much for your answer!

I forgot to mention that I had already tried other formats like MP4 and MKV. In every case, the file size grew significantly. With MKV output format, it even grew much more than with TS.

I believe I shouldn't steal your time any more, because you already have explained possible reasons and it's not the fault of avidemux. However, if you're interested in having a look at that file, I'll upload it somewhere and let you know the link via PM (it is a recording of a TV program, and I am bit hesitant to provide it publicly, because this would be a copyright infringement).

GreenDevil

One more thing: I have made the recording with DVBViewer Pro. Perhaps somebody can confirm or deny that this software, when recording, produces TS streams with some data / structures omitted.

eumagga0x2a

Quote from: GreenDevil on November 15, 2021, 06:19:52 PMI forgot to mention that I had already tried other formats like MP4 and MKV. In every case, the file size grew significantly. With MKV output format, it even grew much more than with TS.

I cannot think of any reason for that other than you actually re-encode rather than use copy mode for all streams. Please post textual output of MediaInfo for the source file and the output.

Quote from: GreenDevil on November 15, 2021, 06:19:52 PMHowever, if you're interested in having a look at that file, I'll upload it somewhere and let you know the link via PM

I'd like to have a look at MediaInfo analysis first. If it doesn't immediately clarify the situation, then yes, please upload the first ~200 MiB of the file cut by a tool which simply cuts at the basic file level without caring about contents like head or dd on *nix operating systems to WeTranfer, Mega, Dropbox or Google Drive and send me a link via PM.

If the problem applies to all recordings created by DVBViewer, then please just record a short video ~3 minutes in duration and provide it as a sample.

In any case, please update to the latest 2.8.0 Avidemux nightly. The last release has got really long in the tooth.

GreenDevil

Thank you very much.

I have done some further tests and now can't reproduce the problems with the other formats any more. I have no idea what I was doing wrong. Probably I was just misreading the file sizes in Windows File Explorer.

However, the problem persists with .ts as destination format. But it is not worth further time, because .mkv works perfectly and indeed produces files which are smaller than the original, just as you stated.

Thank you very much again, and sorry for the noise!