[FFmpeg-user] Parse environment variables in command line

Ilya Melnikov rayanayar at mail.ru
Sun Apr 19 05:03:16 CEST 2015


Hello.

ffmpeg records video stream from IP-cam.
IP-cam has authentiation.

ffmpeg \
  -t $DT_SECONDS_TO_RECORD \
  -i rtsp://$SRC_USER:$SRC_PASS@$SRC_ADDR/stream1.sdp  \
  -vcodec copy \
  -acodec copy \
  $DST_FILE

ffmpeg starts from cron script by unpriviledged user.
At the same host can be logged interactive users.

The problem is: interactive users can see ffmpeg command line "by ps", thus users can see IP-cam password.

$ ps -f -C ffmpeg
UID        PID  PPID  C STIME TTY          TIME CMD
backup    1506  1423 88 07:47 pts/11   00:00:08 ffmpeg -t 3600 -i rtsp://admin:password@192.168.0.100/stream1.sdp -vcodec copy -acodec copy out.mkv

The question is: can ffmpeg parse environment variables themselves?
For example:

ffmpeg \
  -t $DT_SECONDS_TO_RECORD \
  -i rtsp://$SRC_USER:'$SRC_PASS'@$SRC_ADDR/stream1.sdp  \
  -vcodec copy \
  -acodec copy \
  $DST_FILE

$ ps -f -C ffmpeg
UID        PID  PPID  C STIME TTY          TIME CMD
backup    1506  1423 88 07:47 pts/11   00:00:08 ffmpeg -t 3600 -i rtsp://admin:$SRC_PASS@192.168.0.100/stream1.sdp -vcodec copy -acodec copy out.mkv



--
Ilya Melnikov
Sunday 19 April 2015 07:35:46
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <https://ffmpeg.org/pipermail/ffmpeg-user/attachments/20150419/082fab74/attachment.asc>


More information about the ffmpeg-user mailing list