Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

what is per-stream #337

Open
lucemia opened this issue Feb 26, 2024 · 2 comments
Open

what is per-stream #337

lucemia opened this issue Feb 26, 2024 · 2 comments
Assignees

Comments

@lucemia
Copy link
Contributor

lucemia commented Feb 26, 2024

Some options are applied per-stream, e.g. bitrate or codec. Stream specifiers are used to precisely specify which stream(s) a given option belongs to.

A stream specifier is a string generally appended to the option name and separated from it by a colon. E.g. -codec:a:1 ac3 contains the a:1 stream specifier, which matches the second audio stream. Therefore, it would select the ac3 codec for the second audio stream.

A stream specifier can match several streams, so that the option is applied to all of them. E.g. the stream specifier in -b:a 128k matches all audio streams.

An empty stream specifier matches all streams. For example, -codec copy or -codec: copy would copy all the streams without reencoding.

https://ffmpeg.org/ffmpeg.html#toc-AVOptions

All codec AVOptions are per-stream, and thus a stream specifier should be attached to them:

ffmpeg -i multichannel.mxf -map 0:v:0 -map 0:a:0 -map 0:a:0 -c:a:0 ac3 -b:a:0 640k -ac:a:1 2 -c:a:1 aac -b:2 128k out.mp4
In the above example, a multichannel audio stream is mapped twice for output. The first instance is encoded with codec ac3 and bitrate 640k. The second instance is downmixed to 2 channels and encoded with codec aac. A bitrate of 128k is specified for it using absolute index of the output stream.

Note: the -nooption syntax cannot be used for boolean AVOptions, use -option 0/-option 1.

Note: the old undocumented way of specifying per-stream AVOptions by prepending v/a/s to the options name is now obsolete and will be removed soon.

@lucemia
Copy link
Contributor Author

lucemia commented Feb 26, 2024

-itsscale scale (input,per-stream)
Rescale input timestamps. scale should be a floating point number.

why the document doesn't mentioned about stream specifier

@lucemia lucemia self-assigned this Feb 26, 2024
@lucemia
Copy link
Contributor Author

lucemia commented Feb 26, 2024

ref #130

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants