why are my streams not aligned?

classic Classic list List threaded Threaded
11 messages Options
Reply | Threaded
Open this post in threaded view
|

why are my streams not aligned?

gordon
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@0
21b79578a1d04533932e32d28f46eb94.ts
#EXTINF:6.000000,
#EXT-X-BYTERANGE:96256@116748
21b79578a1d04533932e32d28f46eb94.ts
#EXTINF:6.000000,
#EXT-X-BYTERANGE:143256@213004
21b79578a1d04533932e32d28f46eb94.ts
#EXTINF:6.000000,
#EXT-X-BYTERANGE:97760@356260
21b79578a1d04533932e32d28f46eb94.ts
#EXTINF:5.750000,
#EXT-X-BYTERANGE:75764@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@0
e3658a88388c4d4da25681956bccb00f.ts
#EXTINF:6.000000,
#EXT-X-BYTERANGE:125020@146452
e3658a88388c4d4da25681956bccb00f.ts
#EXTINF:5.916667,
#EXT-X-BYTERANGE:167320@271472
e3658a88388c4d4da25681956bccb00f.ts
#EXTINF:6.083333,
#EXT-X-BYTERANGE:133856@438792
e3658a88388c4d4da25681956bccb00f.ts
#EXTINF:5.750000,
#EXT-X-BYTERANGE:103776@572648
e3658a88388c4d4da25681956bccb00f.ts
#EXT-X-ENDLIST
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: why are my streams not aligned?

Brainiarc7
On Mon, 18 Nov 2019 at 17:31, gordon <[hidden email]> 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@0
> 21b79578a1d04533932e32d28f46eb94.ts
> #EXTINF:6.000000,
> #EXT-X-BYTERANGE:96256@116748
> 21b79578a1d04533932e32d28f46eb94.ts
> #EXTINF:6.000000,
> #EXT-X-BYTERANGE:143256@213004
> 21b79578a1d04533932e32d28f46eb94.ts
> #EXTINF:6.000000,
> #EXT-X-BYTERANGE:97760@356260
> 21b79578a1d04533932e32d28f46eb94.ts
> #EXTINF:5.750000,
> #EXT-X-BYTERANGE:75764@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@0
> e3658a88388c4d4da25681956bccb00f.ts
> #EXTINF:6.000000,
> #EXT-X-BYTERANGE:125020@146452
> e3658a88388c4d4da25681956bccb00f.ts
> #EXTINF:5.916667,
> #EXT-X-BYTERANGE:167320@271472
> e3658a88388c4d4da25681956bccb00f.ts
> #EXTINF:6.083333,
> #EXT-X-BYTERANGE:133856@438792
> e3658a88388c4d4da25681956bccb00f.ts
> #EXTINF:5.750000,
> #EXT-X-BYTERANGE:103776@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.

>
>
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: why are my streams not aligned?

gordon
Okay, thank you. I will give that a go.

-- aside --

I thought that the "-force_key_frames expr:gte(t,n_forced*2)" was placing
the key frames for segment boundaries and still allowing the encoder to
place other keyframes where they wanted?  I am trying to use h264, h265,
and vp9 so I figured the keyframes not at boundaries would need to be
different for efficiency.

How do I determine the best (or good) value for "-g" given a particular
source file and target duration for segments?

On Mon, Nov 18, 2019 at 10:19 AM Dennis Mungai <[hidden email]> wrote:

> On Mon, 18 Nov 2019 at 17:31, gordon <[hidden email]> 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@0
> > 21b79578a1d04533932e32d28f46eb94.ts
> > #EXTINF:6.000000,
> > #EXT-X-BYTERANGE:96256@116748
> > 21b79578a1d04533932e32d28f46eb94.ts
> > #EXTINF:6.000000,
> > #EXT-X-BYTERANGE:143256@213004
> > 21b79578a1d04533932e32d28f46eb94.ts
> > #EXTINF:6.000000,
> > #EXT-X-BYTERANGE:97760@356260
> > 21b79578a1d04533932e32d28f46eb94.ts
> > #EXTINF:5.750000,
> > #EXT-X-BYTERANGE:75764@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@0
> > e3658a88388c4d4da25681956bccb00f.ts
> > #EXTINF:6.000000,
> > #EXT-X-BYTERANGE:125020@146452
> > e3658a88388c4d4da25681956bccb00f.ts
> > #EXTINF:5.916667,
> > #EXT-X-BYTERANGE:167320@271472
> > e3658a88388c4d4da25681956bccb00f.ts
> > #EXTINF:6.083333,
> > #EXT-X-BYTERANGE:133856@438792
> > e3658a88388c4d4da25681956bccb00f.ts
> > #EXTINF:5.750000,
> > #EXT-X-BYTERANGE:103776@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.
>
> >
> >
> _______________________________________________
> ffmpeg-user mailing list
> [hidden email]
> https://ffmpeg.org/mailman/listinfo/ffmpeg-user
>
> To unsubscribe, visit link above, or email
> [hidden email] with subject "unsubscribe".
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: why are my streams not aligned?

