gnomecast icon indicating copy to clipboard operation
gnomecast copied to clipboard

"Invalid stream specifier" error with ffmpeg

Open joel-porquet opened this issue 10 months ago • 0 comments

Hi,

I just tried using gnomecast and am encountering some errors with ffmpeg. Essentially, ffmpeg reports streams with specifiers that are then not accepted later as arguments.

When gnomecast runs ffmpeg the first time to get the different streams (video, audio, subtitles), it runs the following command: ffmpeg -i <filename> -f ffmetadata - -f mjpeg -vframes 1 -ss 27 -vf scale=600:-1 <thumbnail.png>.

Ffmpeg then prints a bunch of info, with lines such as: Stream #0:2[0x3](eng): Subtitle: mov_text (tx3g / 0x67337874), 0 kb/s (default).

Upon further processing, gnomecast keeps 0:2[0x3] as the stream specifier for this particular subtitle. The problem is that it is not a valid specifier for later ffmpeg commands:

$ ffmpeg -y -i <filename> -vn -an -map '0:2[0x3]' -codec srt <subtitle.srt>
...
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x559619c31e80] Invalid stream specifier: 2[0x3].
Last message repeated 9 times
Stream map '0:2[0x3]' matches no streams.

In that example, the correct stream specifier should be 0:2 (so with the hexadecimal number within the square brackets):

$ ffmpeg -y -i <filename> -vn -an -map '0:2' -codec srt <subtitle.srt>
...
Stream mapping:
  Stream #0:2 -> #0:0 (mov_text (native) -> subrip (srt))
...

I'm not sure why my ffmpeg prints this extra stream number in hexadecimal, and if there's maybe another option to give when using -f ffmetadata to avoid printing it. Or instead, if gnomecast needs to further process the stream specifier and remove this part of the specifier.

Can you please advise?

joel-porquet avatar Aug 29 '23 16:08 joel-porquet