char converted[1000]="";
strcpy(converted,subsname);
while (replace_str(converted,"\'","[single_quote]"));
while (replace_str(converted,"[single_quote]","\\'\\'\\\\'"));
sprintf(q_subs, "\"f='%s'\"",converted);
fprintf(file,"ffmpeg.exe -hide_banner -i %s -i %s -map 0:v:0 -map 1:a:0 -strict -2 -vf subtitles=%s -c:s mov_text -c:v libx264 -preset veryfast -crf 23 -c:a aac -b:a 96k -pix_fmt yuv420p %s", q_video,q_audio,q_subs,outputfile);
int replace_str(char *str, char *orig, char *rep)
{
char buffer[10000];
char *p;
if(!(p = strstr(str, orig))) // Is 'orig' even in 'str'?
return false;
strncpy(buffer, str, p-str); // Copy characters from 'str' start to 'orig' st$
buffer[p-str] = '\0';
sprintf(buffer+(p-str), "%s%s", rep, p+strlen(orig));
strcpy(str,buffer);
return true;
}
Result:
ffmpeg.exe -hide_banner -i "'Impossible' Pulsar Breaks the Rules _ Space News-GrW_xcHUUmU.f135.mp4" -i "'Impossible' Pulsar Breaks the Rules _ Space News-GrW_xcHUUmU.f140.m4a" -map 0:v:0 -map 1:a:0 -strict -2 -vf subtitles="f='\'\'\'Impossible\'\'\' Pulsar Breaks the Rules _ Space News-GrW_xcHUUmU.nl.vtt'" -c:s mov_text -c:v libx264 -preset veryfast -crf 23 -c:a aac -b:a 96k -pix_fmt yuv420p "out/'Impossible' Pulsar Breaks the Rules _ Space News-GrW_xcHUUmU.nl.mp4"
Ok?
Maybe this helps programmers and constructing the subtile filename for single quotes....
;)