gordon
On Mon, Nov 18, 2019 at 10:37 AM gordon <[hidden email]> wrote:

> Okay, thank you. I will give that a go.
>
> -- aside --
>
> I thought that the "-force_key_frames expr:gte(t,n_forced*2)" was placing
> the key frames for segment boundaries and still allowing the encoder to
> place other keyframes where they wanted?  I am trying to use h264, h265,
> and vp9 so I figured the keyframes not at boundaries would need to be
> different for efficiency.
>
> How do I determine the best (or good) value for "-g" given a particular
> source file and target duration for segments?
>
> On Mon, Nov 18, 2019 at 10:19 AM Dennis Mungai <[hidden email]> wrote:
>
>> On Mon, 18 Nov 2019 at 17:31, gordon <[hidden email]> 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@0
>> > 21b79578a1d04533932e32d28f46eb94.ts
>> > #EXTINF:6.000000,
>> > #EXT-X-BYTERANGE:96256@116748
>> > 21b79578a1d04533932e32d28f46eb94.ts
>> > #EXTINF:6.000000,
>> > #EXT-X-BYTERANGE:143256@213004
>> > 21b79578a1d04533932e32d28f46eb94.ts
>> > #EXTINF:6.000000,
>> > #EXT-X-BYTERANGE:97760@356260
>> > 21b79578a1d04533932e32d28f46eb94.ts
>> > #EXTINF:5.750000,
>> > #EXT-X-BYTERANGE:75764@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@0
>> > e3658a88388c4d4da25681956bccb00f.ts
>> > #EXTINF:6.000000,
>> > #EXT-X-BYTERANGE:125020@146452
>> > e3658a88388c4d4da25681956bccb00f.ts
>> > #EXTINF:5.916667,
>> > #EXT-X-BYTERANGE:167320@271472
>> > e3658a88388c4d4da25681956bccb00f.ts
>> > #EXTINF:6.083333,
>> > #EXT-X-BYTERANGE:133856@438792
>> > e3658a88388c4d4da25681956bccb00f.ts
>> > #EXTINF:5.750000,
>> > #EXT-X-BYTERANGE:103776@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.
>>
>> >
>> >
>> _______________________________________________
>> ffmpeg-user mailing list
>> [hidden email]
>> https://ffmpeg.org/mailman/listinfo/ffmpeg-user
>>
>> To unsubscribe, visit link above, or email
>> [hidden email] with subject "unsubscribe".
>
>

Sorry for the top post - gmail does that by default.  I've copied my reply
below for ease of reading:

Okay, thank you. I will give that a go.

-- aside --

I thought that the "-force_key_frames expr:gte(t,n_forced*2)" was placing
the key frames for segment boundaries and still allowing the encoder to
place other keyframes where they wanted?  I am trying to use h264, h265,
and vp9 so I figured the keyframes not at boundaries would need to be
different for efficiency.

How do I determine the best (or good) value for "-g" given a particular
source file and target duration for segments?
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: why are my streams not aligned?

Brainiarc7
In reply to this post by gordon
On Mon, 18 Nov 2019, 18:38 gordon, <[hidden email]> wrote:

