r7907 - Smart Copy not working with H.264 MPEG4 file

Started by chrispitude, April 28, 2012, 08:47:22 PM

Previous topic - Next topic

chrispitude

Hi everyone,

We are re-encoding kid's shows from our TiVo to H.264 (in MPEG4 containers) for our son to watch on an Android tablet. The transfer program, kmttg, batch-transfers the files while performing ffmpeg-based H.264 encoding on the fly to save space. I want to trim the beginning and end off the encoded files, but I want to avoid the runtime hit and quality loss of doing a full reencoding. Avidemux 2.5 did not support Smart Copy with H.264 files, but I saw that there is some work on this in the 2.6 branch.

I installed Avidemux 2.6.0 r7907 from Gruntster's web site. The good news is, I can now pick an arbitrary A frame and I'm able to save the file without an error message. However, the resulting cut file starts from the previous I-frame (a few seconds earlier than my A frame) rather than being partially-encoded from the chosen starting frame.

Side note - originally, the saved .mp4 file was corrupt and I could not play it back. I eventually figured out that I had to change the Output Format from its default of AVI Muxer (which did not play even with the file named as an .avi) to MP4 Muxer.

zakk

There is no smart copy for h.264 (yet). You have to start on an I frame and end on I (and probably P) frames, otherwise you loose frames.

And I confirm .avi problems, I always use mp4 or mkv.

gruntster

Quote from: chrispitude on April 28, 2012, 08:47:22 PM
Side note - originally, the saved .mp4 file was corrupt and I could not play it back. I eventually figured out that I had to change the Output Format from its default of AVI Muxer (which did not play even with the file named as an .avi) to MP4 Muxer.

Aye, there's currently an issue with the AVI muxer which causes Window Media Player to refuse to play Avidemux AVI files.  VLC tends to cope but does complain about missing an initial key frame.

chrispitude

Thanks everyone. So I'm new here - just a daddy who's trying to encode cartoons for my kid. But, I'm happy to help the effort in any way I can. If I can file bug reports, create testcases, etc., just let me know. I work for a software company as my day job, so the testing part of the process is familiar to me.

Great program, by the way! Today is the first I've heard of this program, and I'm really impressed with it.

Papou

Suppose I split a video on I-frames into files 1, 2 and 3.
Then I edit file 2, split it on any frame and re-encode the end part into file 2a.
Then I append files 1, 2a and 3.
Haven't I done a smart copy?  Why would Avidemux 2.6 be unable to do that?
In principle, the only possible gotcha is selecting a compatible encoding.
But Avidemux should know.
Aren't all operations used here supposed to work?

Unfortunately, I tried that with a Youtube H.264 / AVC video.
I re-encoded part 2 with Codec Mpeg4 AVC (x264) standard options.
1, 2a and 3 play nicely on any renderer when standing alone, all 30 fps.
But after appending, part 2a shows a non moving picture or gray frame.

What's the problem here?
Formally, it has nothing to do with smart copy, just with appending.