I'm not ffmpeg
and encodding expert and am trying to encode a MP4
file to MPEG-4 h264
.ts
file.
When Elecard stream analyzer
is analyzing my result .ts
file, it shows slice_type = 7
for all of i-frame
s as you can see in the attached screenshot.
How can I change all these to slice_type = 2
?
My ffmpeg
command:
-i Source.mp4 \
-filter:v 'setpts=0+PTS-STARTPTS' -metadata:s:v:0 start_time=0 \
-f adts -c:a libfdk_aac -profile:a aac_he -strict -2 -ar 48000 -b:a 48k \
-f mpegts -c:v libx264 -vbsf h264_mp4toannexb -strict experimental - profile:v main -level:v 3.0 -preset:v slow -movflags faststart -pat_period 100 \
-x264opts nal-hrd=cbr:force-cfr=1 -crf 25 -vf scale=w=640:h=360 -aspect 16:9 \
-bf 1 -sc_threshold 0 -keyint_min 2*25 -g 2*25 \
-force_key_frames "expr:gte(t,n_forced*50)" -max_muxing_queue_size 1500k \
-coder 1 -refs 2 \
-b:v 750k -minrate 750k -maxrate 750k -bufsize 1500k \
-vsync 1 -framerate 25000/1001 \
-x264opts "bitrate=750:vbv-maxrate=750:vbv-bufsize=1500"\
-pix_fmt yuv420p -r 25 -x264opts force-cfr \
-mbs_per_slice 1 -y dest.ts
If you look at the H.264 standard you'll learn the slice type 7 and 2 are both I slices. If you encounter a slice type 7 that means all other slices of this picture are I slices. Most likely your I frame is an IDR frame. If you don't want IDR frame - I'd try to encode your H.264 as open GOP. I am not sure how much control ffmpeg gives over x264 but I'd try something like --open-gop.