[x264-devel] libx264 encoding parameters that influence SPS and PPS
Jason Garrett-Glaser
darkshikari at gmail.com
Mon Sep 20 22:42:27 CEST 2010
On Mon, Sep 20, 2010 at 1:12 PM, declan harrison
<harrison.declan at gmail.com> wrote:
> On Mon, Sep 20, 2010 at 5:50 PM, declan harrison
> <harrison.declan at gmail.com> wrote:
>> On Sat, Sep 18, 2010 at 9:35 PM, Jason Garrett-Glaser
>> <darkshikari at gmail.com> wrote:
>>> On Sat, Sep 18, 2010 at 6:23 AM, declan harrison
>>> <harrison.declan at gmail.com> wrote:
>>>> Hi
>>>>
>>>> Using ffmpeg command line (see below) with an input flash video file
>>>> to create an output flash video file whose size is smaller than the
>>>> input file and bitrate differ but in most other ways the files should
>>>> be the same (profile, level etc).
>>>>
>>>> So I'm trying to create this output file to have basically the same
>>>> SPS and PPS that the input flash video file has.
>>>
>>> This is generally not possible.
>>
>> Hi Jason
>>
>> I take your point on this but I have made some progress by doing the following.
>>
>> So I have worked back from the methods x264_sps_init and x264_pps_init
>> in file encoder/set.c and mapping this back to the file
>> libavcodec/libx264.c to see what parameters use which ffmpeg options.
>> Using this technique I have sorted most of the mismatches. However Im
>> working on the final 2 parameters "log2_max_frame_num_minu4" and
>> "log2_max_pic_order_cnt_lib_minus4" and these appear to be a bit more
>> involved. They are using the parameters vui.i_max_dec_frame_buffering
>> (controled by refs option) and i_bframe_pyramid as well. I reckon if I
>> can sort these two out then that should be good.
>>
>> However I was thinking of a slightly different approach but Im not
>> sure if it will work, I was wondering what your thoughts on whether
>> this new approach would work or not. Basically my ultimate goal is to
>> send part of the original input stream to the player and then append
>> the parts that I need to re-encode at the end of this stream. I
>> suppose you could say Im attempting to concatenate two streams
>> together. So rather than try and match exactly the input SPS and PPS I
>> was wondering if I changed the sps_id and the pps_id of the re-encoded
>> H264 stream would the player be able to decode these two streams?
>> Currently ffmpeg doesnt expose the x264 parameter (sps-id) to allow
>> this to happen but Im currently building a change that sets this value
>> to a non zero value in ffmpeg. Will be able to test this when its
>> done.
>>
>> I would need to add an extra entry into the
>> AVCDecoderConfigurationRecord for the additonal SPS and PPS.
>>
>> Do you think this approach in theory could work?
>>
> Hi Jason
>
> Just tested this new approach and it seems to work pretty well for me.
>
> I specify 2 SPS and PPS entrys with separate sps_id and pps_id's. One
> for original file and one for re-encode content. This works well in
> VLC and H264Visa was able to analyse each stream.
Yes, this is the correct way to do it.
Dark Shikari
More information about the x264-devel
mailing list