[FFmpeg-user] why are my streams not aligned?

Dennis Mungai dmngaie at gmail.com
Mon Nov 18 17:11:18 EET 2019


On Mon, 18 Nov 2019 at 17:31, gordon <wgordonw1 at gmail.com> wrote:

> Why are the segments for my stream not aligned?  The first command outputs
> video segment.  The second command outputs an audio segment with the
> previous video output copied in.
>
> Ffmpeg commands are pasted below with the m3u8 outputs.  The same results
> were observed on ffmpeg 4.2.1 and snapshot
>
> /usr/local/bin/ffmpeg -y -loglevel error -f rawvideo -vcodec rawvideo -s
> 160x120 -pix_fmt rgb24 -r 12.00 -i - -an -vcodec libx264 -preset medium -f
> hls -an -hls_flags single_file -hls_time 6 -hls_list_size 0
> -hls_segment_type mpegts -hls_segment_filename
>
> /tmp/973b7b02b6e6486f90d3064527a69701/output/21b79578a1d04533932e32d28f46eb94.ts
> -hls_playlist_type vod -master_pl_name
> 21b79578a1d04533932e32d28f46eb94-master.m3u8 -force_key_frames
> 'expr:gte(t,n_forced*2)' -profile:v baseline -level 3.0 -pix_fmt yuv420p
> -vsync cfr -b 145k -pix_fmt yuv420p
>
> /tmp/973b7b02b6e6486f90d3064527a69701/output/21b79578a1d04533932e32d28f46eb94-variant.m3u8
>
> #EXTM3U
> #EXT-X-VERSION:4
> #EXT-X-TARGETDURATION:6
> #EXT-X-MEDIA-SEQUENCE:0
> #EXT-X-PLAYLIST-TYPE:VOD
> #EXTINF:6.000000,
> #EXT-X-BYTERANGE:116748 at 0
> 21b79578a1d04533932e32d28f46eb94.ts
> #EXTINF:6.000000,
> #EXT-X-BYTERANGE:96256 at 116748
> 21b79578a1d04533932e32d28f46eb94.ts
> #EXTINF:6.000000,
> #EXT-X-BYTERANGE:143256 at 213004
> 21b79578a1d04533932e32d28f46eb94.ts
> #EXTINF:6.000000,
> #EXT-X-BYTERANGE:97760 at 356260
> 21b79578a1d04533932e32d28f46eb94.ts
> #EXTINF:5.750000,
> #EXT-X-BYTERANGE:75764 at 454020
> 21b79578a1d04533932e32d28f46eb94.ts
> #EXT-X-ENDLIST
>
>
> /usr/local/bin/ffmpeg -y -loglevel error -f s16le -acodec pcm_s16le -ar
> 44100 -ac 2 -i - -i
>
> /tmp/973b7b02b6e6486f90d3064527a69701/output/21b79578a1d04533932e32d28f46eb94.ts
> -vcodec copy -acodec libfdk_aac -ar 44100 -strict -2 -profile:a aac_he_v2
> -vbr 1 -f hls -hls_flags single_file -hls_time 6 -hls_list_size 0
> -hls_segment_type mpegts -hls_segment_filename
>
> /tmp/973b7b02b6e6486f90d3064527a69701/output/e3658a88388c4d4da25681956bccb00f.ts
> -hls_playlist_type vod -master_pl_name
> e3658a88388c4d4da25681956bccb00f-master.m3u8 -force_key_frames
> 'expr:gte(t,n_forced*2)' -pix_fmt yuv420p -vsync cfr
>
> /tmp/973b7b02b6e6486f90d3064527a69701/output/e3658a88388c4d4da25681956bccb00f-variant.m3u8
>
> #EXTM3U
> #EXT-X-VERSION:4
> #EXT-X-TARGETDURATION:6
> #EXT-X-MEDIA-SEQUENCE:0
> #EXT-X-PLAYLIST-TYPE:VOD
> #EXTINF:6.000000,
> #EXT-X-BYTERANGE:146452 at 0
> e3658a88388c4d4da25681956bccb00f.ts
> #EXTINF:6.000000,
> #EXT-X-BYTERANGE:125020 at 146452
> e3658a88388c4d4da25681956bccb00f.ts
> #EXTINF:5.916667,
> #EXT-X-BYTERANGE:167320 at 271472
> e3658a88388c4d4da25681956bccb00f.ts
> #EXTINF:6.083333,
> #EXT-X-BYTERANGE:133856 at 438792
> e3658a88388c4d4da25681956bccb00f.ts
> #EXTINF:5.750000,
> #EXT-X-BYTERANGE:103776 at 572648
> e3658a88388c4d4da25681956bccb00f.ts
> #EXT-X-ENDLIST



To ensure alignment, you must use a closed GOP (set via -flags +cgop) and
specify a GOP size via the -g option passed to your video encoder.

>
>


More information about the ffmpeg-user mailing list