作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我们正在使用 FFMPEG 将非常旧的 .flv 文件转换为 MP4。这些至少有 10 年的历史。
那时所有的都是用早期版本的 Adobe Premiere 渲染的。
在桌面浏览器上,所有文件都可以正常工作和流式传输(......看着它们感觉就像回到了一个世纪!)
但是,当在移动设备(android 和 ios)上请求同一页面上的视频时,Video JS 甚至不会出现。
也许编解码器太旧了,但我想知道用这一行转换它们时是否还有其他原因:
for i in *.flv; do ffmpeg -i "$i" "${i%.*}.mp4"; done
ffmpeg version N-78967-gbaec6d8 Copyright (c) 2000-2016 the FFmpeg developers built with gcc 4.8.5 (GCC) 20150623 (Red Hat 4.8.5-4) configuration: --prefix=/root/ffmpeg_build
--extra-cflags=-I/root/ffmpeg_build/include --extra-ldflags=-L/root/ffmpeg_build/lib --bindir=/root/bin --pkg-config-flags=--static --enable-gpl --enable-nonfree --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 libavutil 55. 19.100 / 55. 19.100 libavcodec 57. 28.100 / 57. 28.100 libavformat 57. 28.100 / 57. 28.100 libavdevice 57. 0.101 / 57. 0.101 libavfilter 6. 39.102 /
6. 39.102 libswscale 4. 0.100 / 4. 0.100 libswresample 2. 0.101 / 2. 0.101 libpostproc 54. 0.100 / 54. 0.100 Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'a_4293_06.mp4': Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf57.28.100 Duration: 00:01:40.10, start: 0.023220, bitrate: 492 kb/s
Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 320x240, 376 kb/s, 30 fps, 30 tbr, 15360 tbn, 60 tbc (default)
Metadata:
handler_name : VideoHandler
Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 123 kb/s (default)
Metadata:
handler_name : SoundHandler At least one output file must be specified
最佳答案
感谢 @llogan的评论我可以自己回答这个。
首先,我将ffmpeg升级到最新版本,然后研究了 -movflags 和 +快速启动 .
我发现了一篇 2015 年的文章,其中包含有关如何将 .flv 转换为 .mp4 (https://addpipe.com/blog/flv-to-mp4/) 的大量信息
因此,为了使新的 .mp4 文件与移动设备兼容,您需要添加配置文件和级别,如下所示:
在 批量转换 :
for i in *.flv; do ffmpeg -y -i "$i" -movflags +faststart -profile:v baseline -level 3.0 "${i%.*}.mp4"; done
ffmpeg -i filename.flv -movflags +faststart -profile:v baseline -level 3.0 filename.mp4
Starting second pass: moving the moov atom to the beginning of the file
关于ffmpeg在Video JS中重新编码手机上的mp4文件错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54120136/
我是一名优秀的程序员,十分优秀!