0

I want the adaptive bitrate streaming of the mp4 video of different gop keyframe size.

I know there are couple of options for multi bitrate streaming i.e hls, dash etc

But I already uploaded the videos on the server each video have the 360p, 480p and 720p mp4 file and each video are having different keyframe intervals.

So the real challenge is to make the own multi bitrate mp4 media player using the media source api

I have brain storming all aspect.

We can only cut the h264 at keyframe

So my real challenge is to know the video each keyframe, the keyframe chunk duration, the offset duration and the offset byte position in the mp4 file.

So my question is how I can get these following using ffmpeg, ffprobe or any other software.

1- Keyframe chunk duration

2- Offset video duration

3- Offset byte position in video.

The following ffprobe command give the detailed info of the each keyframe, maybe this will help

ffprobe -i "1080p.mp4" -select_streams v -skip_frame nokey -show_frames

Thanks!

Ali Hasan
  • 67
  • 1
  • 7
  • By `Keyframe chunk`, do you mean GOP? `Offset video duration` -> nor clear what this means; `Offset byte position in video` --> this is simply the offset of the starting KF, which was provided in my answer to your last Q. – Gyan Dec 24 '18 at 05:24
  • Thanks for the support. – Ali Hasan Dec 25 '18 at 14:09
  • Thanks for the support. Yes I mean gop, as mp4 video we have to cut on keyframe. So I am talking about that keyfram chunk means keyframe to keyframe. As for the offset video duration. For example if we have 5 min video of 50mb then for example it have keyframe every 1 min so there are total 5 keyframe chunks so I want to know each founded keyframe offset duration i.e the 3rd founded keyframe have 3 minutes offset means it start from 3rd minute. As for the byte offset, i am talking about the byte offset from the 50mb file i.e if 3rd keyframe is at 900000 byte offset from 50 mb file. – Ali Hasan Dec 25 '18 at 14:16

1 Answers1

0

Run this command,

ffprobe -loglevel error -skip_frame nokey -select_streams v:0 -show_entries frame=pkt_dts_time,pkt_pos -of csv "video.mp4"

Then

pkt_dts_time provides "Offset video duration" for the GOP.

pkt_pos provides "Offset byte position" for the start of the GOP.

The difference between the pkt_dts_time of a keyframe and the pkt_dts_time of the next keyframe is the "Keyframe chunk duration".

Note that you can only change keyframe position by re-encoding the video. And if you're re-encoding, the keyframe positions of the input video don't matter. See -force_key_frames under https://ffmpeg.org/ffmpeg.html#Advanced-Video-options on how to force KFs at fixed psotions.

Gyan
  • 85,394
  • 9
  • 169
  • 201
  • Comments are not for extended discussion; this conversation has been [moved to chat](https://chat.stackoverflow.com/rooms/185860/discussion-on-answer-by-gyan-adaptive-bit-rate-streaming-of-mp4-of-different-gop). – Samuel Liew Dec 28 '18 at 03:08