ffmpeg for transcoding a stream into web pag

classic Classic list List threaded Threaded
16 messages Options
R C
Reply | Threaded
Open this post in threaded view
|

ffmpeg for transcoding a stream into web pag

R C
Hello,

this  probably has been asked a million times before.

I have a few IP cameras (onvif) that I can get stills and video out of with
scriprts.

What I would want to do is  put a stream into a web page, html document.
I'd prefer to used "something different" than  rtsp, to be used by the
browser because rtsp seems to be blocked more and more (people watching
baby monitors crashing networks).

From what I read is that ffmpeg can be used to 'transcode' an rtsp stream,
to a format that directly can be used in a browser (firefox)? If so, is
there an exam[le or write up for how to do that?

thanks,

Ron
_______________________________________________
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: ffmpeg for transcoding a stream into web pag

kumowoon1025
> I have a few IP cameras (onvif) that I can get stills and video out of with
> scriprts.
What exactly can you get out of your cameras? (Format, codec, protocol, etc.)
Is this a live stream you want to serve?

> What I would want to do is  put a stream into a web page, html document.
> I'd prefer to used "something different" than  rtsp, to be used by the
> browser because rtsp seems to be blocked more and more (people watching
> baby monitors crashing networks).
I don’t understand the bit about baby monitors crashing networks, but if you don’t want rtsp, you might consider HLS or DASH.
More details about the source would be needed to know what steps to take.

> From what I read is that ffmpeg can be used to 'transcode' an rtsp stream,
> to a format that directly can be used in a browser (firefox)? If so, is
> there an exam[le or write up for how to do that?
With some configuration on the http server an rtsp stream can be served as is, but rtsp is a protocol, it doesn’t tell us anything about what is being streamed.

_______________________________________________
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".
R C
Reply | Threaded
Open this post in threaded view
|

Re: ffmpeg for transcoding a stream into web pag

R C
I can get pretty much anything out of it I want.  It is an onvif camera,
so with some C, soap, xml, I can access it,  get URIs,  and can do things
like a reboot etc.
I can get snapshots out, and  streams,  H.264 and mp4.  I can also  access
it with VLC and stream different resolutions with it. So that part is not
the problem.

The problem is that I want some  that is common, stream over HTTP, are
flash etc, because as I said,  rtsp (and 'related protocols' are often
blocked.)

So my idea was tho use ffmpeg or gstreamer to  embed it in html, with some
sort of player.

On Thu, May 2, 2019 at 1:16 AM Ted Park <[hidden email]> wrote:

> > I have a few IP cameras (onvif) that I can get stills and video out of
> with
> > scriprts.
> What exactly can you get out of your cameras? (Format, codec, protocol,
> etc.)
> Is this a live stream you want to serve?
>
> > What I would want to do is  put a stream into a web page, html document.
> > I'd prefer to used "something different" than  rtsp, to be used by the
> > browser because rtsp seems to be blocked more and more (people watching
> > baby monitors crashing networks).
> I don’t understand the bit about baby monitors crashing networks, but if
> you don’t want rtsp, you might consider HLS or DASH.
> More details about the source would be needed to know what steps to take.
>
> > From what I read is that ffmpeg can be used to 'transcode' an rtsp
> stream,
> > to a format that directly can be used in a browser (firefox)? If so, is
> > there an exam[le or write up for how to do that?
> With some configuration on the http server an rtsp stream can be served as
> is, but rtsp is a protocol, it doesn’t tell us anything about what is being
> streamed.
>
> _______________________________________________
> 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: ffmpeg for transcoding a stream into web pag

kumowoon1025
> So my idea was tho use ffmpeg or gstreamer to  embed it in html, with some
> sort of player.
Html you’re gonna need to write yourself, but you can use the rtsp stream as an input and output HLS to embed in your html, I think this will get you what you want.

Something like

ffmpeg -i rtsp://192.0.2.123/stream.sdp -f hls -hls_playlist_type event -hls_segment_type mpegts -hls_segment_filename segment-%d.ts index.m3u8

Will produce a playlist file pointing to little segments of ts files that you can host with any http server. It should work,  (you might need to transcode to h264 if it’s not) A html5 video element with the playlist file as the source should play in most browsers nowadays.

<video autoplay controls src=“url/to/index.m3u8”>This text displays if the video element isn’t supported.</video>
_______________________________________________
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".
R C
Reply | Threaded
Open this post in threaded view
|

Re: ffmpeg for transcoding a stream into web pag

R C
Hello Ted,


that seems to work!  thank you!!  That ffmpeg command is indeed making a
movie from that stream into a file, tried watching it, VLC does give me
trouble, but it shows it as a movie.

Would be cool if I could have the output as a stream, that I can embed.

I am new to ffmpeg and gstreamer things.. and the command options don't
seem to be too obvious to me


thanks,


Ron



On 5/3/19 2:17 AM, Ted Park wrote:

>> So my idea was tho use ffmpeg or gstreamer to  embed it in html, with some
>> sort of player.
> Html you’re gonna need to write yourself, but you can use the rtsp stream as an input and output HLS to embed in your html, I think this will get you what you want.
>
> Something like
>
> ffmpeg -i rtsp://192.0.2.123/stream.sdp -f hls -hls_playlist_type event -hls_segment_type mpegts -hls_segment_filename segment-%d.ts index.m3u8
>
> Will produce a playlist file pointing to little segments of ts files that you can host with any http server. It should work,  (you might need to transcode to h264 if it’s not) A html5 video element with the playlist file as the source should play in most browsers nowadays.
>
> <video autoplay controls src=“url/to/index.m3u8”>This text displays if the video element isn’t supported.</video>
> _______________________________________________
> 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: ffmpeg for transcoding a stream into web pag

Michael Shaffer
Have you experimented with Unreal Live Server?

http://www.umediaserver.net/umediaserver/download.html

On Fri, May 3, 2019 at 6:58 PM R C <[hidden email]> wrote:

> Hello Ted,
>
>
> that seems to work!  thank you!!  That ffmpeg command is indeed making a
> movie from that stream into a file, tried watching it, VLC does give me
> trouble, but it shows it as a movie.
>
> Would be cool if I could have the output as a stream, that I can embed.
>
> I am new to ffmpeg and gstreamer things.. and the command options don't
> seem to be too obvious to me
>
>
> thanks,
>
>
> Ron
>
>
>
> On 5/3/19 2:17 AM, Ted Park wrote:
> >> So my idea was tho use ffmpeg or gstreamer to  embed it in html, with
> some
> >> sort of player.
> > Html you’re gonna need to write yourself, but you can use the rtsp
> stream as an input and output HLS to embed in your html, I think this will
> get you what you want.
> >
> > Something like
> >
> > ffmpeg -i rtsp://192.0.2.123/stream.sdp -f hls -hls_playlist_type event
> -hls_segment_type mpegts -hls_segment_filename segment-%d.ts index.m3u8
> >
> > Will produce a playlist file pointing to little segments of ts files
> that you can host with any http server. It should work,  (you might need to
> transcode to h264 if it’s not) A html5 video element with the playlist file
> as the source should play in most browsers nowadays.
> >
> > <video autoplay controls src=“url/to/index.m3u8”>This text displays if
> the video element isn’t supported.</video>
> > _______________________________________________
> > 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".
_______________________________________________
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".
R C
Reply | Threaded
Open this post in threaded view
|

Re: ffmpeg for transcoding a stream into web pag

R C
uhm...   no...


basically, I just want "some way"  to pull a stream from a camera, and
display it in a web page,  basically rstsp over http...   I don't really
want to try anything commercial.  It shouldn't be too difficult, accept,
since a bit, streaming with players is disabled in most browsers.


Ron



On 5/3/19 5:19 PM, Michael Shaffer wrote:

> Have you experimented with Unreal Live Server?
>
> http://www.umediaserver.net/umediaserver/download.html
>
> On Fri, May 3, 2019 at 6:58 PM R C <[hidden email]> wrote:
>
>> Hello Ted,
>>
>>
>> that seems to work!  thank you!!  That ffmpeg command is indeed making a
>> movie from that stream into a file, tried watching it, VLC does give me
>> trouble, but it shows it as a movie.
>>
>> Would be cool if I could have the output as a stream, that I can embed.
>>
>> I am new to ffmpeg and gstreamer things.. and the command options don't
>> seem to be too obvious to me
>>
>>
>> thanks,
>>
>>
>> Ron
>>
>>
>>
>> On 5/3/19 2:17 AM, Ted Park wrote:
>>>> So my idea was tho use ffmpeg or gstreamer to  embed it in html, with
>> some
>>>> sort of player.
>>> Html you’re gonna need to write yourself, but you can use the rtsp
>> stream as an input and output HLS to embed in your html, I think this will
>> get you what you want.
>>> Something like
>>>
>>> ffmpeg -i rtsp://192.0.2.123/stream.sdp -f hls -hls_playlist_type event
>> -hls_segment_type mpegts -hls_segment_filename segment-%d.ts index.m3u8
>>> Will produce a playlist file pointing to little segments of ts files
>> that you can host with any http server. It should work,  (you might need to
>> transcode to h264 if it’s not) A html5 video element with the playlist file
>> as the source should play in most browsers nowadays.
>>> <video autoplay controls src=“url/to/index.m3u8”>This text displays if
>> the video element isn’t supported.</video>
>>> _______________________________________________
>>> 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".
> _______________________________________________
> 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".
R C
Reply | Threaded
Open this post in threaded view
|

Re: ffmpeg for transcoding a stream into web pag

R C
Hello Michael,


I have that ffmpeg command going, it seems


However I don't see anything really in the http/html page

(Just a sad smiley with the text: "No video with supported format and
MIME type found"


this is the HTML I am using:

<html>
<header>
</header>
<body>

<video width="320" height="240" controls>
   <source src="IP-Cameras/stream/index.m3u8" type="video/mp4">
   Your browser does not support the video tag.
</video>

</body>
</html>

ffmpeg is creating files like:

-rw-r--r-- 1 root   root       148 May  8 21:46 index.m3u8
-rw-r--r-- 1 root   root    628296 May  8 21:46 segment-0.ts
-rw-r--r-- 1 root   root   1962532 May  8 21:35 segment-10.ts
-rw-r--r-- 1 root   root   2030588 May  8 21:36 segment-11.ts


below is what ffmpeg throws on the terminal:


tia,  Ron


# ffmpeg -i
rtsp://192.168.x.y:554/user=admin_password=XXXXXXXX_channel=1_stream=0.sdp?real_stream
-f hls -hls_playlist_type event -hls_segment_type mpegts
-hls_segment_filename segment-%d.ts index.m3u8
ffmpeg version 3.4.6 Copyright (c) 2000-2019 the FFmpeg developers
   built with gcc 4.8.5 (GCC) 20150623 (Red Hat 4.8.5-36)
   configuration: --prefix=/usr --bindir=/usr/bin
--datadir=/usr/share/ffmpeg --docdir=/usr/share/doc/ffmpeg
--incdir=/usr/include/ffmpeg --libdir=/usr/lib64 --mandir=/usr/share/man
--arch=x86_64 --optflags='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2
-fexceptions -fstack-protector-strong --param=ssp-buffer-size=4
-grecord-gcc-switches -m64 -mtune=generic' --extra-ldflags='-Wl,-z,relro
' --extra-cflags=' ' --enable-libopencore-amrnb
--enable-libopencore-amrwb --enable-libvo-amrwbenc --enable-version3
--enable-bzlib --disable-crystalhd --enable-fontconfig --enable-gcrypt
--enable-gnutls --enable-ladspa --enable-libass --enable-libbluray
--enable-libcdio --enable-libdrm --enable-indev=jack
--enable-libfreetype --enable-libfribidi --enable-libgsm
--enable-libmp3lame --enable-nvenc --enable-openal --enable-opencl
--enable-opengl --enable-libopenjpeg --enable-libopus
--disable-encoder=libopus --enable-libpulse --enable-librsvg
--enable-libsoxr --enable-libspeex --enable-libtheora --enable-libvorbis
--enable-libv4l2 --enable-libvidstab --enable-libx264 --enable-libx265
--enable-libxvid --enable-libzvbi --enable-avfilter --enable-avresample
--enable-postproc --enable-pthreads --disable-static --enable-shared
--enable-gpl --disable-debug --disable-stripping --shlibdir=/usr/lib64
--enable-libmfx --enable-runtime-cpudetect
   libavutil      55. 78.100 / 55. 78.100
   libavcodec     57.107.100 / 57.107.100
   libavformat    57. 83.100 / 57. 83.100
   libavdevice    57. 10.100 / 57. 10.100
   libavfilter     6.107.100 /  6.107.100
   libavresample   3.  7.  0 /  3.  7.  0
   libswscale      4.  8.100 /  4.  8.100
   libswresample   2.  9.100 /  2.  9.100
   libpostproc    54.  7.100 / 54.  7.100
Guessed Channel Layout for Input Stream #0.1 : mono
Input #0, rtsp, from
'rtsp://192.168.x.y:554/user=admin_password=XXXXXXXX_channel=1_stream=0.sdp?real_stream':
   Metadata:
     title           : RTSP Session
   Duration: N/A, start: 0.000000, bitrate: N/A
     Stream #0:0: Video: h264 (Main), yuvj420p(pc, bt709, progressive),
1280x720, 6 fps, 6 tbr, 90k tbn, 12 tbc
     Stream #0:1: Audio: pcm_alaw, 8000 Hz, mono, s16, 64 kb/s
Stream mapping:
   Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
   Stream #0:1 -> #0:1 (pcm_alaw (native) -> aac (native))
Press [q] to stop, [?] for help
[aac @ 0x10a6e80] Too many bits 8832.000000 > 6144 per frame requested,
clamping to max
[libx264 @ 0x108a9a0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2
[libx264 @ 0x108a9a0] profile High, level 3.1
[libx264 @ 0x108a9a0] 264 - core 148 r2795 aaa9aa8 - H.264/MPEG-4 AVC
codec - Copyleft 2003-2017 - http://www.videolan.org/x264.html -
options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7
psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1
8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2
threads=22 lookahead_threads=3 sliced_threads=0 nr=0 decimate=1
interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2
b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250
keyint_min=6 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1
crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
[hls @ 0x1089fa0] Opening 'segment-0.ts' for writing
Output #0, hls, to 'index.m3u8':
   Metadata:
     title           : RTSP Session
     encoder         : Lavf57.83.100
     Stream #0:0: Video: h264 (libx264), yuvj420p(pc), 1280x720,
q=-1--1, 6 fps, 90k tbn, 6 tbc
     Metadata:
       encoder         : Lavc57.107.100 libx264
     Side data:
       cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
     Stream #0:1: Audio: aac (LC), 8000 Hz, mono, fltp, 48 kb/s
     Metadata:
       encoder         : Lavc57.107.100 aac
[hls @ 0x1089fa0] Packets poorly interleaved, failed to avoid negative
timestamp -18480 in stream 0.
Try -max_interleave_delta 0 as a possible workaround.
[hls @ 0x1089fa0] Packets poorly interleaved, failed to avoid negative
timestamp -3480 in stream 0.
Try -max_interleave_delta 0 as a possible workaround.
[hls @ 0x1089fa0] Opening 'index.m3u8.tmp' for writingitrate=N/A dup=6
drop=4 speed= 1.4x
frame=   79 fps=7.0 q=-1.0 Lsize=N/A time=00:00:15.36 bitrate=N/A dup=6
drop=4 speed=1.37x
video:519kB audio:68kB subtitle:0kB other streams:0kB global headers:0kB
muxing overhead: unknown
[libx264 @ 0x108a9a0] frame I:1     Avg QP:13.54  size:114503
[libx264 @ 0x108a9a0] frame P:40    Avg QP:18.48  size:  8896
[libx264 @ 0x108a9a0] frame B:38    Avg QP:26.25  size:  1593
[libx264 @ 0x108a9a0] consecutive B-frames: 34.2%  0.0% 15.2% 50.6%
[libx264 @ 0x108a9a0] mb I  I16..4: 13.4% 23.7% 62.9%
[libx264 @ 0x108a9a0] mb P  I16..4:  0.3%  0.4%  0.2%  P16..4: 26.2% 
3.8%  2.7%  0.0%  0.0%    skip:66.4%
[libx264 @ 0x108a9a0] mb B  I16..4:  0.0%  0.0%  0.0%  B16..8: 23.7% 
1.0%  0.3%  direct: 0.2%  skip:74.8%  L0:45.3% L1:52.0% BI: 2.8%
[libx264 @ 0x108a9a0] 8x8 transform intra:28.8% inter:16.8%
[libx264 @ 0x108a9a0] coded y,uvDC,uvAC intra: 66.5% 0.0% 0.0% inter:
8.1% 0.0% 0.0%
[libx264 @ 0x108a9a0] i16 v,h,dc,p: 48% 13% 19% 20%
[libx264 @ 0x108a9a0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 52% 23% 16% 2%  1% 
1%  1%  2%  3%
[libx264 @ 0x108a9a0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 47% 22%  7% 3%  3% 
4%  4%  5%  4%
[libx264 @ 0x108a9a0] i8c dc,h,v,p: 100%  0%  0%  0%
[libx264 @ 0x108a9a0] Weighted P-Frames: Y:2.5% UV:0.0%
[libx264 @ 0x108a9a0] ref P L0: 77.8%  3.3%  8.4% 10.0%  0.5%
[libx264 @ 0x108a9a0] ref B L0: 87.2%  5.0%  7.8%
[libx264 @ 0x108a9a0] ref B L1: 97.9%  2.1%
[libx264 @ 0x108a9a0] kb/s:322.58
[aac @ 0x10a6e80] Qavg: 60648.969
Exiting normally, received signal 2.







On 5/4/19 9:02 AM, Michael Shaffer wrote:

> For example, here I have 4 IP cameras embedded in one webpage.
>
> https://dca.neocities.org/
>
> On Sat, May 4, 2019 at 11:01 AM Michael Shaffer <[hidden email]
> <mailto:[hidden email]>> wrote:
>
>     You could use ffmpeg to stream the video to youtube live. You can
>     embed youtube live videos in web pages..
>
>     On Fri, May 3, 2019 at 10:42 PM R C <[hidden email]
>     <mailto:[hidden email]>> wrote:
>
>         uhm...   no...
>
>
>         basically, I just want "some way"  to pull a stream from a
>         camera, and display it in a web page,  basically rstsp over
>         http... I don't really want to try anything commercial. It
>         shouldn't be too difficult, accept, since a bit, streaming
>         with players is disabled in most browsers.
>
>
>         Ron
>
>
>
>         On 5/3/19 5:19 PM, Michael Shaffer wrote:
>>         Have you experimented with Unreal Live Server?
>>
>>         http://www.umediaserver.net/umediaserver/download.html
>>
>>         On Fri, May 3, 2019 at 6:58 PM R C<[hidden email]>  <mailto:[hidden email]>  wrote:
>>
>>>         Hello Ted,
>>>
>>>
>>>         that seems to work!  thank you!!  That ffmpeg command is indeed making a
>>>         movie from that stream into a file, tried watching it, VLC does give me
>>>         trouble, but it shows it as a movie.
>>>
>>>         Would be cool if I could have the output as a stream, that I can embed.
>>>
>>>         I am new to ffmpeg and gstreamer things.. and the command options don't
>>>         seem to be too obvious to me
>>>
>>>
>>>         thanks,
>>>
>>>
>>>         Ron
>>>
>>>
>>>
>>>         On 5/3/19 2:17 AM, Ted Park wrote:
>>>>>         So my idea was tho use ffmpeg or gstreamer to  embed it in html, with
>>>         some
>>>>>         sort of player.
>>>>         Html you’re gonna need to write yourself, but you can use the rtsp
>>>         stream as an input and output HLS to embed in your html, I think this will
>>>         get you what you want.
>>>>         Something like
>>>>
>>>>         ffmpeg -irtsp://192.0.2.123/stream.sdp  -f hls -hls_playlist_type event
>>>         -hls_segment_type mpegts -hls_segment_filename segment-%d.ts index.m3u8
>>>>         Will produce a playlist file pointing to little segments of ts files
>>>         that you can host with any http server. It should work,  (you might need to
>>>         transcode to h264 if it’s not) A html5 video element with the playlist file
>>>         as the source should play in most browsers nowadays.
>>>>         <video autoplay controls src=“url/to/index.m3u8”>This text displays if
>>>         the video element isn’t supported.</video>
>>>>         _______________________________________________
>>>>         ffmpeg-user mailing list
>>>>         [hidden email]  <mailto:[hidden email]>
>>>>         https://ffmpeg.org/mailman/listinfo/ffmpeg-user
>>>>
>>>>         To unsubscribe, visit link above, or email
>>>>         [hidden email]  <mailto:[hidden email]>  with subject "unsubscribe".
>>>         _______________________________________________
>>>         ffmpeg-user mailing list
>>>         [hidden email]  <mailto:[hidden email]>
>>>         https://ffmpeg.org/mailman/listinfo/ffmpeg-user
>>>
>>>         To unsubscribe, visit link above, or email
>>>         [hidden email]  <mailto:[hidden email]>  with subject "unsubscribe".
>>         _______________________________________________
>>         ffmpeg-user mailing list
>>         [hidden email]  <mailto:[hidden email]>
>>         https://ffmpeg.org/mailman/listinfo/ffmpeg-user
>>
>>         To unsubscribe, visit link above, or email
>>         [hidden email]  <mailto:[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: ffmpeg for transcoding a stream into web pag

kumowoon1025
> <video width="320" height="240" controls>
>   <source src="IP-Cameras/stream/index.m3u8" type="video/mp4">
>   Your browser does not support the video tag.
> </video>


The type for the “extended” m3u8 files for hls is registered as application/vnd.apple.mpegURL
Usually whatever handles mime types on your http server handles that for you.
personally I don’t mark mime types except maybe to make a link download instead of playing in browser.

You would put video/mp4 if it was an ISO format being embedded as a prerecorded file, but the m3u8 is just a text listing of where to find all the fragments.

Oh, and I forgot to mention, but the example I gave you was like the simplest thing that usually works on the major browsers. It doesn’t even meet the minimum specs for HLS, you might want to look into implementing more features (especially the ones notated “MUST”)



Sort of off topic, but maybe try using an HTML authoring tool out, or at least a decent text editor that checks syntax… I don’t know if any of these other things are contributing, probably not, but still:

> <html>
> <header>
> </header>
> <body>


You need to declare a document type, not sure if it got left out when you copy and pasted. i.e. <!DOCTYPE html>
You probably also meant to put <head>, not <header>, those are headers like you might see on the top of a page.
And If you actually don’t have anything in the html header, you don’t need to have them at all, just go from html to body.

> Would be cool if I could have the output as a stream, that I can embed.

Were you referring to the same problem when you said this? Or some other difference from real streaming protocols?

Have a look at some options available with the muxer to see if any look like they might be helpful
# ffmpeg -h muxer=hls | more

_______________________________________________
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".
R C
Reply | Threaded
Open this post in threaded view
|

Re: ffmpeg for transcoding a stream into web pag

R C
I might have made a few mistakes, :), when I threw hat together real
quick.  For some quick tests I did the document type didn't really matter.
(I used the html more as an "entry point"

I'll clean it up this weekend and give it a shot.   I did notice that the
ffmpeg command keeps "adding" new files, and the old ones don't really go
awa (deleted) if not needed anymore..  so I would probably have to look
into that.

I haven't done much (I mean pretty much nothing) with streaming video,
understanding what  options do in ffmpeg (or gstreamer) would help (looking
for a guide with examples that are useful)

thanks,

Ron


On Fri, May 10, 2019 at 10:58 AM Ted Park <[hidden email]> wrote:

> > <video width="320" height="240" controls>
> >   <source src="IP-Cameras/stream/index.m3u8" type="video/mp4">
> >   Your browser does not support the video tag.
> > </video>
>
>
> The type for the “extended” m3u8 files for hls is registered as
> application/vnd.apple.mpegURL
> Usually whatever handles mime types on your http server handles that for
> you.
> personally I don’t mark mime types except maybe to make a link download
> instead of playing in browser.
>
> You would put video/mp4 if it was an ISO format being embedded as a
> prerecorded file, but the m3u8 is just a text listing of where to find all
> the fragments.
>
> Oh, and I forgot to mention, but the example I gave you was like the
> simplest thing that usually works on the major browsers. It doesn’t even
> meet the minimum specs for HLS, you might want to look into implementing
> more features (especially the ones notated “MUST”)
>
>
>
> Sort of off topic, but maybe try using an HTML authoring tool out, or at
> least a decent text editor that checks syntax… I don’t know if any of these
> other things are contributing, probably not, but still:
>
> > <html>
> > <header>
> > </header>
> > <body>
>
>
> You need to declare a document type, not sure if it got left out when you
> copy and pasted. i.e. <!DOCTYPE html>
> You probably also meant to put <head>, not <header>, those are headers
> like you might see on the top of a page.
> And If you actually don’t have anything in the html header, you don’t need
> to have them at all, just go from html to body.
>
> > Would be cool if I could have the output as a stream, that I can embed.
>
> Were you referring to the same problem when you said this? Or some other
> difference from real streaming protocols?
>
> Have a look at some options available with the muxer to see if any look
> like they might be helpful
> # ffmpeg -h muxer=hls | more
>
> _______________________________________________
> 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".
R C
Reply | Threaded
Open this post in threaded view
|

Re: ffmpeg for transcoding a stream into web pag

R C
In reply to this post by kumowoon1025
about the "application/vnd.apple.mpegURL"

I'll try to mess with that a little today and see what happens



The HTML stuff,   I am not sure but if the doctype isn't there
html/html5 is assume, but you're right, I put it there.
Since html5, and I want to use the html5 video tag,  the header in an
html5 document is  now <header> instead of head.
I am aware I don't need it, if there's nothing in it, but at some point
there will be..  once I have the video working

Ron

On 5/10/19 10:58 AM, Ted Park wrote:

>> <video width="320" height="240" controls>
>>    <source src="IP-Cameras/stream/index.m3u8" type="video/mp4">
>>    Your browser does not support the video tag.
>> </video>
>
> The type for the “extended” m3u8 files for hls is registered as application/vnd.apple.mpegURL
> Usually whatever handles mime types on your http server handles that for you.
> personally I don’t mark mime types except maybe to make a link download instead of playing in browser.
>
> You would put video/mp4 if it was an ISO format being embedded as a prerecorded file, but the m3u8 is just a text listing of where to find all the fragments.
>
> Oh, and I forgot to mention, but the example I gave you was like the simplest thing that usually works on the major browsers. It doesn’t even meet the minimum specs for HLS, you might want to look into implementing more features (especially the ones notated “MUST”)
>
>
>
> Sort of off topic, but maybe try using an HTML authoring tool out, or at least a decent text editor that checks syntax… I don’t know if any of these other things are contributing, probably not, but still:
>
>> <html>
>> <header>
>> </header>
>> <body>
>
> You need to declare a document type, not sure if it got left out when you copy and pasted. i.e. <!DOCTYPE html>
> You probably also meant to put <head>, not <header>, those are headers like you might see on the top of a page.
> And If you actually don’t have anything in the html header, you don’t need to have them at all, just go from html to body.
>
>> Would be cool if I could have the output as a stream, that I can embed.
> Were you referring to the same problem when you said this? Or some other difference from real streaming protocols?
>
> Have a look at some options available with the muxer to see if any look like they might be helpful
> # ffmpeg -h muxer=hls | more
>
> _______________________________________________
> 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".
R C
Reply | Threaded
Open this post in threaded view
|

ffmpeg for transcoding/stream into web pag

R C
In reply to this post by kumowoon1025
Hello all,

I am a rookie at using ffmpeg (also trying gstreamer) to stream an IP
camera feed into a web page.


as suggested; I am trying to use this ffmpeg command:

ffmpeg -i
"rtsp://192.168.x.y:554/user=admin_password=XXXXXXXX_channel=1_stream=0.sdp?real_stream"
-f hls -hls_playlist_type event -hls_segment_type mpegts
-hls_segment_filename segment-%d.ts index.m3u8

which creates files like:

-rw-rw-r--   1 rocr rocr         276 May 12 19:56 index.m3u8
-rw-rw-r--   1 rocr rocr 1831120 May 12 19:53 segment-0.ts
-rw-rw-r--   1 rocr rocr 2272544 May 12 19:54 segment-1.ts
-rw-rw-r--   1 rocr rocr 1457752 May 12 19:55 segment-2.ts
-rw-rw-r--   1 rocr rocr 1456436 May 12 19:55 segment-3.ts
-rw-rw-r--   1 rocr rocr 1294380 May 12 19:56 segment-4.ts


the segment files are "MPEG-2 transport stream (video/mp2t)". Firefox
(60.6.1esr 64-bi) doesn't really want to play them. VLC does,  and I can
see there is actually video and audio in those files.


when I do this on a linux workstation, it works, as far as creating
these segments goes. I have the impression that ffmpeg keeps creating
new for as long as that comman runs? (that could become a problem), 
and  when i run this on a server,  the browser doesn't even find the
files (and probably can't play them anyway).


any suggestions?


thanks,


Ron

_______________________________________________
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".
R C
Reply | Threaded
Open this post in threaded view
|

ffmpeg for transcoding/stream into web pag

R C
In reply to this post by kumowoon1025
so I managed to create a stream and actually display it in a html/web page.


I am using: ffmpeg -i
"rtsp://192.168.x.y:554/user=admin_password=XXXXXXXX_channel=1_stream=0.sdp?real_stream"
-y -c:a aac -b:a 160000 -ac 2 -s 960x540 -c:v libx264 -b:v 800000
-hls_time 10 -hls_list_size 10 -start_number 1 mystream.m3u8


To be honest, I "stole" it (from a youtube video of all places) and I
have no idea what all the options do.


I would like to change a few things, in how ffmpeg is doing, what it is
doing.


ffmpeg creates a new file "mystreamnn.ts" every so much time, can the
old files be deleted automatically, or can it "wrap around" and start
from the start of the file again after a certain amount of time?

mystream.m3u8 is created after "mystream1.ts" is created/finished, can
it be created  as soon as ffmpeg starts, so the stream is "immediately"
available?


Or would this need a completely different approach?


thanks,


Ron

_______________________________________________
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: ffmpeg for transcoding/stream into web pag

kumowoon1025
> I am using: ffmpeg -i "rtsp://192.168.x.y:554/user=admin_password=XXXXXXXX_channel=1_stream=0.sdp?real_stream" -y -c:a aac -b:a 160000 -ac 2 -s 960x540 -c:v libx264 -b:v 800000 -hls_time 10 -hls_list_size 10 -start_number 1 mystream.m3u8

> ffmpeg creates a new file "mystreamnn.ts" every so much time, can the old files be deleted automatically, or can it "wrap around" and start from the start of the file again after a certain amount of time?

You set the maximum number of entries in the playlist to 10, so if you add -hls_flags delete_segments by default it should only keep 10 + 1 segments before deleting them.

> mystream.m3u8 is created after "mystream1.ts" is created/finished, can it be created  as soon as ffmpeg starts, so the stream is "immediately" available?

Well this is partly because HLS isn’t really a streaming protocol, I can’t think of any good way to avoid that initial delay. The recommended target duration of each segment is 6 seconds (or adjusted for drop frame) so if you change hls_time from 10 to 6 you could make it shorter but I don’t think that’s usually the “bottleneck,” so to speak. There’s the time needed to connect to the original rtsp source and transcode, for instance.

If you keep an instance running constantly, this would be a non-issue though?
_______________________________________________
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".
R C
Reply | Threaded
Open this post in threaded view
|

Re: ffmpeg for transcoding/stream into web pag

R C

On 5/12/19 11:03 PM, Ted Park wrote:
>> I am using: ffmpeg -i "rtsp://192.168.x.y:554/user=admin_password=XXXXXXXX_channel=1_stream=0.sdp?real_stream" -y -c:a aac -b:a 160000 -ac 2 -s 960x540 -c:v libx264 -b:v 800000 -hls_time 10 -hls_list_size 10 -start_number 1 mystream.m3u8
>> ffmpeg creates a new file "mystreamnn.ts" every so much time, can the old files be deleted automatically, or can it "wrap around" and start from the start of the file again after a certain amount of time?
> You set the maximum number of entries in the playlist to 10, so if you add -hls_flags delete_segments by default it should only keep 10 + 1 segments before deleting them.

I changed it to this:

ffmpeg -i
"rtsp://192.168.x.y:554/user=admin_password=XXXXXXXX_channel=1_stream=0.sdp?real_stream"
-y -c:a aac -b:a 160000 -ac 2 -s 960x540 -c:v libx264 -b:v 800000
-hls_time 6 -hls_list_size 10 -hls_flags delete_segments -start_number 1
mystream.m3u8


that doesn't delete the "old files" though


>> mystream.m3u8 is created after "mystream1.ts" is created/finished, can it be created  as soon as ffmpeg starts, so the stream is "immediately" available?
> Well this is partly because HLS isn’t really a streaming protocol, I can’t think of any good way to avoid that initial delay. The recommended target duration of each segment is 6 seconds (or adjusted for drop frame) so if you change hls_time from 10 to 6 you could make it shorter but I don’t think that’s usually the “bottleneck,” so to speak. There’s the time needed to connect to the original rtsp source and transcode, for instance.
>
> If you keep an instance running constantly, this would be a non-issue though?

true,  but the delay is about 60 seconds or so,  I think that is because
each segment is about that long?


> _______________________________________________
> 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: ffmpeg for transcoding/stream into web pag

Moritz Barsnick
On Sun, May 12, 2019 at 23:50:03 -0600, R C wrote:
> ffmpeg -i
> "rtsp://192.168.x.y:554/user=admin_password=XXXXXXXX_channel=1_stream=0.sdp?real_stream"
> -y -c:a aac -b:a 160000 -ac 2 -s 960x540 -c:v libx264 -b:v 800000
> -hls_time 6 -hls_list_size 10 -hls_flags delete_segments -start_number 1
> mystream.m3u8
>
> that doesn't delete the "old files" though

Hmm, works for me.

If you add "-loglevel debug", ffmpeg should say:
> [hls muxer @ 0xb9f7140] deleting old segment mystream1.ts
amongst all the other tons of information.

> > Well this is partly because HLS isn’t really a streaming protocol, I can’t think of any good way to avoid that initial delay. The recommended target duration of each segment is 6 seconds (or adjusted for drop frame) so if you change hls_time from 10 to 6 you could make it shorter but I don’t think that’s usually the “bottleneck,” so to speak. There’s the time needed to connect to the original rtsp source and transcode, for instance.
> >
> > If you keep an instance running constantly, this would be a non-issue though?
>
> true,  but the delay is about 60 seconds or so,  I think that is because
> each segment is about that long?

Possibly, because cutting at keyframes requires actual keyframes to
appear. :) You may need to force the maximum GOP to your segment size,
so that the sizes / durations can actually be achieved.

Note that there's also an option "-hls_init_time", to make the first
segment shorter than the subsequent ones. This was possibly introduced
exactly for reducing start-up delay. Do have a closer look at the docs:
https://ffmpeg.org/ffmpeg-formats.html#hls-2

Cheers,
Moritz
_______________________________________________
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".