[FFmpeg-devel] [PATCH] Add mkdir support for HLS localtime-generated segment files

Michael Niedermayer michael at niedermayer.cc
Wed Feb 17 16:26:01 CET 2016


On Tue, Feb 16, 2016 at 09:03:52PM +0100, Johan Ström wrote:
> On 16/02/16 00:59, Michael Niedermayer wrote:
> >On Mon, Feb 15, 2016 at 10:35:57PM +0100, Johan Ström wrote:
> >>Thanks for your attention!
> >>
> >>Updated patch attached. It has been rebased against current master
> >>(avio_open2->ffio_open_whitelist changes) with no issues.
> >>
> >>On 14/02/16 01:29, Michael Niedermayer wrote:
> >>>On Wed, Feb 03, 2016 at 10:44:28PM +0100, Johan Ström wrote:
> >>>>Hi,
> >>>>
> >>>>this patch adds -use_localtime_mkdir option to the HLS encoder.
> >>>>Use with -use_localtime, and set -hls_segment_filename to a path
> >>>>which contains a subdirectory i.e.
> >>>>/some/path/%Y%m%d/%Y%m%dT%H%M%S-%s.ts
> >>>>This will mkdir the %Y%m%d-part of the path if it does not already exist.
> >>>>
> >>>>In addition, each filename in the playlist output will be prefixed
> >>>>with this subdirectory (if playlist and segment shares the same base
> >>>>path).
> >>...
> >>>missing update to the docs
> >>Actually, there was no docs for the -use_localtime property at all.
> >>I've added for both use_localtime and use_localtime_mkdir now.
> >what happens if the path is not a local file but for example
> >http://...
> >
> >if that otherwise works but fails with the new option then it should
> >be documented and maybe tested for. It may seem logic for us but a
> >user might be confused why the option doesnt work for that
> That is not possible in any mode, and neither would I expect it to.
> 
> The following is with -use_localtime 1 -hls_segment_filename
> http://localhost/test/%d.ts:
> 
> [tcp @ 0x80401e880] Connection to tcp://localhost:80 failed
> (Connection refused), trying next address
> Output #0, hls, to '/storage/dvr/ipcam//test/playlist.m3u8':
>   Metadata:
>     title           : RTSP Session
>     encoder         : Lavf57.25.100
>     Stream #0:0: Video: h264, yuv420p, 352x288, q=2-31, 25 fps, 25
> tbr, 25 tbn, 25 tbc
> Stream mapping:
>   Stream #0:0 -> #0:0 (copy)
> Press [q] to stop, [?] for help
> ..
> [tcp @ 0x804065080] Connection to tcp://back-1:80 failed (Connection
> refused), trying next address
> [tcp @ 0x804065080] Connection to tcp://back-1:80 failed (Connection
> refused), trying next address
> frame=  198 fps= 29 q=-1.0 Lsize=N/A time=00:00:07.92 bitrate=N/A
> speed=1.17x
> video:350kB audio:0kB subtitle:0kB other streams:0kB global
> headers:0kB muxing overhead: unknown
> Exiting normally, received signal 2.
> 
> Same thing without -use_localtime 1.
> So, it seems it tries to use some kind of tcp transport (rather than HTTP).
> 
> I did notice a minor typo in my docs patch, so a new patch is attached.
> 
> >>>also can you add a fate test for this feature ?
> >>Sorry, I have no idea how those works or how to write one. As far as
> >>I can see there are none for HLS today which I could extend on..
> >yes, it would be great to have hls fate tests
> >without such tests someone might break hls without him noticing ...
> >but thats orthogonal to the patch
> 
> Indeed. But I'm probably not the right one to write them.
> 

>  doc/muxers.texi      |   20 ++++++++++++++++++++
>  libavformat/hlsenc.c |   50 +++++++++++++++++++++++++++++++++++++++++++-------
>  2 files changed, 63 insertions(+), 7 deletions(-)
> 038c27bf1fa6c5045fc0c2deb3b943c65fd194ca  0001-hlsenc-add-use_localtime_mkdir-option-to-automatical.patch
> From 443289a36c71bfecbc748ad706d2fa35d3659e90 Mon Sep 17 00:00:00 2001
> From: =?UTF-8?q?Johan=20Str=C3=B6m?= <johan at stromnet.se>
> Date: Wed, 3 Feb 2016 22:20:07 +0100
> Subject: [PATCH] hlsenc: add use_localtime_mkdir option to automatically
>  create time-based directory
> 
> Use with -use_localtime, and set -hls_segment_filename to a path which
> contains a subdirectory i.e. /some/path/%Y%m%d/%Y%m%dT%H%M%S-%s.ts
> This will mkdir the %Y%m%d-part of the path if it does not already
> exist.
> In addition, each filename in the playlist output will be prefixed with
> this subdirectory (if playlist and segment shares the same base path).
> ---
>  doc/muxers.texi      | 20 ++++++++++++++++++++
>  libavformat/hlsenc.c | 50 +++++++++++++++++++++++++++++++++++++++++++-------
>  2 files changed, 63 insertions(+), 7 deletions(-)

applied

thanks

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Many that live deserve death. And some that die deserve life. Can you give
it to them? Then do not be too eager to deal out death in judgement. For
even the very wise cannot see all ends. -- Gandalf
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20160217/c4c0a84e/attachment.sig>


More information about the ffmpeg-devel mailing list