[FFmpeg-user] segmenter creates empty m3u8 file

Christian Ebert blacktrash at gmx.net
Fri Jun 29 14:11:38 CEST 2012


* Stefano Sabatini on Monday, June 25, 2012 at 14:59:56 +0200
> On date Tuesday 2012-06-19 07:51:35 +0100, Christian Ebert encoded:
>> * Hector Cano on Monday, June 18, 2012 at 17:35:49 +0200
>>> On Mon, Jun 18, 2012 at 5:01 PM, Christian Ebert <blacktrash at gmx.net> wrote:
>>>> -segment_list_size triggers some content to be written to the
>>>> test.m3u8 file - not very useful though, basically the same as
>>>> $ ls -1 *.ts > test.m3u8
>>>> But the manual says so, so I guess I cannot complain, and have to
>>>> look for a "real" segmenter, or experiment with creating an m3u8
>>>> myself.
>>> 
>>> Have you tried including the desired segment length?
>>> 
>>> -segment_time 10
>>> 
>>> That should produce 10 second long segments, as far as I have tested.
>> 
> 
>> I thought so as well, but at least from my mp4 test file it does
>> not make any difference - varying segment lengths from ~ 3.1 secs
>> to 19.46 secs.
> 
> Segment lenght depends on the key-frames present in the file to be
> fragmented, that is each fragment must start with a key-frame so the
> segmenter may not honour the specified size in case there are not
> "enough" key frames in the source file.
> 
> You can use -force_key_frames to force frames at a given position when 
> transcoding.

This works well, thank you.

> I extended the segmenter, you may have a look at the following link,
> create a ticket if you want to track the branch integration:
> http://gitorious.org/~saste/ffmpeg/sastes-ffmpeg/commits/misc-segment-fixes-20120206

Thanks. Does this only improve the output to segment_list, or are
there changes/improvements to the segmenter itself?

I now achieve more or less satisfying results with -f segment
from the master branch, and then running something like this on
the resulting segment_list for apple hls (where temp.m3u8 is the
resulting file from ffmpeg and pl.m3u8 is the final file):


lcount=1
plines=`wc -l temp.m3u8 | awk '{ print $1 }'`
cat > pl.m3u8 <<EOT
#EXTM3U
#EXT-X-TARGETDURATION:10
#EXT-X-MEDIA-SEQUENCE:1
EOT
(while read line; do
    if [ $lcount -lt $plines ]; then
        echo '#EXTINF:10,' >> pl.m3u8
    else
        dur=`$FFPROBE -show_streams \
                      $(tail -1 temp.m3u8) 2>/dev/null \
            | awk -F '[=.]' '/^duration/ { print $2 }' | head -1`
        echo "#EXTINF:$dur," >> pl.m3u8
    fi
    echo "$line" >> pl.m3u8
    let $((lcount++))
done) < temp.m3u8
echo '#EXT-X-ENDLIST' >> pl.m3u8


-- 
\black\trash movie   _SAME  TIME  SAME  PLACE_
	       New York, in the summer of 2001

--->> http://www.blacktrash.org/underdogma/stsp.php


More information about the ffmpeg-user mailing list