ffmpeg rotate image to feed ffserver

淺唱寂寞╮ 提交于 2019-12-10 17:50:01

问题


With ffmpeg I am providing a feed to ffserver from an image repeatedly read. 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

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

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


回答1:


I managed to solve a similar problem with this, with the most important bits being the "-c:v mjpeg" and "-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

This ended up finally showing my webcam's video with the filters not being overridden by ffserver defaults, i.e:

  • Rotated 90 degrees to compensate for my webcam's odd mounting
  • Timestamps in the bottom center

I'm still messing with the resolution, but I hope this helps solve the filters problem for you.




回答2:


You are not specifying a video size in the ffserver stream configuration, so it uses a default value. 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.



来源:https://stackoverflow.com/questions/33670073/ffmpeg-rotate-image-to-feed-ffserver

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!