独立的音频和视频在Android [英] Separate Audio and Video in android

查看:244
本文介绍了独立的音频和视频在Android的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是Android应用程序开发的初学者,我的项目的目的是将音视频和视频文件分开。在互联网冲浪后,我知道,使用FFmpeg我们可以做到。

  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中是否有可能?
是任何其他替代选项?

解决方案

仅复制视频



是的,可以尖叫复制仅输入视频使用 -map 选项:

  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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