简体   繁体   English

ffmpeg旋转图像以提供ffserver

[英]ffmpeg rotate image to feed ffserver

With ffmpeg I am providing a feed to ffserver from an image repeatedly read. 使用ffmpeg,我从反复读取的图像中为ffserver提供了一个feed。 I use the following instruction 我使用以下说明

ffmpeg -v debug -loop 1 -f image2 -i http://IP_ADDRESS/image.jpg -c:v libx264 http://FFSERVER_IP_ADDRESS:8090/feed.ffm

In this way I can get the stream from the server but I need to rotate the resulting stream. 通过这种方式,我可以从服务器获取流,但我需要旋转生成的流。

I tried with the -vf transpose=1 option in this way 我用这种方式尝试了-vf transpose = 1选项

ffmpeg -v debug -loop 1 -f image2 -i http://IP_ADDRESS/image.jpg -c:v libx264 -vf transpose=1 http://FFSERVER_IP_ADDRESS:8090/feed.ffm

but nothing happens. 但没有任何反应。

my ffserver.conf 我的ffserver.conf

HTTPPort 8090
RTSPPort 7654
HTTPBindAddress 0.0.0.0
MaxHTTPConnections 2000
MaxClients 1000
MaxBandwidth 1000
CustomLog -

<Feed feed.ffm>
File path_to_file/feed.ffm
FileMaxSize 10000K
ACL allow 192.168.1.0 192.168.1.255
</Feed> 

<Stream test.h264>
Feed feed.ffm
Format rtp
Noaudio
</Stream>

Suggestions? 建议?

thanks 谢谢

I managed to solve a similar problem with this, with the most important bits being the "-c:v mjpeg" and "-override_ffserver". 我设法解决了类似的问题,最重要的部分是“-c:v mjpeg”和“-override_ffserver”。

<Feed feed1.ffm>
  File /var/tmp/feed1.ffm
  FileMaxSize 1M
  Launch ffmpeg -i /dev/video0 -override_ffserver -c:v mjpeg -metadata:s:v rotate=0 -vf 'transpose=dir=clock,drawtext=fontcolor=white:fontfile=/usr/share/fonts/truetype/ubuntu-font-family/UbuntuMono-R.ttf:expansion=strftime:text=%FT%T:x=(w-text_w)/2:y=h-text_h-5' 
</Feed>

<Stream test>
  Feed feed1.ffm
  Format mpjpeg
  VideoSize 720x1280
  VideoFrameRate 5
  Strict -2
</Stream>

And going to: http://localhost:8090/test 并转到: http:// localhost:8090 / test

This ended up finally showing my webcam's video with the filters not being overridden by ffserver defaults, ie: 这最终显示我的网络摄像头的视频过滤器没有被ffserver默认值覆盖,即:

  • Rotated 90 degrees to compensate for my webcam's odd mounting 旋转90度以补偿我的摄像头奇怪的安装
  • Timestamps in the bottom center 底部中心的时间戳

I'm still messing with the resolution, but I hope this helps solve the filters problem for you. 我仍在搞乱分辨率,但我希望这有助于解决您的滤镜问题。

You are not specifying a video size in the ffserver stream configuration, so it uses a default value. 您没有在ffserver流配置中指定视频大小,因此它使用默认值。 Eg: 例如:

ffserver.conf:15: Setting default value for video size = 160x128. Use NoDefaults to disable it.

For some reason it seems this reverts the transpose. 由于某种原因,它似乎恢复了转置。

The solution is to add a VideoSize WxH to <Stream> using the frame size of the transposed image. 解决方案是使用转置图像的帧大小将VideoSize WxH添加到<Stream>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM