DoubleHP post at 2019-4-23 23:12:45

Mini tutu: almost real time video srteaming between two orange pi one / PC

Edited by DoubleHP at 2019-4-24 03:05

Hello.

I am mid step in some project. It's time to publish some tips.

Final goal: build a dash camera system for my car.

Status of the day: recording live stream to disk, and network diffusion. Lag is 2.5s.

After digging many things, Raspi tools are not available on Orange Pis. Mplayer sux. So I ended up with the only tool that can read the camera properly: motion.

Hardware:
Orange Pi One with CSI cam and HDMI monitor.

https://www.aliexpress.com/item/Orange-Pi-One-SET-9-Orange-Pi-One-and-Camera-Camera-with-wide-angle-lens-for/32660642513.html?spm=a2g0s.9042311.0.0.27424c4dE39tpD
set 9

https://www.aliexpress.com/item/3-5-inch-LCD-HDMI-USB-Touch-Screen-Real-HD-1920x1080-LCD-Display-Py-for-Raspberri/32818537950.html?spm=a2g0s.9042311.0.0.27424c4dE39tpD
https://www.aliexpress.com/item/raspberry-pi-3-5-inch-HDMI-LCD-touchscreen-touch-screen-60-fps-high-speed-better-480/32819353553.html?spm=a2g0s.9042311.0.0.27424c4dE39tpD

Software configuration:
- Armbian_5.75_Orangepione_Ubuntu_xenial_default_3.4.113_desktop (full details here : http://www.orangepi.org/orangepi ... ead&tid=4270&extra= ). This is the ONLY Linux image that can work on opiOne+CSI as of today, with ubuntu_lxde_desktop_OrangePipc_v0_9_1.img.xz . For now, 4.19 does not support CSI; I have read 4.21 may bring CSI in ... but the source is uncertain.
- motion
- ffmpeg

DoubleHP post at 2019-4-23 23:38:11

Edited by DoubleHP at 2019-4-23 23:58

Major points:
- control recording of pictures on disk with "output_pictures" (I disabled them to not kill my SD; I will re-enable them later when I receive my High Endurance uSD, a model specific to NVRs)
- control stream diffusion over network with "stream_localhost"
- 'motion -s' will produce normal image files, but ghost/black network video.

Once this conf is set, run the server simply: 'motion -n'

And the client: ffplay -f mjpeg -probesize 32 -i "http://192.168.0.2:8081/"
You can also use VLC as client, but mplayer does not work.

When server dies, ffplay does not suicide; when server comes back; client is stuck on old image. To kill the client, I run this test in a look:
echo -n "" | telnet localhost 8081 2>/dev/null | grep -q "Escape character is" || kill_ffplay.sh

DoubleHP post at 2019-4-23 23:34:42

Edited by DoubleHP at 2019-4-23 23:56

Here are the changes I made in /etc/motion/motion.conf :

root@orangepione:/etc/motion# diff motion.conf.origmotion.conf
87c87,88
< rotate 0
---
> #rotate 0
> rotate 180
90c91,92
< width 320
---
> #width 320
> width 640
93c95,96
< height 240
---
> #height 240
> height 480
97c100,101
< framerate 2
---
> #framerate 2
> framerate 5
173c177,178
< threshold 1500
---
> #threshold 1500
> threshold 1
222c227
< post_capture 0
---
> post_capture 10
230c235,236
< event_gap 60
---
> #event_gap 60
> event_gap 120
234c240
< max_movie_time 0
---
> max_movie_time 600
250c256,257
< output_pictures on
---
> #output_pictures on
> output_pictures off
253a261
> #output_debug_pictures on
256a265
> quality 95
270c279,280
< ffmpeg_output_movies on
---
> ffmpeg_output_movies off
> #ffmpeg_output_movies off
328a339
> #use_extpipe on
332c343
< ;extpipe mencoder -demuxer rawvideo -rawvideo w=320:h=240:i420 -ovc x264 -x264encopts bframes=4:frameref=1:subq=1:scenecut=-1:nob_adapt:threads=1:keyint=1000:8x8dct:vbv_bufsize=4000:crf=24:partitions=i8x8,i4x4:vbv_maxrate=800:no-chroma-me-vf denoise3d=16:12:48:4,pp=lb -of   avi -o %f.avi - -fps %fps
---
> #;extpipe mencoder -demuxer rawvideo -rawvideo w=320:h=240:i420 -ovc x264 -x264encopts bframes=4:frameref=1:subq=1:scenecut=-1:nob_adapt:threads=1:keyint=1000:8x8dct:vbv_bufsize=4000:crf=24:partitions=i8x8,i4x4:vbv_maxrate=800:no-chroma-me -vf denoise3d=16:12:48:4,pp=lb -of   avi -o %f.avi - -fps %fps
360c371,372
< locate_motion_mode off
---
> #locate_motion_mode off
> locate_motion_mode preview
436c448,449
< picture_filename %v-%Y%m%d%H%M%S-%q
---
> #picture_filename %v-%Y%m%d%H%M%S-%q
> picture_filename %Y-%m-%d_%H-%M-%S_%q
467c480,481
< stream_quality 50
---
> #stream_quality 50
> stream_quality 90
471c485,486
< stream_motion off
---
> #stream_motion off
> stream_motion 1
474c489,490
< stream_maxrate 1
---
> #stream_maxrate 1
> stream_maxrate 10
477c493,494
< stream_localhost on
---
> #stream_localhost on
> stream_localhost off
503a521
> #webcontrol_localhost off

DoubleHP post at 2019-4-23 23:35:02

Edited by DoubleHP at 2019-4-23 23:53

Or, the stripped file:


root@orangepione:/etc/motion# cat motion.conf | grep -v -e "^#" -e ";" | sort | uniq

    auto_brightness off
    brightness 0
    contrast 0
    daemon on
    despeckle_filter EedDl
    emulate_motion off
    event_gap 120
    ffmpeg_bps 500000
    ffmpeg_deinterlace off
    ffmpeg_output_debug_movies off
    ffmpeg_output_movies off
    ffmpeg_timelapse 0
    ffmpeg_timelapse_mode daily
    ffmpeg_variable_bitrate 0
    ffmpeg_video_codec mpeg4
    framerate 5
    frequency 0
    height 480
    hue 0
    input -1
    ipv6_enabled off
    lightswitch 0
    locate_motion_mode preview
    locate_motion_style box
    logfile /var/log/motion/motion.log
    log_level 6
    log_type all
    max_movie_time 600
    minimum_frame_time 0
    minimum_motion_frames 1
    movie_filename %v-%Y%m%d%H%M%S
    netcam_keepalive off
    netcam_tolerant_check off
    noise_level 32
    noise_tune on
    norm 0
    output_debug_pictures off
    output_pictures off
    picture_filename %Y-%m-%d_%H-%M-%S_%q
    picture_type jpeg
    post_capture 10
    pre_capture 0
    process_id_file /var/run/motion/motion.pid
    quality 75
    quality 95
    quiet on
    rotate 180
    roundrobin_frames 1
    roundrobin_skip 1
    saturation 0
    sdl_threadnr 0
    setup_mode off
    smart_mask_speed 0
    snapshot_filename %v-%Y%m%d%H%M%S-snapshot
    snapshot_interval 0
    stream_auth_method 0
    stream_limit 0
    stream_localhost off
    stream_maxrate 10
    stream_motion 1
    stream_port 8081
    stream_quality 90
    switchfilter off
    target_dir /var/lib/motion
    text_changes off
    text_double off
    text_event %Y%m%d%H%M%S
    text_right %Y-%m-%d\n%T-%q
    threshold 1
    threshold_tune off
    timelapse_filename %Y%m%d-timelapse
    track_auto off
    track_iomojo_id 0
    track_move_wait 10
    track_speed 255
    track_step_angle_x 10
    track_step_angle_y 10
    track_stepsize 40
    track_type 0
    use_extpipe off
    v4l2_palette 17
    videodevice /dev/video0
    webcontrol_html_output on
    webcontrol_localhost on
    webcontrol_port 8080
    width 640

Marlin_Donigan post at 2023-4-6 17:35:16

sun necklace

yousuf post at 2024-7-3 23:25:28

I admire this article for the well-researched content and excellent wording. I got so involved in this material that I couldn’t stop reading. I am impressed with your work and skill. Thank you so much.        BDG Win login

yousuf post at 2024-7-6 15:50:55

Identified a person website by way of yahoo I need to state We michael impressed along with your posts!        SWTOR Nude Mod

yousuf post at 2024-7-6 18:13:32

시간을 내어 매우 유용한 정보를 게시해 주셔서 감사합니다!        토토솔루션

yousuf post at 2024-7-14 23:31:17

Excellent read, I just passed this onto a friend who was doing a little research on that. And he actually bought me lunch since I found it for him smile So let me rephrase that: Thank you for lunch!        mp3juice

yousuf post at 2024-8-30 20:39:22

There are a few interesting points over time in this article but I do not determine ifevery one of them center to heart. There’s some validity but I am going to take hold opinion until I check into it further. Excellent write-up , thanks therefore we want a lot more! Added to FeedBurner likewise      betflix เว็บตรง
page: [1] 2 3
View full version: Mini tutu: almost real time video srteaming between two orange pi one / PC