Hi, is it possible to make a  python terminal module to excute ffmpeg within python only to focus on speed and isolate to operate inside python only for example i would like to take this ffmpeg 6 arg:
ffmpeg6.1 -hwaccel_output_format opencl -hide_banner -apply_trc iec61966_2_1 \
-fflags +discardcorrupt -ec guess_mvs+deblock+favor_inter \
-i "%04d.exr" -c:v copy -crf 0 -f matroska -y "1raw.mkv" \
-vf "curves=psfile=cc.acv" -c:v libx265 -pix_fmt yuv420p10le \
-preset medium -tune psnr -x265-params "qp=16:rc-lookahead=18:vbv-bufsize=10000:vbv-maxrate=10000:bitrate=10000:hdr-opt=1:repeat-headers=1:colorprim=bt2020:transfer=smpte2084:colormatrix=bt2020nc:master-display=G(8500,39850)B(6550,2300)R(35400,14600)WP(15635,16450)L(40000000,50):max-cll=0,0" -crf 22 -an -tag:v hvc1 -movflags +faststart -f matroska "2scene.mkv"  && \
ffmpeg6.1 -hwaccel_output_format opencl -hide_banner \
-fflags +discardcorrupt -ec guess_mvs+deblock+favor_inter \
-stream_loop -1  \
-i "2scene.mkv" -i "HDAacc.mp4" \
-shortest -map 0:v:0 -map 1:a:0 -c:a copy -c:v libx265 -pix_fmt yuv420p10le \
-preset medium -tune psnr -x265-params "qp=16:rc-lookahead=18:vbv-bufsize=10000:vbv-maxrate=10000:bitrate=10000:hdr-opt=1:repeat-headers=1:colorprim=bt2020:transfer=smpte2084:colormatrix=bt2020nc:master-display=G(8500,39850)B(6550,2300)R(35400,14600)WP(15635,16450)L(40000000,50):max-cll=0,0" -crf 22 -t 55 -tag:v hvc1 -movflags +faststart -f matroska "55-2sec-2sceneHDR.mkv" && \
ffmpeg6.1 -hwaccel_output_format opencl -hide_banner \
-fflags +discardcorrupt -ec guess_mvs+deblock+favor_inter \
-i "55-2secHDR.mkv" \
-c:a copy -c:v libx265 -pix_fmt yuv420p10le -filter_complex "crop=iw*0.45:ih:(iw/2.9),scale=1080:1920" -aspect 1:2 -preset medium -tune psnr -x265-params "qp=16:rc-lookahead=18:vbv-bufsize=10000:vbv-maxrate=10000:bitrate=10000:hdr-opt=1:repeat-headers=1:colorprim=bt2020:transfer=smpte2084:colormatrix=bt2020nc:master-display=G(8500,39850)B(6550,2300)R(35400,14600)WP(15635,16450)L(40000000,50):max-cll=0,0" -crf 22 -t 55 -tag:v hvc1 -movflags +faststart -f matroska "PHN-HDR10.mkv"

and use in python3.7
python3.7
>>> import os
>>>os.system("ffmpeg6.1 -hwaccel_output_format opencl -hide_banner -apply_trc iec61966_2_1 \
-fflags +discardcorrupt -ec guess_mvs+deblock+favor_inter \
-i "%04d.exr" -c:v copy -crf 0 -f matroska -y "1raw.mkv" \
-vf "curves=psfile=cc.acv" -c:v libx265 -pix_fmt yuv420p10le \
-preset medium -tune psnr -x265-params "qp=16:rc-lookahead=18:vbv-bufsize=10000:vbv-maxrate=10000:bitrate=10000:hdr-opt=1:repeat-headers=1:colorprim=bt2020:transfer=smpte2084:colormatrix=bt2020nc:master-display=G(8500,39850)B(6550,2300)R(35400,14600)WP(15635,16450)L(40000000,50):max-cll=0,0" -crf 22 -an -tag:v hvc1 -movflags +faststart -f matroska "2scene.mkv"  && \
ffmpeg6.1 -hwaccel_output_format opencl -hide_banner \
-fflags +discardcorrupt -ec guess_mvs+deblock+favor_inter \
-stream_loop -1  \
-i "2scene.mkv" -i "HDAacc.mp4" \
-shortest -map 0:v:0 -map 1:a:0 -c:a copy -c:v libx265 -pix_fmt yuv420p10le \
-preset medium -tune psnr -x265-params "qp=16:rc-lookahead=18:vbv-bufsize=10000:vbv-maxrate=10000:bitrate=10000:hdr-opt=1:repeat-headers=1:colorprim=bt2020:transfer=smpte2084:colormatrix=bt2020nc:master-display=G(8500,39850)B(6550,2300)R(35400,14600)WP(15635,16450)L(40000000,50):max-cll=0,0" -crf 22 -t 55 -tag:v hvc1 -movflags +faststart -f matroska "55-2sec-2sceneHDR.mkv" && \
ffmpeg6.1 -hwaccel_output_format opencl -hide_banner \
-fflags +discardcorrupt -ec guess_mvs+deblock+favor_inter \
-i "55-2secHDR.mkv" \
-c:a copy -c:v libx265 -pix_fmt yuv420p10le -filter_complex "crop=iw*0.45:ih:(iw/2.9),scale=1080:1920" -aspect 1:2 -preset medium -tune psnr -x265-params "qp=16:rc-lookahead=18:vbv-bufsize=10000:vbv-maxrate=10000:bitrate=10000:hdr-opt=1:repeat-headers=1:colorprim=bt2020:transfer=smpte2084:colormatrix=bt2020nc:master-display=G(8500,39850)B(6550,2300)R(35400,14600)WP(15635,16450)L(40000000,50):max-cll=0,0" -crf 22 -t 55 -tag:v hvc1 -movflags +faststart -f matroska "PHN-HDR10.mkv"")


--rearange the code or make your best guess if needed on correction, thanks.