[FFmpeg-user] ffmpeg for transcoding a stream into web pag

R C cjvijf at gmail.com
Thu May 9 06:55:23 EEST 2019


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 <mikeshaffer at gmail.com 
> <mailto:mikeshaffer at gmail.com>> 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 <cjvijf at gmail.com
>     <mailto:cjvijf at gmail.com>> 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<cjvijf at gmail.com>  <mailto:cjvijf at gmail.com>  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
>>>>         ffmpeg-user at ffmpeg.org  <mailto:ffmpeg-user at ffmpeg.org>
>>>>         https://ffmpeg.org/mailman/listinfo/ffmpeg-user
>>>>
>>>>         To unsubscribe, visit link above, or email
>>>>         ffmpeg-user-request at ffmpeg.org  <mailto:ffmpeg-user-request at ffmpeg.org>  with subject "unsubscribe".
>>>         _______________________________________________
>>>         ffmpeg-user mailing list
>>>         ffmpeg-user at ffmpeg.org  <mailto:ffmpeg-user at ffmpeg.org>
>>>         https://ffmpeg.org/mailman/listinfo/ffmpeg-user
>>>
>>>         To unsubscribe, visit link above, or email
>>>         ffmpeg-user-request at ffmpeg.org  <mailto:ffmpeg-user-request at ffmpeg.org>  with subject "unsubscribe".
>>         _______________________________________________
>>         ffmpeg-user mailing list
>>         ffmpeg-user at ffmpeg.org  <mailto:ffmpeg-user at ffmpeg.org>
>>         https://ffmpeg.org/mailman/listinfo/ffmpeg-user
>>
>>         To unsubscribe, visit link above, or email
>>         ffmpeg-user-request at ffmpeg.org  <mailto:ffmpeg-user-request at ffmpeg.org>  with subject "unsubscribe".
>


More information about the ffmpeg-user mailing list