Pmmlabs / OpenPeriscope

Unofficial Periscope client
GNU General Public License v2.0
74 stars 30 forks source link

Get camera rotation of video #65

Closed EitanGoldfrad closed 7 years ago

EitanGoldfrad commented 7 years ago

Hey,

Is there a way to get the updated orientation of the video (if vertical or horizontal or flipped) The property "camera_rotation" in the 'accessChannel' function does not update, it just stays with its initial value.

Thanks

Pmmlabs commented 7 years ago

Hi. Real-time orientation comes with video stream, in TS metadata. Using API it's impossible to get this data.

EitanGoldfrad commented 7 years ago

I think it has to be in some method of the API because the ts stream is always 320x568 but in the periscope.tv site they rotate the video when the phone is rotated but the stream itself stays in the initial 320x568 and so does the metadata. Could there be any other function that could do that?

Pmmlabs commented 7 years ago

periscope.tv player parses TS stream and extracts metadata:

default

Therefore there isn't separate API method.

EitanGoldfrad commented 7 years ago

Ohh I see. Is there a way to get this data using ffmpeg?

Pmmlabs commented 7 years ago

As far as I know, no. I tried -f ffmetadata metadata.txt option, but periscope metadata is absent in output. You can parse the stream manually, for example

 ffmpeg -i "[url]" -c copy -f mpegts - | head | xxd | grep -A 1 rotation

prints some bytes after "rotation" word. Rotation is represented as 64-bit float after it and 0x00 byte.