built on Jul 15 2014 13:53:49 with gcc 4.8.1 built on Jul 15 2014 13:53:49 with gcc 4.8.1 *** THIS PROGRAM IS DEPRECATED *** This program is only provided for compatibility and will be removed in a future release. Please use avconv instead. Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'big.mp4': Metadata: major_brand : isom minor_version : 1 compatible_brands: isom creation_time : 2015-02-05 20:35:09 Duration: 00:21:36.12, start: 0.000000, bitrate: 788 kb/s Stream #0.0(und): Video: h264 (High), yuv420p, 720x404, 677 kb/s, 23.98 fps, 23.98 tbr, 24k tbn, 47.95 tbc Metadata: creation_time : 2015-02-05 17:05:45 Stream #0.1(und): Audio: aac, 48000 Hz, stereo, s16, 106 kb/s Metadata: creation_time : 2015-02-05 20:35:12 Incompatible sample format '(null)' for codec 'mp2', auto-selecting format 's16' Last message repeated 1 times Incompatible sample format '(null)' for codec 'libmp3lame', auto-selecting format 's16' [buffer @ 0x900f0c0] w:720 h:404 pixfmt:yuv420p [scale @ 0x8ea5080] w:720 h:404 fmt:yuv420p -> w:160 h:128 fmt:yuv420p flags:0x4 [buffer @ 0x8ea34a0] Invalid pixel format string '-1' Error opening filters!

7-我看错了,我找不到为什么会发生这种事,也找不到我哪里出错了!

到目前为止,我阅读了许多有关ffserver的示例和教程,但大多数都是关于实时流的,但我只想流一些mp4文件。

编辑:

我安装了真正的ffmpeg,如以下链接: https://askubuntu.com/questions/373322/how-to-replace-avconv-with-the-real-ffmpeg-and-have-it-work-right ,但同样的错误(只需将ppa更改为 ppa:mc3man/trusty-media ,以便最后发布):

代码语言: javascript
复制
pp@ubuntu:~$ ffmpeg -i big.mp4 http://localhost:8090/feed1.ffm
  built on Jul 15 2014 13:53:49 with gcc 4.8.1
*** THIS PROGRAM IS DEPRECATED ***
This program is only provided for compatibility and will be removed in a future release. Please use avconv instead.
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'big.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 1
    compatible_brands: isom
    creation_time   : 2015-02-05 20:35:09
  Duration: 00:21:36.12, start: 0.000000, bitrate: 788 kb/s
    Stream #0.0(und): Video: h264 (High), yuv420p, 720x404, 677 kb/s, 23.98 fps, 23.98 tbr, 24k tbn, 47.95 tbc
    Metadata:
      creation_time   : 2015-02-05 17:05:45
    Stream #0.1(und): Audio: aac, 48000 Hz, stereo, s16, 106 kb/s
    Metadata:
      creation_time   : 2015-02-05 20:35:12
Incompatible sample format '(null)' for codec 'mp2', auto-selecting format 's16'
    Last message repeated 1 times
Incompatible sample format '(null)' for codec 'libmp3lame', auto-selecting format 's16'
[buffer @ 0xa04e0c0] w:720 h:404 pixfmt:yuv420p
[scale @ 0x9ee4080] w:720 h:404 fmt:yuv420p -> w:160 h:128 fmt:yuv420p flags:0x4
[buffer @ 0x9ee24a0] Invalid pixel format string '-1'
Error opening filters!

有人能给我准确的命令,我应该运行测试吗?

(我知道这就像初学者的问题,但我读了文档,并尽我所能测试一切,但仍然没有运气)

EN

回答 1

Stack Overflow用户

发布于 2015-02-13 10:21:01

您不能使用ffserver对 mp4 进行流处理,因为它在文件头中包含全局元数据,这使得随机流访问变得不可能。您可以选择另一种格式,如 webm 或使用MPEG-2传输流(Apple的HLS).See https://superuser.com/questions/563591/streaming-mp4-with-ffmpeg

代码语言: javascript
复制
HTTPPort 8090
HTTPBindAddress 0.0.0.0
MaxHTTPConnections 2000
MaxClients 1000
MaxBandwidth 100000
CustomLog -
<Feed streamwebm.ffm>
  File /tmp/streamwebm.ffm
  FileMaxSize 50M
  ACL allow localhost
  ACL allow 128.199.149.46
  #ACL allow 127.0.0.1
  ACL allow 192.168.0.0 192.168.0.255
</Feed>
<Stream streamwebm>
#in command line run : ffmpeg -i yourvideo.mp4 -c:v libvpx -cpu-used 4 -threads 8    http://localhost:8090/streamwebm.ffm
Feed streamwebm.ffm
Format webm
# Video Settings
VideoFrameRate 30
VideoSize 624x368
# Audio settings
AudioCodec libvorbis
AudioSampleRate 48000
AVOptionAudio flags +global_header
MaxTime 0
AVOptionVideo me_range 16
AVOptionVideo qdiff 4
AVOptionVideo qmin 4
AVOptionVideo qmax 40
#AVOptionVideo good
AVOptionVideo flags +global_header
# Streaming settings
PreRoll 10
StartSendOnKey
Metadata author "author"
Metadata copyright "copyright"
Metadata title "Web app name"
Metadata comment "comment"
</Stream>
#stream for flv format
<Feed streamflv.ffm>
  File /tmp/streamflv.ffm
  FileMaxSize 50M
  ACL allow localhost
  ACL allow 192.168.88.89
  #ACL allow 127.0.0.1
  ACL allow 192.168.0.0 192.168.255.255
</Feed>
<Stream streamflv>
  Feed streamflv.ffm
  Format flv
  #Video Settings
  VideoCodec libx264
  VideoFrameRate 30
  VideoSize 640x360
  VideoBitRate 1000
  # Audio settings
  AudioCodec libfaac
  AudioSampleRate 22050
  AudioChannels 2 #this is creating problem
  AVOptionAudio flags +global_header
  MaxTime 0
  AVOptionVideo me_range 16
  AVOptionVideo qdiff 4
  AVOptionVideo qmin 4
  AVOptionVideo qmax 40
  #AVOptionVideo good
  AVOptionVideo flags +global_header
  # Streaming settings
  PreRoll 10
  StartSendOnKey
</Stream>
<Stream stat.html>
  Format status
  ACL allow localhost
  ACL allow 192.168.0.0 192.168.255.255
</Stream>