Não é possível reproduzir o m3u8 ao vivo, mas é capaz de reproduzir o mjpeg usando o ffserver

0

Oi eu estou tentando configurar o ffserver para transmitir vídeo ao vivo. Para fins de teste, usei aqui o arquivo estático 'temp.mp4'. Quando eu tento transmitir mjpeg, então funciona bem para mim playlist.m3u8 nunca funcionou para mim. Por favor, olhe a configuração e deixe-me saber se alguma alteração é necessária.

1. configuração do servidor

cat /etc/ffserver.conf HTTPPort 8080 HTTPBindAddress 0.0.0.0 MaxHTTPConnections 20 MaxClients 10 MaxBandwidth 5000
#NoDaemon

<Feed webcam.ffm>
      file /tmp/webcam.ffm
      FileMaxSize 200K
      ACL allow 127.0.0.1
      ACL allow localhost
      ACL allow 192.168.1.0 192.168.1.255 </Feed>

<Stream webcam.mjpeg>   Feed webcam.ffm     Format mjpeg    VideoSize 640x360   VideoFrameRate 15   VideoBitRate 2000   VideoQMin 1     VideoQMax 10 </Stream>

<Feed feed1.ffm>    File /tmp/feed1.ffm     FileMaxSize 1G      ACL allow localhost
        ACL allow 127.0.0.1
        ACL allow 192.168.1.0 192.168.1.255 </Feed>

<Stream playlist.m3u8>      Feed feed1.ffm      Format HLS      VideoCodec libx264      VideoFrameRate 30   VideoBitRate 128    VideoSize 704*480   #AVOptionVideo hls_time 10      #AVOptionVideo hls_list_size 0      AVOptionVideo flags +global_header      AudioCodec ac3      AudioBitRate 128    AudioChannels 2     AudioSampleRate 48000  </Stream>

<Stream stat.html>
        Format status
        # Only allow local people to get the status
        ACL allow localhost </Stream>  <Redirect index.html>    # Redirect index.html to the appropriate site    URL http://www.ffmpeg.org/ </Redirect

step2: start ffserver
ffserver -d -loglevel debug -f /etc/ffserver.conf
Thu May 31 11:11:00 2018 [hls @ 0x18021f0]failed to rename file .tmp to 
Thu May 31 11:11:10 2018 [AVIOContext @ 0x18157a0]Statistics: 0 seeks, 303 writeouts
Thu May 31 11:11:10 2018 [hls @ 0x18021f0]EXT-X-MEDIA-SEQUENCE:10
Thu May 31 11:11:10 2018 [AVIOContext @ 0x1815920]Statistics: 0 seeks, 1 writeouts
Thu May 31 11:11:10 2018 [hls @ 0x18021f0]failed to rename file .tmp to 
Thu May 31 11:11:13 2018 [AVIOContext @ 0x18157a0]Statistics: 0 seeks, 139 writeouts
Thu May 31 11:11:13 2018 [hls @ 0x18021f0]EXT-X-MEDIA-SEQUENCE:11
Thu May 31 11:11:13 2018 [AVIOContext @ 0x1815800]Statistics: 0 seeks, 1 writeouts
Thu May 31 11:11:13 2018 [hls @ 0x18021f0]failed to rename file .tmp to 

step3: feed input to ffserver
    ffmpeg -i temp.mp4 -vcodec libx264 -acodec copy -f ssegment -segment_list_flags +live -segment_list playlist.m3u8 -segment_time 10 out%03d.ts  http://127.0.0.1:8080/feed1.ffm

4. play using ffplay
ffplay http:127.0.0.1:8080/playlist.m3u8
ffplay version 3.1.9 Copyright (c) 2003-2017 the FFmpeg developers
  built with gcc 6.3.1 (GCC) 20161221 (Red Hat 6.3.1-1)
  configuration: --prefix=/usr --bindir=/usr/bin --datadir=/usr/share/ffmpeg --incdir=/usr/include/ffmpeg --libdir=/usr/lib64 --mandir=/usr/share/man --arch=x86_64 --optflags='-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64 -mtune=generic' --extra-ldflags='-Wl,-z,relro -specs=/usr/lib/rpm/redhat/redhat-hardened-ld' --enable-bzlib --disable-crystalhd --enable-fontconfig --enable-frei0r --enable-gcrypt --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libcdio --enable-indev=jack --enable-libfreetype --enable-libfribidi --enable-libgsm --enable-libmp3lame --enable-nvenc --extra-cflags=-I/usr/include/nvenc --enable-openal --enable-opencl --enable-libopencv --enable-opengl --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libvorbis --enable-libv4l2 --enable-libvpx --enable-libx264 --enable-libx265 --enable-libxvid --enable-x11grab --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. 28.100 / 55. 28.100
  libavcodec     57. 48.101 / 57. 48.101
  libavformat    57. 41.100 / 57. 41.100
  libavdevice    57.  0.101 / 57.  0.101
  libavfilter     6. 47.100 /  6. 47.100
  libavresample   3.  0.  0 /  3.  0.  0
  libswscale      4.  1.100 /  4.  1.100
  libswresample   2.  1.100 /  2.  1.100
  libpostproc    54.  0.100 / 54.  0.100
    nan    :  0.000 fd=   0 aq=    0KB vq=    0KB sq=    0B f=0/0   
    nan    :  0.000 fd=   0 aq=    0KB vq=    0KB sq=    0B f=0/0   
    nan    :  0.000 fd=   0 aq=    0KB vq=    0KB sq=    0B f=0/0   
^C[root@localhost bin]# ^C0 aq=    0KB vq=    0KB sq=    0B f=0/0 

6. <connection feeds>
Connection Status
Number of connections: 3 / 10
Bandwidth in use: 256k / 5000k
#   File    IP  Proto   State   Target bits/sec Actual bits/sec Bytes transferred
1   stat.html   127.0.0.1   HTTP/1.1    HTTP_WAIT_REQUEST   0   0   0
2   playlist.m3u8   127.0.0.1   HTTP/1.1    WAIT_FEED   256k    0   79
3   feed1.ffm(input)    127.0.0.1   HTTP/1.1    RECEIVE_DATA    256k    359k    3227k
  1. Eu tentei jogar localmente, o que funciona sempre para mim. ffplay playlist.m3u8

  2. notas extras: abaixo de uma sempre funciona para mim feed: ffmpeg -r 15 -i temp.mp4 link play: ffplay link

Por favor, deixe-me saber como proceder e depurar este ambiente.

Obrigado Vijay

    
por vijayky88 31.05.2018 / 08:21

0 respostas