Sample Header Ad - 728x90

Map streams in ffmpeg based on title (to remove language variant)

0 votes
0 answers
106 views
I have a few video files with English audio track and French audio track, because the family wants French and I prefer VO. With ffmpeg I can easily filter all tracks to keep eng and fre, the problem is there are multiple french dialects, one of them being Candian (VFQ). Therefore, with the following input streams:
Stream #0:1(fre): Audio: eac3, 48000 Hz, 5.1(side), fltp, 768 kb/s (default)
    Metadata:
      title           : E-AC3 VFF
  Stream #0:2(fre): Subtitle: subrip (default) (forced)
    Metadata:
      title           : FORCED VFF
  Stream #0:3(fre): Audio: ac3, 48000 Hz, 5.1(side), fltp, 384 kb/s
    Metadata:
      title           : AC3 VFQ
  Stream #0:4(fre): Subtitle: subrip
    Metadata:
      title           : FORCED VFQ
  Stream #0:5(eng): Audio: eac3, 48000 Hz, 5.1(side), fltp, 768 kb/s
    Metadata:
      title           : E-AC3 VO
The command
-map 0:v: -map 0:m:language:eng -map 0:m:language:fre
does not filter out anything, and I keep both audio which is wasteful. The only metadata that could be used to filter seems to be the title.
Asked by MappaM (175 rep)
Oct 17, 2024, 07:29 AM