
The code is here: ffmpeg -f video4linux2 -y -r 4 -i /dev/video0 -vf 'drawtextfontfile/usr/share/fonts/truetype/ttf-dejavu/DejaVuSans-Bold.ttf:expansionstrftime:text'Y-m-d H\\:M\\:S': fontcolorwhite:box1:boxcolorblack0.8:xw-textw:yh-lineh' -vframes 20 -vcodec mpeg4 out.mp4. I used FFmpeg to record video on my Raspberry PI. (Sorry for the wall of text, just want to make sure that I'm not confusing. Execute FFmpeg command in Python on Raspberry PI. So in effect, you would want: x = '"drawtext=fontfile=/usr/share/fonts/truetype/ttf-dejavu/DejaVuSans-Bold.ttf:expansion=strftime:text=\'%Y-%m-%d %H\\:%M\\:%S\': that argument would be split at the white space in the date format when actually run by bash and cause some unexpected behavior. On the command line, this would look like: ffmpeg -f video4linux2 -y -r 4 -i /dev/video0 -vf drawtext=fontfile=/usr/share/fonts/truetype/ttf-dejavu/DejaVuSans-Bold.ttf:expansion=strftime:text='%Y-%m-%d %H\\:%M\\:%S': -vframes 20 -vcodec mpeg4 out.mp4 In the python script, you created x as a string Popen would interpret the string like the other arguments you have in the list and end up leaving it unquoted in the actual command run. hold a circular loop of video data in RAM, overwriting it at a constant rate, and package it into a video file on.


What makes it not entirely obvious is that the site should show the last 30 minutes at any time, i.e. On the command line, you enclosed the entire -vf option in quotes. I wanted to use a Raspberry Pi with its integrated camera to record a timelapse of the last N minutes and serve it on a website. It looks like you are having an issue with bash white space.
