View Single Post
velox's Avatar
Posts: 394 | Thanked: 1,341 times | Joined on Dec 2009
#17
Originally Posted by elros34 View Post
Maybe root needs to be added to privileged group.
https://git.merproject.org/mer-core/...dacf15b4e15868
usermod -G privileged -a root doesn't work for me.
Thanks for digging this up! You are awesome!
The commit got me thinking that maybe, just maybe, it only checks for the primary group.
After that, I kind of got it to run. It runs pretty badly but it kind of works!

I've written a test script to do this, but keep in mind:
  • Lipstick-recorder creates a lot of .bmp files. Those are huge. (A few seconds ate my /tmp/ space like it was a snickers bar.)
  • There's no fixed frame rate with those images… sometimes they are generated faster, sometimes slower
  • (Because of the previous problem:) The video file my script creates has a fixed framerate and it's length has nothing to do with the actual duration of recording.
  • Encoding the video takes a while.
  • It only works once. So choose wisely. (Actually it works again after a reboot. But that's pretty bad)
    (edit: sometimes it seems to work without a reboot – don't know when or why)
  • Don't run this from a directory where there are "frame*.bmp" files present. Those will be deleted!

With that out of the way, let's do this.
  • Install ffmpeg from openrepos
  • Place the following shell script somewhere and make it executable:
    Code:
    #!/bin/bash
    function runRecorder {	
    newgrp privileged << END
    	XDG_RUNTIME_DIR=/run/user/1000 lipstick-recorder
    END
    }
    function killRecorder {
    	killall lipstick-recorder 
    	sleep 2
    	echo should be killed
    }
    trackeroutput=$(tracker control --miner=org.freedesktop.Tracker1.Miner.Files --pause="makingavideo")
    trackercookie=$(echo $trackeroutput| awk '{print $NF}')
    
    runRecorder &
    read -n1 -r -p 'Press any key to exit...' key
    echo
    killRecorder
    echo 'making video'
    
    #how many files are there?
    count=$(awk "BEGIN {print ($(ls -l frame*.bmp | wc -l) - 1)}")
    ints=${#count};
    
    ffmpeg -f image2 -i frame%${ints}d.bmp -threads 3 -framerate 15 "/home/nemo/Videos/recorder-`date "+%Y%d%e-%H%M%S"`.mp4"
    
    echo 'deleting frame*.bmp'
    rm -f frame*.bmp
    tracker control --miner=org.freedesktop.Tracker1.Miner.Files --resume=$trackercookie
  • Run it as root
  • Profit!
--- EDITS:
edit 1: removed kill signal 3, that didn't seem to kill it ;)
edit 2: sometimes it works after the first time. don't know when or why
edit 3: Here's a test upload on youtube: https://youtu.be/TulKBs2AyeI
edit 4: lowered video frame rate + added threads in ffmpeg.
edit 5: added tracker pause command hoping it won't try to index the images
---
__________________
slumber: sensors enabled sleep timer for SFOS (translations/input/… appreciated if you've got some spare time)
talefish: directory based audiobook player for SFOS
nofono: ofono restart for SFOS
___
list of i486/noarch packages on openrepos (jolla tablet)

Last edited by velox; 2017-01-14 at 00:01. Reason: structured edits… I'm tired ;)
 

The Following 6 Users Say Thank You to velox For This Useful Post: