将文件格式从 flv 更改为 Android 可以播放的任何格式
我需要将这个以 h264 编码但在 flv 容器中的文件放入 mp4、3gp 或 android MediaPlayer 能够理解的任何文件格式中。
我想在本地执行此操作。由于我不会解码或编码任何内容,因此我认为我不会浪费大量电量(我错了吗?)
我按照此处的说明进行操作 http://www.roman10.net/?p=394 并且可以成功编译和使用 ffmpeg 并将其与 mp4 和 3gp 文件一起使用。
但当涉及到 flv 文件时,它就失败了。据我所知,在 Android 的 ffmpeg 特定端口中没有 flv 文件的格式定义。
例如,没有 libavformat/flv.h 头文件。
也许这就是为什么它有效的原因:
extern AVInputFormat ff_mov_demuxer;
av_register_input_format(&ff_mov_demuxer);
虽然这失败了:
extern AVInputFormat ff_flv_demuxer; av_register_input_format(&ff_flv_demuxer);
问题是,隧道尽头有光吗?有人做过类似的事情吗?有什么用吗?我的意思是,我总是可以将 flv 媒体文件放入 Flash 播放器中,瞧……问题是,这将是一个局部解决方案,因为它不适用于所有运行速度较慢且无法运行 Flash 的设备的人。
尼尔森
PS.万一。以下是有关我正在讨论的文件的一些信息:
ffmpeg -i rio.flv
ffmpeg version N-32624-gea8de10, Copyright (c) 2000-2011 the FFmpeg developers
built on Sep 15 2011 23:31:42 with gcc 4.5.2
configuration: --enable-libfaac --enable-libmp3lame --enable-librtmp --enable-libtheora --enable-libx264 --enable-libxvid --enable-gpl --enable-nonfree
libavutil 51. 16. 0 / 51. 16. 0
libavcodec 53. 15. 0 / 53. 15. 0
libavformat 53. 12. 0 / 53. 12. 0
libavdevice 53. 3. 0 / 53. 3. 0
libavfilter 2. 42. 0 / 2. 42. 0
libswscale 2. 1. 0 / 2. 1. 0
libpostproc 51. 2. 0 / 51. 2. 0
Seems stream 0 codec frame rate differs from container frame rate: 2000.00 (2000/1) -> 14.99 (15000/1001)
Input #0, flv, from 'rio.flv':
Duration: 00:01:00.06, start: 0.000000, bitrate: 783 kb/s
Stream #0.0: Video: h264 (Main), yuv420p, 704x480 [SAR 10:11 DAR 4:3], 14.99 tbr, 1k tbn, 2k tbc
I need to take this file which encoded is in h264 but in a flv container and just put it in a mp4, 3gp or whatever file format the android MediaPlayer will understand.
I want to do this natively. As I will not be decoding nor encoding anything I think I will not be wasting a lot of power (am I wrong?)
I followed the instructions from here http://www.roman10.net/?p=394 and could sucessfully compile and use ffmpeg and use it with mp4 and 3gp files.
But when it comes to flv files it fails. I understand there is no format definition for flv files in that specific port of ffmpeg for android.
There is no libavformat/flv.h header file for instance.
Maybe that's why this works:
extern AVInputFormat ff_mov_demuxer;
av_register_input_format(&ff_mov_demuxer);
While this fails:
extern AVInputFormat ff_flv_demuxer; av_register_input_format(&ff_flv_demuxer);
Question is, is there a light at the end of the tunnel? has someone done something similar? is it useful? I mean, I can always just throw the flv media file into a flash player and voila.. the thing is that this would be a parcial solution, as it will not work for all those folks running slower devices that can't yet run Flash.
Nelson
PS. Just in case. Here's some info about the file I'm talking about:
ffmpeg -i rio.flv
ffmpeg version N-32624-gea8de10, Copyright (c) 2000-2011 the FFmpeg developers
built on Sep 15 2011 23:31:42 with gcc 4.5.2
configuration: --enable-libfaac --enable-libmp3lame --enable-librtmp --enable-libtheora --enable-libx264 --enable-libxvid --enable-gpl --enable-nonfree
libavutil 51. 16. 0 / 51. 16. 0
libavcodec 53. 15. 0 / 53. 15. 0
libavformat 53. 12. 0 / 53. 12. 0
libavdevice 53. 3. 0 / 53. 3. 0
libavfilter 2. 42. 0 / 2. 42. 0
libswscale 2. 1. 0 / 2. 1. 0
libpostproc 51. 2. 0 / 51. 2. 0
Seems stream 0 codec frame rate differs from container frame rate: 2000.00 (2000/1) -> 14.99 (15000/1001)
Input #0, flv, from 'rio.flv':
Duration: 00:01:00.06, start: 0.000000, bitrate: 783 kb/s
Stream #0.0: Video: h264 (Main), yuv420p, 704x480 [SAR 10:11 DAR 4:3], 14.99 tbr, 1k tbn, 2k tbc
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论