开发者

ffmpeg black screen, sound working fine [closed]

开发者 https://www.devze.com 2023-02-18 06:53 出处:网络
Closed. This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post.
Closed. This question needs details or clarity. It is not currently accepting answers.

Want to improve this question? Add details and clarify the problem by editing this post.

Closed 6 years ago.

Improve this question

When converting an .flv file to .mp4 i used this command:

ffmpeg -i y.mp4.flv -ar 22050 y.mp4

Sound is fine but i have no image (not in web player & not when downloaded to pc) . FFmpeg is working fine when i'm grabbing some screens from .mp4 for "preview.jpg" files. So am I missing some kind of codec? (First time i'm converting video without commercial software... )

Also i'd like to ask if the is a more efficient way to开发者_如何转开发 detect file type then:

$video = file_get_contents("www.remotefile.com/1.mp4");
if (strpos($video, "flv") !== 0){// FLV, fLV etc
  file_put_contents($path."1.flv", $video);
  //further processing 
}

Edit: im using Debian Lenny as OS


Your black screen problem can only be solved by looking at the output of the ffmpeg command. If it can't detect a codec, it will say so. If you are using ffmpeg from Debian, it's likely to miss support for some formats.

 Stream #0.1: Video: unknown   // or something like that

(Your URLs are wrong. It needs a http:// prefix). Detecting the video type is achieved best by reading out the HTTP response header Content-Type. But that would be easier when using a HTTP library instead of file_get_contents.

If you want to rely on file extensions, then use this for simplicity:

if (strrchr($url, ".") == ".flv") {

Or a switch statement.

0

精彩评论

暂无评论...
验证码 换一张
取 消