user36035: Is it possible to remove only image based subtitles using ffmpeg? I know that you can manually select/exclude streams using -map, however I'm trying to automate this process, and the input files have a mix of image based subtitles (pgssubs) and text based subtitles. Since I'm trying to encode to an MP4 container, the image based subtitles are incompatible.

user35763: Sorry, I cannot write the script but here is the idea. First get the codec_name of your text-based subtitle from a video
ffprobe -v error -show_entries stream=codec_name -of default=noprint_wrappers=1 <test video name>

Now replace  with that with that codec name in te following script.
Usage: imgsrtremover <file name>
Output: <filename without extention>.mp4

#! /bin/bash
imgsrtstreams=$(ffprobe -v error -show_entries stream=codec_name -of default=noprint_wrappers=1 $1 | grep -n "<codec>" | cut -f1 -d:)
cmd="ffmpeg -i $1 -map 0"
for i in $imgsrtstreams
do
cmd+=" -map -0:$((i-1))"
done 
$cmd -c copy $(echo "$1" | rev|cut -f 2- -d '.'|rev).mp4  


36035: <p>Is it possible to remove <em>only</em> image based subtitles using ffmpeg? I know that you can manually select/exclude streams using -map, however I'm trying to automate this process, and the input files have a mix of image based subtitles (pgssubs) and text based subtitles. Since I'm trying to encode to an MP4 container, the image based subtitles are incompatible.</p>
 35763: <p>Sorry, I cannot write the script but here is the idea. First get the <code>codec_name</code> of your text-based subtitle from a video</p>
<pre><code>ffprobe -v error -show_entries stream=codec_name -of default=noprint_wrappers=1 &lt;test video name&gt;
</code></pre>
<p>Now replace  with that with that codec name in te following script.</p>
<pre><code>Usage: imgsrtremover &lt;file name&gt;
Output: &lt;filename without extention&gt;.mp4
</code></pre>
<pre><code>#! /bin/bash
imgsrtstreams=$(ffprobe -v error -show_entries stream=codec_name -of default=noprint_wrappers=1 $1 | grep -n &quot;&lt;codec&gt;&quot; | cut -f1 -d:)
cmd=&quot;ffmpeg -i $1 -map 0&quot;
for i in $imgsrtstreams
do
cmd+=&quot; -map -0:$((i-1))&quot;
done 
$cmd -c copy $(echo &quot;$1&quot; | rev|cut -f 2- -d '.'|rev).mp4  
</code></pre>
