0

I need to send a fairly long command using python docker SDK

ffmpeg -f lavfi -re -i smptebars=duration=60:size=1280x720:rate=30 -f lavfi -re -i sine=frequency=1000:duration=60:sample_rate=44100 -pix_fmt yuv420p -c:v libx264 -b:v 1000k -g 30 -keyint_min 120 -profile:v baseline -preset veryfast -f mpegts "srt://127.0.0.1:4200?pkt_size=1316"

I have an example where you ned to wrap each element in double quotes.

container1 = client.containers.run("alpine", ["echo", "hello", "world"],name='autotest', detach=True)

2 Questions

Is there an elegant way to do this? If not how do I handle the bits that already have quotes?

tripleee
  • 175,061
  • 34
  • 275
  • 318
Neil Bernard
  • 131
  • 2
  • 9
  • Nothing here seems to be specific to `ffmpeg` or `docker`. The library function `shlex.split()` can be used to convert a string with arbitrary quoting to a list of tokens suitable for passing to an `exec` system call or similar API. – tripleee Apr 02 '21 at 09:29
  • I reckon shlex.split() could do the business! Ill give it a whirl – Neil Bernard Apr 02 '21 at 09:36

0 Answers0