Log in

View Full Version : Compress a part of raw YUV file with x264


msm_007
15th February 2009, 01:26
Hi all,
I have a raw YUV video sequence of 100 frames and I want to compress from frame 20 to frame 60, (output: from-20-to-60.264)

Is it possible to do this with x264?

J_Darnley
15th February 2009, 01:35
--seek 20 --frames 40
[EDIT] Clarification: this will drop frames 0-19, encode 20-59 and then stop. If you want frame 60 then use --frames 41

msm_007
15th February 2009, 16:58
thx for the reply,
if I use --bframe --ref 5, is x264 can code the first 5 frames (20 to 24) and the last 5 frames (56-60) with the technique bframes ?

I mean I still want to only code 20 - 60 frames but I want the borders to be coded using their neighbours that are not going to be coded but just used to code the borders

J_Darnley
15th February 2009, 18:51
I don't fully understand what you are asking. The first frame can only be an I-frame, it cannot be a P- or a B-frame because there is nothing to predict it from. Likewise, the last frame cannot be a B-frame either because there is nothing later. You cannot use frames which are to be dropped to predict others. How would you decode a non-existent frame?

msm_007
15th February 2009, 20:05
Ok, I’m going to explain what I want to do,

My aim is to implement a parallel application of video coding, to do that I decompose the YUV sequence in a number of small sequences and then every sequence I going to be coded separately on a different machine, then I’m going to join the byte stream of every coded sequence to have the finale .264 file. For example I have decomposed a file of 300 frames on 5 files of 60 frames.

It worked but the problem is that the size of the result after join is 3 times larger than the result if I proceed with the 300 frames without decomposition

I guess the problem is on the border frames (1 files gives 2 borders but 5 files gives 10 borders witch degrades the compression performance)

The only solution I have in mind to deal with the size problem is to code the borders with bframe: send redundant frames to use them on coding the borders (e.g. for the 2st file,61-119, I send 5 frames before and after the frames to be coded ), but I don’t know how implement this

Any idea?

Sagekilla
18th February 2009, 15:08
You can't. A sequence, regardless of length must start with an I-frame and cannot end with a B-frame. This means if you have a 100 frame sequence split in 5, (20 frames each) it would look like this:

Video 1:
0 --> 20
IPBP ... P

Video 2:
21 --> 40
IPBP ... P

Joining them would give you IPBP ... PIPBP ... P (0 --> 40 frames). It's just -stupid- to split files into such tiny chunks.