> Okay, thank you. I will give that a go.
>
> -- aside --
>
> I thought that the "-force_key_frames expr:gte(t,n_forced*2)" was placing
> the key frames for segment boundaries and still allowing the encoder to
> place other keyframes where they wanted?  I am trying to use h264, h265,
> and vp9 so I figured the keyframes not at boundaries would need to be
> different for efficiency.
>
> How do I determine the best (or good) value for "-g" given a particular
> source file and target duration for segments?
>
> On Mon, Nov 18, 2019 at 10:19 AM Dennis Mungai <[hidden email]> wrote:
>
> > On Mon, 18 Nov 2019 at 17:31, gordon <[hidden email]> 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@0
> > > 21b79578a1d04533932e32d28f46eb94.ts
> > > #EXTINF:6.000000,
> > > #EXT-X-BYTERANGE:96256@116748
> > > 21b79578a1d04533932e32d28f46eb94.ts
> > > #EXTINF:6.000000,
> > > #EXT-X-BYTERANGE:143256@213004
> > > 21b79578a1d04533932e32d28f46eb94.ts
> > > #EXTINF:6.000000,
> > > #EXT-X-BYTERANGE:97760@356260
> > > 21b79578a1d04533932e32d28f46eb94.ts
> > > #EXTINF:5.750000,
> > > #EXT-X-BYTERANGE:75764@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@0
> > > e3658a88388c4d4da25681956bccb00f.ts
> > > #EXTINF:6.000000,
> > > #EXT-X-BYTERANGE:125020@146452
> > > e3658a88388c4d4da25681956bccb00f.ts
> > > #EXTINF:5.916667,
> > > #EXT-X-BYTERANGE:167320@271472
> > > e3658a88388c4d4da25681956bccb00f.ts
> > > #EXTINF:6.083333,
> > > #EXT-X-BYTERANGE:133856@438792
> > > e3658a88388c4d4da25681956bccb00f.ts
> > > #EXTINF:5.750000,
> > > #EXT-X-BYTERANGE:103776@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.
>
>
>


