Log in

View Full Version : (x264) pause/stop/restart functionality


berrinam
13th May 2005, 07:11
Since I have been doing my x264 encodes on a _slow_ P3, I think it would be useful to be able to stop and restart my encodes later, because often one night is not long enough for the encode. I imagine that this could not be *too* hard to implement in x264 (CLI), if you break your encode at the end of a GOP, thereby not needing to keep any historical information.

I have briefly looked at the x264 code and there is a Ctrl+C catcher which ends the encode. What I imagine is that this section of code would close the GOP, flush all the buffers, tell you which frame it has finished on and then exit. Later, you could just specify that you want to continue the encode from that frame number.

This question seems to be partly similar to the many threads I have seen about parallelism of encoding, yet it is an easier thing to implement because the encode would still be sequential, and there would be no worry about catching I(DR) frames.

Am I on to something, or is there some other factor that I have completely missed?

Would anyone other than me find this feature useful?

akupenguin
13th May 2005, 09:26
Done.
It already flushed frames on Ctrl+C. I just added "--seek". When you abort, it will tell you which frame number it was about to encode; pass that to --seek when restarting.
After encoding a raw (*.264) video in several chunks, you can simply cat them together. (Warning: this will break if any of the chunks (other than the last) contains only one GOP, because I haven't added a CLI interface for idr_pic_id.)

Note: Ratecontrol is not aware of this restarting, and thinks each invokation is a separate encode. So a 2nd pass will have to use the same chunks as the 1st. And 2pass will lose a little quality, since it can't reallocate bits from one chunk to another.

defunkt
13th May 2005, 11:58
You could have a look at...

.http://forum.doom9.org/showthread.php?s=&threadid=94162

...which is the applet I wrote to do exactly as you have suggested including managing the GOP ID across sections.

berrinam
13th May 2005, 14:39
Wow! Written and uploaded in two hours! Thanks akupenguin.

@defunkt Your application handles the communications between segmented encodes? Sounds great. Would it be somehow possible to combine this with akupenguin's new CLI version?

I'm afraid I don't have much time for testing now, but I'll just say thanks again, and I'll get back to you tomorrow.

berrinam
14th May 2005, 03:33
I've tried the new version of x264 with the --seek command tag, and I like it.

In an attempt to fix both of the problems that akupenguin mentioned about breaking up the first pass of a multiple-pass encode, I have written a program which will concatenate the log files generated by x264. It is a simplistic program, as the only changes it makes to the logfiles are the framenumbers.

I wrote this program as a proof-of-concept. I have included source-code, which I borrowed from the x264 project and added some few modifications. If anyone is interested, please feel free to download it and look at it yourself.

PS the attachment has to be approved by a moderator before anyone can download it.