独立的音频和视频在Android [英] Separate Audio and Video in android
问题描述
ffmpeg -i input.mkv#show stream数字和格式
ffmpeg -i input.mkv -c copy audio.m4a#AAC
ffmpeg -i input.mkv -c copy audio.mp3#MP3
ffmpeg -i input.mkv - c copy audio.ac3#AC3
ffmpeg -i input.mkv -an -c copy video.mkv
ffmpeg -i input.mkv -map 0:1 -c copy audio.m4a#stream 1
分离的视频文件不会包含任何音频,它只能包含视频类型。
这个选项在ffmpeg中是否有可能?
是任何其他替代选项?
仅复制视频
ffmpeg -i input.mkv -map 0:v -codec copy output.mkv
-
这将流式传输从第一个输入(这种情况下唯一的输入))的所有视频流输出。
-
如果输入有多个视频流,而您只想要第一个视频流,则使用
-map 0: v:0
。 -
也可以使用
-an
相反,这只会排除音频,导致复制其他流类型(包括字幕,数据和附件)的可能性。 -
请参阅流选择。
只复制音频
这与上面的例子非常相似:只需更改 -map
选项使用不同的流说明符:
ffmpeg -i input.mp3 -map 0:a -codec copy output.mp3
I am beginner to Android application development,The aim of my project is to separate a audio and video from video file. after surfing in internet i came to know that, using FFmpeg we can do it.
ffmpeg -i input.mkv # show stream numbers and formats
ffmpeg -i input.mkv -c copy audio.m4a # AAC
ffmpeg -i input.mkv -c copy audio.mp3 # MP3
ffmpeg -i input.mkv -c copy audio.ac3 # AC3
ffmpeg -i input.mkv -an -c copy video.mkv
ffmpeg -i input.mkv -map 0:1 -c copy audio.m4a # stream 1
separated video file wouldn't contain any audio it must be contain only video type. whether this option too possible in ffmpeg? is any other alternative option there?.
Copy only video
Yes, it is possible to scream copy only the video from an input with the -map
option:
ffmpeg -i input.mkv -map 0:v -codec copy output.mkv
This will stream copy all video streams from the first input (the only input in this case) to the output.
If the input has more than one video stream and you only want the first video stream then use
-map 0:v:0
.The
-an
option can also be used instead, but this only excludes audio resulting in the potential to copy other stream types including subtitles, data, and attachments.See stream selection for more info on how ffmpeg will choose streams for inclusion in the output.
Copy only audio
This is very similar to the above example: just change the -map
option to use a different stream specifier:
ffmpeg -i input.mp3 -map 0:a -codec copy output.mp3
这篇关于独立的音频和视频在Android的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!