I am unable to re-encode an H.264 video that I downloaded from Youtube back to its original size. The MediaInfo is pasted below. The size of the video stream is 20 MB.

I decoded the video into raw YUV (using ffmpeg and JM separately, ensuring that I get an identical file). Then I re-encoded it using the x264 library with a variety of configs. The encoded H.264 videos that I generated are around 40 MB in size.

This is the commandline that I used: x264 -o out.h264 --input-res 1280x720 --preset slow autl.yuv

Any ideas on what options I might be missing that YouTube would have used to encode the video?


Complete name                            : autl.h264
Format                                   : AVC
Format/Info                              : Advanced Video Codec
File size                                : 19.9 MiB
Writing library                          : x264 core 155 r2901 7d0ff22

Format                                   : AVC
Format/Info                              : Advanced Video Codec
Format profile                           : [email protected]
Format settings                          : CABAC / 3 Ref Frames
Format settings, CABAC                   : Yes
Format settings, Reference frames        : 3 frames
Width                                    : 1 280 pixels
Height                                   : 720 pixels
Display aspect ratio                     : 16:9
Frame rate mode                          : Variable
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Scan type                                : Progressive
Writing library                          : x264 core 155 r2901 7d0ff22
Color range                              : Limited
Color primaries                          : BT.709
Transfer characteristics                 : BT.709
Matrix coefficients                      : BT.709

1 Answer 1


I was able to produce the same size as Youtube by varying the qp option for x264. The value that worked to approximately the same size was qp=20.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.