Reputation: 225
I'm using ffmpeg to create HLS sub-playlists. I used ffmpeg to create them for the renditions. Now I need to create the master playlist .m3u8.
I need to do this manually, for a few reasons. I have everything I need except the 'CODECS' value.
How can I get this CODECS value for the video and audio streams within my file?
I cannot see the relevant data when I use ffprobe to get all the metadata about the streams.
Example master manifest with CODECS:
#EXTM3U
#EXT-X-VERSION:3
#EXT-X-STREAM-INF:BANDWIDTH=540863,RESOLUTION=640x360,CODECS="avc1.64001e,mp4a.40.2"
v0/prog_index.m3u8
#EXT-X-STREAM-INF:BANDWIDTH=2339363,RESOLUTION=960x540,CODECS="avc1.64001f,mp4a.40.2"
v1/prog_index.m3u8
Example of metadata I could get using ffprobe:
{'avg_frame_rate': '24000/1001',
'bit_rate': '35956',
'bits_per_raw_sample': '8',
'chroma_location': 'left',
'closed_captions': 0,
'codec_long_name': 'H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10',
'codec_name': 'h264',
'codec_tag': '0x31637661',
'codec_tag_string': 'avc1',
'codec_time_base': '1001/48000',
'codec_type': 'video',
'coded_height': 368,
'coded_width': 640,
'display_aspect_ratio': '16:9',
'disposition': {'attached_pic': 0,
'clean_effects': 0,
'comment': 0,
'default': 1,
'dub': 0,
'forced': 0,
'hearing_impaired': 0,
'karaoke': 0,
'lyrics': 0,
'original': 0,
'timed_thumbnails': 0,
'visual_impaired': 0},
'duration': '5.005000',
'duration_ts': 120120,
'has_b_frames': 2,
'height': 360,
'index': 0,
'is_avc': 'true',
'level': 30,
'nal_length_size': '4',
'nb_frames': '120',
'pix_fmt': 'yuv420p',
'profile': 'High',
'r_frame_rate': '24000/1001',
'refs': 1,
'sample_aspect_ratio': '1:1',
'start_pts': 0,
'start_time': '0.000000',
'tags': {'handler_name': 'VideoHandler',
'language': 'eng',
'timecode': '01:00:00:00'},
'time_base': '1/24000',
'width': 640}
{'avg_frame_rate': '0/0',
'bit_rate': '138375',
'bits_per_sample': 0,
'channel_layout': 'stereo',
'channels': 2,
'codec_long_name': 'AAC (Advanced Audio Coding)',
'codec_name': 'aac',
'codec_tag': '0x6134706d',
'codec_tag_string': 'mp4a',
'codec_time_base': '1/48000',
'codec_type': 'audio',
'disposition': {'attached_pic': 0,
'clean_effects': 0,
'comment': 0,
'default': 1,
'dub': 0,
'forced': 0,
'hearing_impaired': 0,
'karaoke': 0,
'lyrics': 0,
'original': 0,
'timed_thumbnails': 0,
'visual_impaired': 0},
'duration': '5.005000',
'duration_ts': 240240,
'index': 1,
'max_bit_rate': '138375',
'nb_frames': '236',
'profile': 'LC',
'r_frame_rate': '0/0',
'sample_fmt': 'fltp',
'sample_rate': '48000',
'start_pts': 0,
'start_time': '0.000000',
'tags': {'handler_name': 'SoundHandler', 'language': 'eng'},
'time_base': '1/48000'}
Upvotes: 5
Views: 2705
Reputation: 134173
ffprobe
will not provide HLS CODECS
information.
Although you are manually making your own master playlist, add -master_pl_name playlist.m3u8
to your command and get the CODECS
values from the resulting file (playlist.m3u8
).
Upvotes: 2