A keyframe distance of 2 is ideal. Simply set -g to 2x your content's frame
> rate. If your fps is 30, then -g should be 60. As an example. Secondly, set
> your segment length to a multiple of 2. Segment lengths of 6 seconds are
> ideal (and it's what Apple recommends in their HLS authoring guidelines).
> However, if low latency for a trade off in encoding quality is desired,
> then set segment length to 2.
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: why are my streams not aligned?

Brainiarc7
On Mon, 18 Nov 2019, 18:44 Dennis Mungai, <[hidden email]> wrote:

>
>
> On Mon, 18 Nov 2019, 18:38 gordon, <[hidden email]> wrote:
>
>> Okay, thank you. I will give that a go.
>>
>> -- aside --
>>
>> I thought that the "-force_key_frames expr:gte(t,n_forced*2)" was placing
>> the key frames for segment boundaries and still allowing the encoder to
>> place other keyframes where they wanted?  I am trying to use h264, h265,
>> and vp9 so I figured the keyframes not at boundaries would need to be
>> different for efficiency.
>>
>> How do I determine the best (or good) value for "-g" given a particular
>> source file and target duration for segments?
>>
>> On Mon, Nov 18, 2019 at 10:19 AM Dennis Mungai <[hidden email]> wrote:
>>
>> > On Mon, 18 Nov 2019 at 17:31, gordon <[hidden email]> 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@0
>> > > 21b79578a1d04533932e32d28f46eb94.ts
>> > > #EXTINF:6.000000,
>> > > #EXT-X-BYTERANGE:96256@116748
>> > > 21b79578a1d04533932e32d28f46eb94.ts
>> > > #EXTINF:6.000000,
>> > > #EXT-X-BYTERANGE:143256@213004
>> > > 21b79578a1d04533932e32d28f46eb94.ts
>> > > #EXTINF:6.000000,
>> > > #EXT-X-BYTERANGE:97760@356260
>> > > 21b79578a1d04533932e32d28f46eb94.ts
>> > > #EXTINF:5.750000,
>> > > #EXT-X-BYTERANGE:75764@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@0
>> > > e3658a88388c4d4da25681956bccb00f.ts
>> > > #EXTINF:6.000000,
>> > > #EXT-X-BYTERANGE:125020@146452
>> > > e3658a88388c4d4da25681956bccb00f.ts
>> > > #EXTINF:5.916667,
>> > > #EXT-X-BYTERANGE:167320@271472
>> > > e3658a88388c4d4da25681956bccb00f.ts
>> > > #EXTINF:6.083333,
>> > > #EXT-X-BYTERANGE:133856@438792
>> > > e3658a88388c4d4da25681956bccb00f.ts
>> > > #EXTINF:5.750000,
>> > > #EXT-X-BYTERANGE:103776@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.
>>
>>
>>
>
>
> A keyframe distance of 2 is ideal. Simply set -g to 2x your content's
>> frame rate. If your fps is 30, then -g should be 60. As an example.
>> Secondly, set your segment length to a multiple of 2. Segment lengths of 6
>> seconds are ideal (and it's what Apple recommends in their HLS authoring
>> guidelines). However, if low latency for a trade off in encoding quality is
>> desired, then set segment length to 2.
>
>
If you must force keyframes, then ensure that they are forced as IDRs.
libx264 should have that as a private encoder option, verify with ffmpeg -h
encoder=libx264.

Combining both -g and force key frames to the same interval is also ideal,
but be aware that forcing too many keyframes will invariably affect
transcode quality, as it may impact look ahead decisions, etc. Some
encoders, particularly libvpx are heavily affected by this quality
degradation with forcing keyframes. Evaluate what your requirements and
tradeoffs are and deploy them as needed.

>
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: why are my streams not aligned?

gordon
On Mon, Nov 18, 2019 at 10:54 AM Dennis Mungai <[hidden email]> wrote:

> On Mon, 18 Nov 2019, 18:44 Dennis Mungai, <[hidden email]> wrote:
>
> >
> >
> > On Mon, 18 Nov 2019, 18:38 gordon, <[hidden email]> wrote:
> >
> >> Okay, thank you. I will give that a go.
> >>
> >> -- aside --
> >>
> >> I thought that the "-force_key_frames expr:gte(t,n_forced*2)" was
> placing
> >> the key frames for segment boundaries and still allowing the encoder to
> >> place other keyframes where they wanted?  I am trying to use h264, h265,
> >> and vp9 so I figured the keyframes not at boundaries would need to be
> >> different for efficiency.
> >>
> >> How do I determine the best (or good) value for "-g" given a particular
> >> source file and target duration for segments?
> >>
> >> On Mon, Nov 18, 2019 at 10:19 AM Dennis Mungai <[hidden email]>
> wrote:
> >>
> >> > On Mon, 18 Nov 2019 at 17:31, gordon <[hidden email]> 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@0
> >> > > 21b79578a1d04533932e32d28f46eb94.ts
> >> > > #EXTINF:6.000000,
> >> > > #EXT-X-BYTERANGE:96256@116748
> >> > > 21b79578a1d04533932e32d28f46eb94.ts
> >> > > #EXTINF:6.000000,
> >> > > #EXT-X-BYTERANGE:143256@213004
> >> > > 21b79578a1d04533932e32d28f46eb94.ts
> >> > > #EXTINF:6.000000,
> >> > > #EXT-X-BYTERANGE:97760@356260
> >> > > 21b79578a1d04533932e32d28f46eb94.ts
> >> > > #EXTINF:5.750000,
> >> > > #EXT-X-BYTERANGE:75764@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@0
> >> > > e3658a88388c4d4da25681956bccb00f.ts
> >> > > #EXTINF:6.000000,
> >> > > #EXT-X-BYTERANGE:125020@146452
> >> > > e3658a88388c4d4da25681956bccb00f.ts
> >> > > #EXTINF:5.916667,
> >> > > #EXT-X-BYTERANGE:167320@271472
> >> > > e3658a88388c4d4da25681956bccb00f.ts
> >> > > #EXTINF:6.083333,
> >> > > #EXT-X-BYTERANGE:133856@438792
> >> > > e3658a88388c4d4da25681956bccb00f.ts
> >> > > #EXTINF:5.750000,
> >> > > #EXT-X-BYTERANGE:103776@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.
> >>
> >>
> >>
> >
> >
> > A keyframe distance of 2 is ideal. Simply set -g to 2x your content's
> >> frame rate. If your fps is 30, then -g should be 60. As an example.
> >> Secondly, set your segment length to a multiple of 2. Segment lengths
> of 6
> >> seconds are ideal (and it's what Apple recommends in their HLS authoring
> >> guidelines). However, if low latency for a trade off in encoding
> quality is
> >> desired, then set segment length to 2.
> >
> >
> If you must force keyframes, then ensure that they are forced as IDRs.
> libx264 should have that as a private encoder option, verify with ffmpeg -h
> encoder=libx264.
>
> Combining both -g and force key frames to the same interval is also ideal,
> but be aware that forcing too many keyframes will invariably affect
> transcode quality, as it may impact look ahead decisions, etc. Some
> encoders, particularly libvpx are heavily affected by this quality
> degradation with forcing keyframes. Evaluate what your requirements and
> tradeoffs are and deploy them as needed.
>
> >
> _______________________________________________
> ffmpeg-user mailing list
> [hidden email]
> https://ffmpeg.org/mailman/listinfo/ffmpeg-user
>
> To unsubscribe, visit link above, or email
> [hidden email] with subject "unsubscribe".






 So, I did not get expected results with cgop and -g.  What have I done
wrong?

/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 -flags +cgop -hls_flags single_file -hls_time 6 -hls_list_size 0
-hls_playlist_type vod -pix_fmt yuv420p -vsync cfr -g 24 -map 0:v:0
-hls_segment_type mpegts -hls_segment_filename
/tmp/c8d61968cf274de1a96184e55354ffea/output/7f96b3983a4c4da2baf74f5c3b732a1c.ts
-master_pl_name 7f96b3983a4c4da2baf74f5c3b732a1c-master.m3u8 -profile:v
baseline -level 3.0 -b 145k -pix_fmt yuv420p
/tmp/c8d61968cf274de1a96184e55354ffea/output/7f96b3983a4c4da2baf74f5c3b732a1c-variant.m3u8

/usr/local/bin/ffmpeg -y -loglevel error -f s16le -acodec pcm_s16le -ar
44100 -ac 2 -i - -i
/tmp/c8d61968cf274de1a96184e55354ffea/output/7f96b3983a4c4da2baf74f5c3b732a1c.ts
-vcodec libx264 -acodec libfdk_aac -ar 44100 -strict -2 -f hls -flags +cgop
-hls_flags single_file -hls_time 6 -hls_list_size 0 -hls_playlist_type vod
-pix_fmt yuv420p -vsync cfr -g 24 -map 0:a:0 -profile:a aac_he_v2 -vbr 1
-hls_segment_type mpegts -hls_segment_filename
/tmp/c8d61968cf274de1a96184e55354ffea/output/9a9036b2484e425ca4443ad31ade2867.ts
-master_pl_name 9a9036b2484e425ca4443ad31ade2867-master.m3u8
/tmp/c8d61968cf274de1a96184e55354ffea/output/9a9036b2484e425ca4443ad31ade2867-variant.m3u8

$ cat /tmp/c8d61968cf274de1a96184e55354ffea/output/*var*
#EXTM3U
#EXT-X-VERSION:4
#EXT-X-TARGETDURATION:7
#EXT-X-MEDIA-SEQUENCE:0
#EXT-X-PLAYLIST-TYPE:VOD
#EXTINF:6.666667,
#EXT-X-BYTERANGE:131600@0
7f96b3983a4c4da2baf74f5c3b732a1c.ts
#EXTINF:5.916667,
#EXT-X-BYTERANGE:96256@131600
7f96b3983a4c4da2baf74f5c3b732a1c.ts
#EXTINF:6.250000,
#EXT-X-BYTERANGE:143632@227856
7f96b3983a4c4da2baf74f5c3b732a1c.ts
#EXTINF:5.166667,
#EXT-X-BYTERANGE:82344@371488
7f96b3983a4c4da2baf74f5c3b732a1c.ts
#EXTINF:5.750000,
#EXT-X-BYTERANGE:80464@453832
7f96b3983a4c4da2baf74f5c3b732a1c.ts
#EXT-X-ENDLIST
#EXTM3U
#EXT-X-VERSION:4
#EXT-X-TARGETDURATION:6
#EXT-X-MEDIA-SEQUENCE:0
#EXT-X-PLAYLIST-TYPE:VOD
#EXTINF:6.037778,
#EXT-X-BYTERANGE:30644@0
9a9036b2484e425ca4443ad31ade2867.ts
#EXTINF:5.991333,
#EXT-X-BYTERANGE:29892@30644
9a9036b2484e425ca4443ad31ade2867.ts
#EXTINF:5.991333,
#EXT-X-BYTERANGE:31020@60536
9a9036b2484e425ca4443ad31ade2867.ts
#EXTINF:5.991333,
#EXT-X-BYTERANGE:30832@91556
9a9036b2484e425ca4443ad31ade2867.ts
#EXTINF:5.832267,
#EXT-X-BYTERANGE:29892@122388
9a9036b2484e425ca4443ad31ade2867.ts
#EXT-X-ENDLIST


$ /usr/local/bin/ffmpeg -version
ffmpeg version N-95760-g315a449 Copyright (c) 2000-2019 the FFmpeg
developers
built with gcc 7 (Ubuntu 7.4.0-1ubuntu1~18.04.1)
configuration: --prefix=/home/vagrant/ffmpeg/build
--pkg-config-flags=--static
--extra-cflags=-I/home/vagrant/ffmpeg/build/include
--extra-ldflags=-L/home/vagrant/ffmpeg/build/lib --bindir=/home/vagrant/bin
--enable-openssl --enable-gpl --enable-libass --enable-libfdk-aac
--enable-libfreetype --enable-libmp3lame --enable-libopus
--enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264
--enable-libx265 --enable-nonfree
libavutil      56. 36.100 / 56. 36.100
libavcodec     58. 62.100 / 58. 62.100
libavformat    58. 35.100 / 58. 35.100
libavdevice    58.  9.100 / 58.  9.100
libavfilter     7. 66.100 /  7. 66.100
libswscale      5.  6.100 /  5.  6.100
libswresample   3.  6.100 /  3.  6.100
libpostproc    55.  6.100 / 55.  6.100
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: why are my streams not aligned?

kumowoon1025
The target duration randomly being changed to 7 is weird, but why are you doing this at all? Can’t you just do a simple encoding to a ts file for the video first with the right gop settings then have that be the reference for creating the hls playlist? Or even just create the ts file from both video and audio and prepare it for hls? Because how do you know they were synched to a common clock in the first place...
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: why are my streams not aligned?

gordon
On Mon, Nov 18, 2019 at 12:37 PM Ted Park <[hidden email]> wrote:

> The target duration randomly being changed to 7 is weird, but why are you
> doing this at all? Can’t you just do a simple encoding to a ts file for the
> video first with the right gop settings then have that be the reference for
> creating the hls playlist? Or even just create the ts file from both video
> and audio and prepare it for hls? Because how do you know they were synched
> to a common clock in the first place...
> _______________________________________________
> ffmpeg-user mailing list
> [hidden email]
> https://ffmpeg.org/mailman/listinfo/ffmpeg-user
>
> To unsubscribe, visit link above, or email
> [hidden email] with subject "unsubscribe".


I am not sure what you mean?  I thought I was doing a simple encoding:

-  One input video only, one output for video.
- One audio input plus a finalized video input for the audio output.

Map is used to end up with a video only stream and an audio only stream.

I am only including the copied video because I was under the impression
that it was required to properly segment the audio file.  It is omitted
from the final output on the audio only stream.
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: why are my streams not aligned?

kumowoon1025

> I am not sure what you mean?  I thought I was doing a simple encoding:
>
> -  One input video only, one output for video.
> - One audio input plus a finalized video input for the audio output.
Yes, but you have separate (raw) input sources.

I think by alignment you are referring to the segment durations varying from each variant to another which could be a simple fix (at least I think?)
> Map is used to end up with a video only stream and an audio only stream.
by using the variant map for the hls muxer.

But then when you play the result, are the video and audio going to be in sync is what I’m wondering, since they come from separate sources, and processed on separate tasks.

> I am only including the copied video because I was under the impression
> that it was required to properly segment the audio file.

The audio stream doesn’t even have to be ts, you could have separate aac files for each segment. If you mean properly wrt synchronization, that’s what I’m wondering, since you have separate audio and video sources, is that even going to make any difference?

i.e. if you simply multiplex the input and output, are the video and audio in sync? If so, using that file and variant map would make things a lot simpler.
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: why are my streams not aligned?

gordon
On Mon, Nov 18, 2019 at 1:08 PM Ted Park <[hidden email]> wrote:

>
> > I am not sure what you mean?  I thought I was doing a simple encoding:
> >
> > -  One input video only, one output for video.
> > - One audio input plus a finalized video input for the audio output.
> Yes, but you have separate (raw) input sources.
>
> I think by alignment you are referring to the segment durations varying
> from each variant to another which could be a simple fix (at least I think?)
> > Map is used to end up with a video only stream and an audio only stream.
> by using the variant map for the hls muxer.
>
> But then when you play the result, are the video and audio going to be in
> sync is what I’m wondering, since they come from separate sources, and
> processed on separate tasks.
>
> > I am only including the copied video because I was under the impression
> > that it was required to properly segment the audio file.
>
> The audio stream doesn’t even have to be ts, you could have separate aac
> files for each segment. If you mean properly wrt synchronization, that’s
> what I’m wondering, since you have separate audio and video sources, is
> that even going to make any difference?
>
> i.e. if you simply multiplex the input and output, are the video and audio
> in sync? If so, using that file and variant map would make things a lot
> simpler.
> _______________________________________________
> ffmpeg-user mailing list
> [hidden email]
> https://ffmpeg.org/mailman/listinfo/ffmpeg-user
>
> To unsubscribe, visit link above, or email
> [hidden email] with subject "unsubscribe".



Your questions made me check the source in more detail =)  I picked a
random test video from FFMPEG test cases to run through processing.  The
audio duration is longer than the video duration.  I think that is my issue
here, but I will report back if it turns out not to be the problem!
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".