DDVTECH / mistserver

The official mistserver source repository - www.mistserver.com
The Unlicense
378 stars 129 forks source link

shell expansion and parameters with spaces in ts-exec:, mkv-exec, JPEG, etc. #156

Closed m1tk4 closed 1 year ago

m1tk4 commented 1 year ago

In many instances, a shell command entered by user to supply a ts-exec: / mkv-exec: source or destination is not being treated as a shell expression but rather split by spaces.

This represents a problem when you need ffmpeg to play a file containing a space in ints file name or overlay a string of text with spaces. For example, the line:

ts-exec: ffmpeg -i "My File With Spaces.mpg" -c:v copy -mpegts -

will be split like this before invoking ffmpeg

ffmpeg|-i|"My|File|With|Spaces.mpg"|-c:v|copy|-mpegts -`

Other shell escaping characters like `, \ , ' also do not work.

The proposed PR solves this by actually invoking shell to interpret the entire command supplied by the user. (Inspired by https://github.com/php/php-src/blob/master/ext/standard/proc_open.c#L1211).

Note: WIN32 is implemented via CMD /C but untested.

m1tk4 commented 1 year ago

resubmitted as #172 to resolve conflicts.