Commit 863ebe6f authored by Steven Liu's avatar Steven Liu

avformat/flvenc: add add_keyframe_index option

Add keyframe index metadata
Used to facilitate seeking; particularly for HTTP pseudo streaming.
 1. read live streaming or file by sequence
 2. if use add_keyframe_index option, add a mark flag at the position,
    use to insert new context at the last step.
 3. add the keyframes *offset* and *timestamp* into a list
 4. if use add_keyframe_index option, shift the metadata data from
    mark flag offset
 5. insert the keyframes *offset* and *timestamp* from the list by
    sequence
 6. free the list
 7. end.

Add FATE test case;
Reviewed-by: 's avatarLou Logan <lou@lrcd.com>
Signed-off-by: 's avatarSteven Liu <liuqi@gosun.com>
Signed-off-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
parent 2bc66d9e
...@@ -147,6 +147,9 @@ Place AAC sequence header based on audio stream data. ...@@ -147,6 +147,9 @@ Place AAC sequence header based on audio stream data.
@item no_sequence_end @item no_sequence_end
Disable sequence end tag. Disable sequence end tag.
@item add_keyframe_index
Used to facilitate seeking; particularly for HTTP pseudo streaming.
@end table @end table
@end table @end table
......
This diff is collapsed.
...@@ -132,6 +132,7 @@ include $(SRC_PATH)/tests/fate/fifo-muxer.mak ...@@ -132,6 +132,7 @@ include $(SRC_PATH)/tests/fate/fifo-muxer.mak
include $(SRC_PATH)/tests/fate/filter-audio.mak include $(SRC_PATH)/tests/fate/filter-audio.mak
include $(SRC_PATH)/tests/fate/filter-video.mak include $(SRC_PATH)/tests/fate/filter-video.mak
include $(SRC_PATH)/tests/fate/flac.mak include $(SRC_PATH)/tests/fate/flac.mak
include $(SRC_PATH)/tests/fate/flvenc.mak
include $(SRC_PATH)/tests/fate/gapless.mak include $(SRC_PATH)/tests/fate/gapless.mak
include $(SRC_PATH)/tests/fate/gif.mak include $(SRC_PATH)/tests/fate/gif.mak
include $(SRC_PATH)/tests/fate/h264.mak include $(SRC_PATH)/tests/fate/h264.mak
......
...@@ -129,6 +129,10 @@ framecrc(){ ...@@ -129,6 +129,10 @@ framecrc(){
ffmpeg "$@" -flags +bitexact -fflags +bitexact -f framecrc - ffmpeg "$@" -flags +bitexact -fflags +bitexact -f framecrc -
} }
ffmetadata(){
ffmpeg "$@" -flags +bitexact -fflags +bitexact -f ffmetadata -
}
framemd5(){ framemd5(){
ffmpeg "$@" -flags +bitexact -fflags +bitexact -f framemd5 - ffmpeg "$@" -flags +bitexact -fflags +bitexact -f framemd5 -
} }
......
tests/data/add_keyframe_index.flv: TAG = GEN
tests/data/add_keyframe_index.flv: ffmpeg$(PROGSSUF)$(EXESUF) | tests/data
$(M)$(TARGET_EXEC) $(TARGET_PATH)/$< \
-f lavfi -i "sws_flags=+accurate_rnd+bitexact;testsrc=r=7:n=2:d=20" -sws_flags '+accurate_rnd+bitexact' -metadata "encoder=Lavf" -pix_fmt yuv420p -c:v flv1 -g 7 -f flv -flags +bitexact \
-flvflags add_keyframe_index -idct simple -dct int -y $(TARGET_PATH)/tests/data/add_keyframe_index.flv 2> /dev/null;
FATE_AFILTER-$(call ALLYES, FLV_MUXER FLV_DEMUXER AVDEVICE TESTSRC_FILTER LAVFI_INDEV FLV_ENCODER) += fate-flv-add_keyframe_index
fate-flv-add_keyframe_index: tests/data/add_keyframe_index.flv
fate-flv-add_keyframe_index: CMD = ffmetadata -flags +bitexact -i $(TARGET_PATH)/tests/data/add_keyframe_index.flv
;FFMETADATA1
hasVideo=true
hasKeyframes=true
hasAudio=false
hasMetadata=true
canSeekToEnd=true
datasize=629776
videosize=629381
audiosize=0
lasttimestamp=20
lastkeyframetimestamp=19
lastkeyframelocation=597963
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment