0

I'm using the following command to generate fmp4 files

ffmpeg -rtsp_transport tcp -i rtsp://someuser:somepassword@somedomain:someport/Streaming/Channels/101 -acodec copy -vcodec copy -hls_segment_type fmp4 -hls_time 2 -hls_list_size 10 -hls_flags delete_segments+append_list+split_by_time -hls_playlist_type event test.m3u8

I need to know the exact duration and frame count of each fragment. Unfortunately -vstats appears to be ignored.

I tried to probe one of the segments using

ffprobe -show_frames ./test0.m4s

But I get

[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fb68e80b000] could not find corresponding track id 1 [mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fb68e80b000] could not find corresponding trex (id 1) [mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fb68e80b000] could not find corresponding track id 0 [mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fb68e80b000] trun track id unknown, no tfhd was found [mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fb68e80b000] error reading header ./test0.m4s: Invalid data found when processing input

I'm assuming that is because the initialisation segment has not been loaded but I can't find the option to do so.

If I try probing the initialisation segment with

ffprobe -show_frames ./init.mp4

I get no frame information and the error

Could not find codec parameters for stream 0 (Video: h264 (avc1 / 0x31637661), none, 2560x1440): unspecified pixel format Consider increasing the value for the 'analyzeduration' and 'probesize' options

Would appreciate any help.

1 Answers1

0

I'm assuming that is because the initialisation segment has not been loaded

Correct.

One way to achieve what you need would be to cat the initialisation segment and media segment in question together and piping them to ffprobe:

$ cat ./init.mp4 ./test0.m4s | ffprobe -show_frames -
Anonymous Coward
  • 1,096
  • 11
  • 22
  • Thanks. Just to be clear if this is the only way then there is no way to discover what frames are in each segment as the files have to be joined together prior to the processing. – Duke Atista Nov 17 '20 at 15:57
  • I don't really understand what you are asking but, looking again at the OP, the exact duration of the fragment will be signalled in the EXTINF tag preceeding the fragment. Assuming the content is fixed frame rate, you should be able to determine the frame count by simple division. – Anonymous Coward Nov 18 '20 at 17:14