Advertisement
Guest User

Untitled

a guest
Jan 31st, 2013
171
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. pipe=/tmp/ffmpeg
  4.  
  5. trap "rm -f $pipe" EXIT
  6.  
  7. # creating the FIFO
  8. [[ -p $pipe ]] || mkfifo $pipe
  9.  
  10. while true; do
  11. # can't just use "while read line" if we
  12. # want this script to continue running.
  13. read line < $pipe
  14.  
  15. # now implementing a bit of security,
  16. # feel free to improve it.
  17. # we ensure that the command is a ffmpeg one.
  18. [[ $line =~ ^ffmpeg ]] && bash <<< "$line"
  19. done
  20.  
  21. echo "ffmpeg -version" > /tmp/ffmpeg
  22.  
  23. if [[ -p /tmp/ffmpeg ]]; then
  24. echo "ffmpeg -version" > /tmp/ffmpeg
  25. else
  26. echo >&2 "ffmpeg FIFO isn't open :/"
  27. fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement