4

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

elgeko
  • 127
  • 1
  • 1
  • 11
  • Does the first command work as expected? I don't have a similar stream to test and using `loop` with a static image URL blocks. – aergistal Nov 12 '15 at 15:29
  • yes with the first command ( ffmpeg -v debug -loop 1 -f image2 -i http://IP_ADDRESS/image.jpg -c:v libx264 http://FFSERVER_IP_ADDRESS:8090/feed.ffm ) I can get the stream from the ffserver but since the camera is rotated by ninety degrees (and therefore the images are rotated) I need to rotate the output to have the video in the right angle. – elgeko Nov 12 '15 at 15:40
  • Concerning the second command (the one with the `transpose`), what happens if you output to a local file, say an `mp4`? – aergistal Nov 13 '15 at 08:37
  • It works when i use a local file as output. – elgeko Nov 13 '15 at 09:48
  • Anything weird in your ffserver config? Can you post it? – aergistal Nov 13 '15 at 11:14
  • I just added in the question section my ffserver config. Thanks – elgeko Nov 13 '15 at 11:25

2 Answers2

4

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.

Alex North-Keys
  • 4,200
  • 1
  • 20
  • 22
0

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.

aergistal
  • 29,947
  • 5
  • 70
  • 92
  • This didn't solve the problem. I got a video with the image size transposed but not actually rotated, ie my image is 432x240 and I get a video of 240x432 but still rotated 90 degrees – elgeko Nov 13 '15 at 12:49
  • Weird, this worked for me with a static image and `flv` (for some reason `h264` makes ffserver segfault with the latest git version). I ran out of ideas, maybe try the `rotate` filter instead but I don't think this is the issue. – aergistal Nov 13 '15 at 14:42
  • as expected also the rotate option doesn't work. Thanks anyway – elgeko Nov 13 '15 at 15:06
  • I'm still fighting with this one myself, but have a look at the -override_ffserver option to ffmpeg to use in the Feed section of the ffserver config. – Alex North-Keys Sep 08 '16 at 02:11