-1

I have this command:

ffmpeg -i video.format -movflags use_metadata_tags -map metadata 0 -vcodec libx265 -acodec copy output.mp4

I get this error:

[avi @ 0x559845f9c480] Invalid stream specifier: metadata.
    Last message repeated 3 times
Stream map 'metadata' matches no streams.
To ignore this, add a trailing '?' to the map.

Any ideas?

llogan
  • 121,796
  • 28
  • 232
  • 243
Orsu
  • 405
  • 6
  • 19
  • 1
    What do you want it to do when the input contains no audio and/or no metadata? Your command has a typo: `-map metadata 0` should be `-map_metadata 0` (although this is default so you can omit it). – llogan May 12 '21 at 17:31
  • Thanks! Well, currently, when i try to run this on a file with no audio/metadata, i get an error and the command stops. I'd like to keep running, and just ignore the audio/metadata parts when those are absent – Orsu May 12 '21 at 17:37
  • See [this answer](https://stackoverflow.com/a/44249993/10248678). Ffmpeg consumes stdin, that's why the loop terminates too early. – oguz ismail May 12 '21 at 17:41
  • @oguzismail the loop is absolutely irrelevant to my problem here. I want to use a generic command to treat files with and without audio and metdata – Orsu May 12 '21 at 17:44
  • 2
    Your tagging says `bash`, your title says `batch`. These are very different things (a "batch file" is a Windows cmd.exe script, not a bash script). – Charles Duffy May 12 '21 at 17:47
  • oops! you're correct. I meant batch as in, doing a lot of things – Orsu May 12 '21 at 17:48
  • 1
    If you want this reopened, you will probably have to spell out in more detail what your actual question is. If you want to try `a` and then fall back to `b` if it fails, the syntax for that is `a || b`. The error message also seems to suggest a possible remedy. – tripleee May 12 '21 at 17:49
  • 2
    BTW, note that `find ... | while read filename` is a bit buggy in and of itself. If you want it to work with all possible filenames, `find ... -print0 | while IFS= read -r -d '' filename` is more reliable. – Charles Duffy May 12 '21 at 17:49
  • 1
    @Orsu edit your question to leave the loop part out and add the ffmpeg tag then. Good luck! – oguz ismail May 12 '21 at 17:50
  • i think i'm going to delete it... apparently ffmpeg already does the thing i wanted, and the problem was using -map metadata instead of -map_metadata even tough it didn't complained before – Orsu May 12 '21 at 17:52

1 Answers1

0

Your command has an invalid option: -map metadata 0 should be -map_metadata 0 (although this is default so you can omit -map_metadata 0).

Once fixed the command should work regardless of the presence of audio and/or metadata.

llogan
  • 121,796
  • 28
  • 232
  • 243
  • surprinsingly, it always worked without complaining, but that's correct. THat's the fix. Thank you – Orsu May 12 '21 at 17:54