備忘録: ffmpeg ちゃんはとっても繊細
とある動画ファイル(FLV)を MP4 にこねこねしてあれそれしようと思ったら ffmpeg に怒られた。
元ファイル↓
ffmpeg version 3.1.3 Copyright (c) 2000-2016 the FFmpeg developers built with Apple LLVM version 7.3.0 (clang-703.0.31) configuration: --enable-libx264 --enable-gpl libavutil 55. 28.100 / 55. 28.100 libavcodec 57. 48.101 / 57. 48.101 libavformat 57. 41.100 / 57. 41.100 libavdevice 57. 0.101 / 57. 0.101 libavfilter 6. 47.100 / 6. 47.100 libswscale 4. 1.100 / 4. 1.100 libswresample 2. 1.100 / 2. 1.100 libpostproc 54. 0.100 / 54. 0.100 [flv @ 0x7ffe79800400] audio stream discovered after head already parsed Input #0, flv, from 'in.flv': Metadata: moovPosition : 36 avcprofile : 100 avclevel : 30 aacaot : 2 videoframerate : 30 audiochannels : 2 timescale : 1000 length : 0 sampletype : amf0 Duration: 01:29:14.17, start: 0.013000, bitrate: 1006 kb/s Stream #0:0: Audio: aac (LC), 48000 Hz, stereo, fltp
これを適当に作ったシェルで MP4 に変換する。
ここを参考に…というかほぼ丸写し。
-analyzeduration, -provesize についてはこちらでご指摘をいただきました。
するとこうなる。
[mp4 @ 0x7fa7f9803e00] Using AVStream.codec to pass codec parameters to muxers is deprecated, use AVStream.codecpar instead. Output #0, mp4, to 'out.mp4': Metadata: moovPosition : 36 avcprofile : 100 avclevel : 30 aacaot : 2 videoframerate : 30 audiochannels : 2 timescale : 1000 length : 0 sampletype : amf0 encoder : Lavf57.41.100 Stream #0:0: Audio: aac (LC) ([64][0][0][0] / 0x0040), 48000 Hz, stereo Stream mapping: Stream #0:0 -> #0:0 (copy) Press [q] to stop, [?] for help [flv @ 0x7fa7f8808000] video stream discovered after head already parsed [flv @ 0x7fa7f8808000] New video stream 0:1 at pos:82413 and DTS:6.467s size= 63725kB time=01:29:14.15 bitrate= 97.5kbits/s speed=1.29e+03x video:0kB audio:62743kB subtitle:0kB other
New video stream 0:1 at pos:82413 and DTS:6.467s
ってお前…オプション見たんかいな…?
なのでこうする。
すると今度はちゃんと動画ストリームも読み込んでくれた。
-i オプションの位置は大事だよって話はしたけど…お前もか…
終わり。