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

Stream-specifiers #130

Open
lucemia opened this issue Jan 6, 2024 · 2 comments
Open

Stream-specifiers #130

lucemia opened this issue Jan 6, 2024 · 2 comments

Comments

@lucemia
Copy link
Contributor

lucemia commented Jan 6, 2024

https://ffmpeg.org/ffmpeg.html#Stream-specifiers-1

https://ffmpeg.org/ffmpeg.html#Stream-specifiers-1
  • ffmpeg Documentation
  • Table of Contents. 2 Description 3 Detailed description. 4.1.1 Automatic stream selection 4.1.2 Manual stream selection 4.1.3 Complex filtergraphs 4.1.4 Stream handling.
@lucemia
Copy link
Contributor Author

lucemia commented Jan 6, 2024

ffmpeg -i multichannel.mxf \
       -map 0:v:0 \                             # 選擇視頻流
       -map 0:a:0 -c:a:0 ac3 -b:a:0 640k \      # 第一個音軌:AC3格式,640kbps
       -map 0:a:0 -c:a:1 aac -ac:a:1 2 -b:a:1 128k \  # 第二個音軌:AAC格式,2聲道,128kbps
       out.mp4

@lucemia
Copy link
Contributor Author

lucemia commented Jan 6, 2024

是的,您的理解是正確的。在 ffmpeg 命令中,每次使用 -map 都可以看作是選擇一個新的流(stream),並為該流設置特定的選項。每個 -map 都獨立於其他的 -map,允許您針對每個選定的流進行個別的處理。

在您的命令示例中:

  • 第一個 -map 0:v:0 選擇了第一個視頻流。
  • 接下來的兩次 -map 0:a:0 都選擇了同一個音頻流,但每次選擇後的選項都不同。第一次是設定為AC3格式,第二次是設定為AAC格式。

這種方法讓您可以非常靈活地從同一個源文件中提取多個流,並為每個流指定不同的編碼方式、比特率、通道數等參數。这是 ffmpeg 的一个强大特性,它允许高度定制化的媒体处理。

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

1 participant