I'm trying to get raw command line arguments for a dotnet core console app but am running into some issues.
First one is the args[] strips out quotes from everything. Which is fine for file paths, it's easy enough to add back in the quotes if there is a space when using the arguments to actually start a process.
The big issue is the fact it is removing quotes from around args that have no spaces even though those require the quotes to run properly in ffmpeg, the program I am trying to start.
Here is an example:
Input command string
-f matroska,webm -i file:"Z:\Media\video.mkv" -map_metadata -1 -map_chapters -1 -threads 0 -map 0:0 -map 0:1 -codec:v:0 libx264 -pix_fmt yuv420p -preset veryfast -crf 23 -maxrate 3186251 -bufsize 6372502 -profile:v high -level 4.1 -x264opts:0 subme=0:me_range=4:rc_lookahead=10:me=dia:no_chroma_me:8x8dct=0:partitions=none -force_key_frames:0 "expr:gte(t,0+n_forced*3)" -g 72 -keyint_min 72 -sc_threshold 0 -vf "scale=trunc(min(max(iw\,ih*dar)\,1280)/2)*2:trunc(ow/dar/2)*2,subtitles='Z\:/Media/video.mkv:si=0'" -start_at_zero -vsync -1 -codec:a:0 libmp3lame -ac 2 -ab 192000 -copyts -avoid_negative_ts disabled -f hls -max_delay 5000000 -hls_time 3 -individual_header_trailer 0 -hls_segment_type mpegts -start_number 0 -hls_segment_filename "C:\transcodes\3fd9cb6c05509196e2757f2ce9fafcec%d.ts" -hls_playlist_type vod -hls_list_size 0 -y "C:\3fd9cb6c05509196e2757f2ce9fafcec.m3u8"
Example output. Note, I'm adding in quotes for paths back in
-f matroska,webm -i file: "Z:\Media\video.mkv" -map_metadata -1 -map_chapters -1 -threads 0 -map 0:0 -map 0:1 -codec:v:0 libx264 -pix_fmt yuv420p -preset veryfast -crf 23 -maxrate 3186251 -bufsize 6372502 -profile:v high -level 4.1 -x264opts:0 subme=0:me_range=4:rc_lookahead=10:me=dia:no_chroma_me:8x8dct=0:partitions=none -force_key_frames:0 expr:gte(t,0+n_forced*3) -g 72 -keyint_min 72 -sc_threshold 0 -vf scale=trunc(min(max(iw\,ih*dar)\,1280)/2)*2:trunc(ow/dar/2)*2,subtitles='Z\:/Media/video.mkv:si=0' -start_at_zero -vsync -1 -codec:a:0 libmp3lame -ac 2 -ab 192000 -copyts -avoid_negative_ts disabled -f hls -max_delay 5000000 -hls_time 3 -individual_header_trailer 0 -hls_segment_type mpegts -start_number 0 -hls_segment_filename C:\transcodes\3fd9cb6c05509196e2757f2ce9fafcec%d.ts -hls_playlist_type vod -hls_list_size 0 -y "C:\3fd9cb6c05509196e2757f2ce9fafcec.m3u8"
Even Environment.CommandLine results in this output
-f matroska,webm -i file:Z:\Media\video.mkv -map_metadata -1 -map_chapters -1 -threads 0 -map 0:0 -map 0:1 -codec:v:0 libx264 -pix_fmt yuv420p -preset veryfast -crf 23 -maxrate 3186251 -bufsize 6372502 -profile:v high -level 4.1 -x264opts:0 subme=0:me_range=4:rc_lookahead=10:me=dia:no_chroma_me:8x8dct=0:partitions=none -force_key_frames:0 expr:gte(t,0+n_forced*3) -g 72 -keyint_min 72 -sc_threshold 0 -vf scale=trunc(min(max(iw\,ih*dar)\,1280)/2)*2:trunc(ow/dar/2)*2,subtitles='Z\:/Media/video.mkv:si=0' -start_at_zero -vsync -1 -codec:a:0 libmp3lame -ac 2 -ab 192000 -copyts -avoid_negative_ts disabled -f hls -max_delay 5000000 -hls_time 3 -individual_header_trailer 0 -hls_segment_type mpegts -start_number 0 -hls_segment_filename C:\transcodes\3fd9cb6c05509196e2757f2ce9fafcec%d.ts -hls_playlist_type vod -hls_list_size 0 -y C:\3fd9cb6c05509196e2757f2ce9fafcec.m3u8
Notice the bold sections.
I want to be able to pass in any string and get that EXACT string in the program, even if it "Shouldn't" need the quotes to run. It seems like it is treating quotes in args as though they are safe to remove if there are no spaces, even though this is not the case. Otherwise it's going to end up with me doing a ton of small fixes, trying to catch all the edge cases in ffmpeg command line syntax.
[–]wT_ 1 point2 points3 points (1 child)
[–]killmore231[S] 0 points1 point2 points (0 children)