Demo stream not working (black) - Ubuntu Server 16.04.3 LTS



  • Hello from Germany.
    I just found out about Shinobi and it looks so nice that i want to test it 😃

    Well it took hours to figure out how to install it on Ubuntu Server 16 without getting errors here and there.
    The problem is that i see just black instead of the demo stream.
    The stream works if i open the url in a browser: http://came3.nkansai.ne.jp:81/nphMotionJpeg?Resolution=640x480&Quality=Motion

    I get error messages if i click the triangle.
    But you can't select and copy the output/text to post it here?

    I'm still not sure if everything is right (permissions /owner/group/read/write).
    'test' is the username i have chosen on Ubuntu installation.
    Here is my installation procedure with some warnings i had:

    ~$ sudo apt update
    ~$ sudo apt upgrade
    ~$ sudo shutdown -r now
    ~$ sudo apt install software-properties-common python-software-properties curl gnupg2
    
    ~$ sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xF1656F24C74CD1D8
    ~$ sudo add-apt-repository 'deb [arch=amd64,i386,ppc64el] http://mirror.23media.de/mariadb/repo/10.2/ubuntu xenial main'
    ~$ sudo apt install mariadb-server mariadb-client
    ~$ sudo mysql_secure_installation
       > Enter current password for root (enter for none): 1234
       > Remove anonymous users?: yes
       > Disallow root login remotely?: no
       > Remove test database and access to it?: yes 
       > Reload privilege tables now?: yes
    
    ~$ sudo mysql -u root -p
    MariaDB [(none)]> CREATE USER 'majesticflame'@'127.0.0.1' IDENTIFIED BY '1234';
    MariaDB [(none)]> GRANT ALL PRIVILEGES ON * . * TO 'majesticflame'@'127.0.0.1';
    MariaDB [(none)]> flush privileges;
    MariaDB [(none)]> SELECT host, user FROM mysql.user;
    +-----------+---------------+
    | host      | user          |
    +-----------+---------------+
    | 127.0.0.1 | majesticflame |
    | localhost | root          |
    +-----------+---------------+
    MariaDB [(none)]> show grants for 'majesticflame'@'127.0.0.1';
    +-------------------------------------------------------------------------------------------------------------------------------+
    | Grants for [email protected]                                                                                            |
    +-------------------------------------------------------------------------------------------------------------------------------+
    | GRANT ALL PRIVILEGES ON *.* TO 'majesticflame'@'127.0.0.1' IDENTIFIED BY PASSWORD '*A4B6157319038724E3560894F7F932C8886EBFCF' |
    +-------------------------------------------------------------------------------------------------------------------------------+
    MariaDB [(none)]> quit;
    
    ~$ sudo add-apt-repository ppa:jonathonf/ffmpeg-3
    ~$ sudo apt update && sudo apt install ffmpeg libav-tools x264 x265
    
    ~$ curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
    ~$ sudo apt install nodejs
    
    ~$ sudo apt install git
    ~$ cd /usr/local
    ~$ sudo git clone https://github.com/ShinobiCCTV/Shinobi.git Shinobi
    ~$ sudo chown -R test:test /usr/local/Shinobi
    ~$ sudo chmod -R 755 /usr/local/Shinobi
    
    ~$ cd /usr/local/Shinobi/sql
    ~$ sudo mysql -u root -p
    MariaDB [(none)]> source ./framework.sql
    MariaDB [ccio]> source ./default_data.sql
    MariaDB [ccio]> SHOW WARNINGS;
    +-------+------+----------------------------------------------------------------------------+
    | Level | Code | Message                                                                    |
    +-------+------+----------------------------------------------------------------------------+
    | Note  | 1031 | Storage engine InnoDB of the table `ccio`.`Users` doesn't have this option |
    +-------+------+----------------------------------------------------------------------------+
    MariaDB [ccio]> GRANT ALL PRIVILEGES ON ccio.* TO 'majesticflame'@'127.0.0.1' IDENTIFIED BY '1234';
    MariaDB [ccio]> flush privileges;
    MariaDB [ccio]> show grants for 'majesticflame'@'127.0.0.1';
    +-------------------------------------------------------------------------------------------------------------------------------+
    | Grants for [email protected]                                                                                            |
    +-------------------------------------------------------------------------------------------------------------------------------+
    | GRANT ALL PRIVILEGES ON *.* TO 'majesticflame'@'127.0.0.1' IDENTIFIED BY PASSWORD '*A4B6157319038724E3560894F7F932C8886EBFCF' |
    | GRANT ALL PRIVILEGES ON `ccio`.* TO 'majesticflame'@'127.0.0.1'                                                               |
    +-------------------------------------------------------------------------------------------------------------------------------+
    MariaDB [ccio]> quit;
    
    ~$ cd /usr/local/Shinobi
    ~$ sudo chmod +x INSTALL/ubuntu.sh && INSTALL/ubuntu.sh
       > Shinobi - Do you want to Install Node.js?: no
       > Shinobi - Do you want to Install MariaDB?: no
       > Shinobi - Database Installation:= no
    
    npm WARN deprecated [email protected]: This package is no longer supported. It's now a built-in Node module. If you've depended on crypto, you should switch to the one that's built-in.
    npm notice created a lockfile as package-lock.json. You should commit this file.
    npm WARN [email protected] license should be a valid SPDX license expression
    npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/pm2/node_modules/fsevents):
    npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
    
       > Shinobi - Start Shinobi? = no
    
    ~$ nano conf.json
       > Set password to "1234"
    ~$ pm2 start camera.js
    

  • administrators

    thanks 😄 i hope you enjoy! Try importing this configuration https://cdn.shinobi.video/configs/CameraDemo1.json does it work?

    if no, please try setting the stream type to JPEG, does it show any picture? sometimes that camera is just really flaky (i suspect because i have set it as the demo camera 😅

    also can you please run ffmpeg in terminal and paste the big text wall it writes to the console? it will tell us what libraries are enabled in your build.



  • Hi. I've just setup Shinobi on an virtual Ubuntu Server 16.04 through Hyper-V.
    Sorry for bumping the thread, but it seems i experience the same problem with black streams, as above.

    I've added https://cdn.shinobi.video/configs/CameraDemo1.json as demo, with black output as result.
    If stream type set to JPEG, the picture changes to an orange background.

    I have one ip camera running fine on Zoneminder.. soon to change 😉
    Have not been able to get other than black screen with this.
    I noticed when inserting the rtsp url in the probe, resolution is detected but no framerate, apparently.
    When probe is running, network activity rises accordingly, so im assuming video is getting through 🙂

    Output: ffmpeg -version

    ffmpeg version 3.4.1-1~16.04.york0 Copyright (c) 2000-2017 the FFmpeg developers
      built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.5) 20160609
      configuration: --prefix=/usr --extra-version='1~16.04.york0' --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu 
    --enable-gpl --disable-stripping --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b
     --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm
     --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband 
    --enable-librsvg --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame 
    --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq 
    --enable-libzvbi --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 
    --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared
      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
    

    Probe output with rtsp url (If this can help in any way)

    >streams :
    0 :
    index : 0
    codec_name : h264
    codec_long_name : H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10
    codec_type : video
    codec_time_base : 0/2
    codec_tag_string : [0][0][0][0]
    codec_tag : 0x0000
    width : 1920
    height : 1080
    coded_width : 1920
    coded_height : 1080
    has_b_frames : 0
    sample_aspect_ratio : 0:1
    display_aspect_ratio : 0:1
    level : -99
    chroma_location : left
    refs : 1
    is_avc : false
    nal_length_size : 0
    r_frame_rate : 90000/1
    avg_frame_rate : 0/0
    time_base : 1/90000
    disposition :
    default : 0
    dub : 0
    original : 0
    comment : 0
    lyrics : 0
    karaoke : 0
    forced : 0
    hearing_impaired : 0
    visual_impaired : 0
    clean_effects : 0
    attached_pic : 0
    timed_thumbnails : 0
    1 :
    index : 1
    codec_name : pcm_alaw
    codec_long_name : PCM A-law / G.711 A-law
    codec_type : audio
    codec_time_base : 1/8000
    codec_tag_string : [0][0][0][0]
    codec_tag : 0x0000
    sample_fmt : s16
    sample_rate : 8000
    channels : 1
    bits_per_sample : 8
    r_frame_rate : 0/0
    avg_frame_rate : 0/0
    time_base : 1/8000
    bit_rate : 64000
    disposition :
    default : 0
    dub : 0
    original : 0
    comment : 0
    lyrics : 0
    karaoke : 0
    forced : 0
    hearing_impaired : 0
    visual_impaired : 0
    clean_effects : 0
    attached_pic : 0
    timed_thumbnails : 0
    format :
    filename : rtsp://192.168.8.136:554/11
    nb_streams : 2
    nb_programs : 0
    format_name : rtsp
    format_long_name : RTSP input
    bit_rate : 64000
    probe_score : 100
    tags :
    title : \11
    END
    

    EDIT: Just wondering, do we need to install this?
    https://www.npmjs.com/package/ffmpeg
    Or is this already included in shinobi, if even needed.


  • administrators

    anything show up in the logs? Please click the triangle icon on the stream window to reveal the log stream.

    If nothing is there you can save the logs to sql (option at the end of monitor settings in advanced view) and view them in the logs window.

    Strange... I just uploaded the file now and its working 😕 Can you guys please try the dev branch? https://github.com/ShinobiCCTV/Shinobi/tree/dev

    @pamo https://www.npmjs.com/package/ffmpeg is not needed. Shinobi is it's own wrapper around ffmpeg 🙂



  • Not sure why, but now i get a picture with the demo video (However it does not play smoothly)

    Only thing i messed with was pm2, as it suddenly could not run without root permissions.
    The startup / save function did not work either after reboot. Google told me it was a common problem with pm2, a while ago?
    Did a chmod/chown on /.pm2 to get going, and it seems to solve the permission and bootup problem.
    The localhost website was really laggy before also. So progress is being made 🙂

    Now, there is no error in the log (All warning / Sql log), other than monitor starting over and over as the file ends.
    Only stream option running smooth so far is "Base64 over websocket", but it plays the video at ~x8 speed!
    Other options plays realtime, but in bits, skipping most of the video.

    EDIT: I added "-re" to custom ffmpeg input setting and the video now runs much better.
    After i read this: https://superuser.com/questions/508560/ffmpeg-stream-a-file-with-original-playing-rate



  • Next problem, i was not able to record. Log showed "Permission denied" when writing to the "videos/" folder.
    sudo chown -R username: Shinobi/
    This did the trick. previously installed Shinobi several times, and it ends up with some root only privileges.

    Now demo stream is working great, recording also. 🙂

    So i added my camera with rtsp and got this error in log:

     R88IqABUaV : NcvMVzqSTh
            Process Unexpected Exit
            a few seconds ago
            msg : Process Crashed for Monitor : NcvMVzqSTh
            cmd : -loglevel warning -reconnect 1 -r 1 -f mjpeg -analyzeduration 1000000 -probesize 1000000 -i rtsp://192.168.8.136:554/11 -preset ultrafast -crf 15 -an -c:v copy -r 2 -f hls -s 640x480 -tune zerolatency -g 1 -hls_time 2 -hls_list_size 3 -start_number 0 -hls_allow_cache 0 -hls_flags +delete_segments+omit_endlist /dev/shm/streams/R88IqABUaV/NcvMVzqSTh/s.m3u8
            R88IqABUaV : NcvMVzqSTh
            FFMPEG STDERR
            a few seconds ago
            rtsp://192.168.8.136:554/11: Protocol not found Did you mean file:rtsp://192.168.8.136:554/11?
            R88IqABUaV : NcvMVzqSTh
            FFMPEG Process Started
            a few seconds ago
            cmd : -loglevel warning -reconnect 1 -r 1 -f mjpeg -analyzeduration 1000000 -probesize 1000000 -i rtsp://192.168.8.136:554/11 -preset ultrafast -crf 15 -an -c:v copy -r 2 -f hls -s 640x480 -tune zerolatency -g 1 -hls_time 2 -hls_list_size 3 -start_number 0 -hls_allow_cache 0 -hls_flags +delete_segments+omit_endlist /dev/shm/streams/R88IqABUaV/NcvMVzqSTh/s.m3u8
            R88IqABUaV : NcvMVzqSTh
    

    rtsp-ffmpeg is listed in node_modules/, but apparently not enabled, i have not found a solution for this, please advice thanks 🙂


  • administrators

    yay! thanks for the tip! it seems to play real time for me so im not sure what that's about.

    warning -reconnect 1 -r 1 -f mjpeg -analyzeduration 1000000 -probesize 1000000
    

    now about your rtsp camera it seems you have it set to Input a MJPEG type camera. Choose H.264 and RTSP Transport TCP then it should be good to go 🙂



  • I tried H.264 at first, but stream was black, i then went with RAW H.264 input and stream was running. But only for 10 secs followed by an error:
    "Too many packets buffered for output stream 1:0"
    And stream would restart.
    Other people fixed this ffmpeg error by increasing -max_muxing_queue_size but this did not help.

    I fiddle with the settings and turned off RAW H.264 again. Voila, stream is running with normal settings.

    The status indicator (plug) never turns green, what conditions could prevent this?

    Found a small bug in monitor settings, will post seperately.



  • Damn i did not get an email about replies.

    That Camera.Demo1.json is not playing nice.
    But i have a Pi Zero now working.

    At the moment Ubuntu is running in VMWare Workstation but later it will also run in a Hyper-V Server.
    I will do a fresh install and some testing. But all this settings..., a lot of questions...

    Here is the ffmpeg output:

    ffmpeg version 3.4.1-1~16.04.york0 Copyright (c) 2000-2017 the FFmpeg developers
      built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.5) 20160609
      configuration: --prefix=/usr --extra-version='1~16.04.york0' --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --disable-stripping --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --enable-librsvg --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared
      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
    Hyper fast Audio and Video encoder
    

    Oh, and merry christmas!


 

Looks like your connection to Shinobi Forum was lost, please wait while we try to reconnect.