You are not logged in.

#1 2019-04-26 05:49:28

misko_2083
Member
Registered: 2016-05-24
Posts: 252

Viber vptt format conversion

How can I convert the Viber push to talk (ptt) video?
It's in this strange format I've never seen before.
With Viber there is no option to export the video,
it can only be forwarded.

xxxx.vptt file is an archive that stores two files.
The first file is preview, that seems to be a photo.
The second one is the video file with the first line:

#!rtpplay1.0 

Nothing can play the video other than Viber
and when played video is in the small circle.

Offline

#2 2019-04-26 10:25:17

brontosaurusrex
Middle Office
Registered: 2015-09-29
Posts: 1,937
Website

Re: Viber vptt format conversion

Offline

#3 2019-04-26 17:12:14

twoion
ほやほや
Registered: 2015-08-10
Posts: 2,555

Re: Viber vptt format conversion

To explain this to the OP: RTP is a protocol used for transmitting audio and video as part of SIP (video-)telephony or similar.

The stackoverflow posts essentially simulates a subset of a SIP telephone call by creating a SDP (stream description) protocol packet to describe the stream data (properties derived through analysis) and then dump the SDP packet as well as the stream into FFmpeg which then can interpret and decode the stream(s) and reencode it. The catch here is that the information required to decode the stream correctly is not part of the media file itself but needs to be input using SDP.

It seems like you would be also able to play back a stream transmitted like this using VLC (https://wiki.videolan.org/Documentation … _a_Stream/).

I wonder if there is a simpler tool that can handle this all-in-one.

Seems like there was quite a lot of analysis done on Viber's decision to use RTP (https://www.youtube.com/watch?v=Gr7PJAyMJdU etc).

Very interesting topic (having worked with Asterisk RTP before smile).


At the end of the river the sundown beams

Online

#4 2019-04-27 12:08:59

misko_2083
Member
Registered: 2016-05-24
Posts: 252

Re: Viber vptt format conversion

Good find. Thank you.

twoion wrote:

To explain this to the OP: RTP is a protocol used for transmitting audio and video as part of SIP (video-)telephony or similar.

The stackoverflow posts essentially simulates a subset of a SIP telephone call by creating a SDP (stream description) protocol packet to describe the stream data (properties derived through analysis) and then dump the SDP packet as well as the stream into FFmpeg which then can interpret and decode the stream(s) and reencode it. The catch here is that the information required to decode the stream correctly is not part of the media file itself but needs to be input using SDP.

It seems like you would be also able to play back a stream transmitted like this using VLC (https://wiki.videolan.org/Documentation … _a_Stream/).

I wonder if there is a simpler tool that can handle this all-in-one.

Seems like there was quite a lot of analysis done on Viber's decision to use RTP (https://www.youtube.com/watch?v=Gr7PJAyMJdU etc).

Very interesting topic (having worked with Asterisk RTP before smile).

I see. It's a protocol for video and audio that's probably sending packets like udp.

In the stackoverflow post the loopback 127.0.0.1 is used to stream into FFmpeg.
But there are two files - one for audio stream and the other for video.

Here's only one file.

$ rtpdump -Fascii -f /home/misko/Desktop/video | head -1
       0.000000 RTP len=1152 from=0.0.0.0:0 v=2 p=0 x=0 cc=0 m=0 pt=120 (????,0,0) seq=23389 ts=3109719489 ssrc=0x377fc538 

$ rtpdump -Fascii -f /home/misko/Desktop/video | tail -n 1
      19.123000 RTP len=1102 from=0.0.0.0:0 v=2 p=0 x=0 cc=0 m=0 pt=120 (????,0,0) seq=24985 ts=3111458469 ssrc=0x377fc538 
$ rtpdump -Fascii -f /home/misko/Desktop/video | tail
      19.080000 RTP len=663 from=0.0.0.0:0 v=2 p=0 x=0 cc=0 m=0 pt=113 (????,0,0) seq=17937 ts=950589137 ssrc=0xfd39ce7d 
      19.120000 RTP len=663 from=0.0.0.0:0 v=2 p=0 x=0 cc=0 m=0 pt=113 (????,0,0) seq=17938 ts=950589457 ssrc=0xfd39ce7d 
      19.120000 RTP len=663 from=0.0.0.0:0 v=2 p=0 x=0 cc=0 m=0 pt=113 (????,0,0) seq=17939 ts=950589777 ssrc=0xfd39ce7d 
      19.120000 RTP len=1102 from=0.0.0.0:0 v=2 p=0 x=0 cc=0 m=0 pt=120 (????,0,0) seq=24979 ts=3111458469 ssrc=0x377fc538 
      19.120000 RTP len=1102 from=0.0.0.0:0 v=2 p=0 x=0 cc=0 m=0 pt=120 (????,0,0) seq=24980 ts=3111458469 ssrc=0x377fc538 
      19.121000 RTP len=1102 from=0.0.0.0:0 v=2 p=0 x=0 cc=0 m=0 pt=120 (????,0,0) seq=24981 ts=3111458469 ssrc=0x377fc538 
      19.122000 RTP len=1102 from=0.0.0.0:0 v=2 p=0 x=0 cc=0 m=0 pt=120 (????,0,0) seq=24982 ts=3111458469 ssrc=0x377fc538 
      19.122000 RTP len=1102 from=0.0.0.0:0 v=2 p=0 x=0 cc=0 m=0 pt=120 (????,0,0) seq=24983 ts=3111458469 ssrc=0x377fc538 
      19.122000 RTP len=1102 from=0.0.0.0:0 v=2 p=0 x=0 cc=0 m=0 pt=120 (????,0,0) seq=24984 ts=3111458469 ssrc=0x377fc538 
      19.123000 RTP len=1102 from=0.0.0.0:0 v=2 p=0 x=0 cc=0 m=0 pt=120 (????,0,0) seq=24985 ts=3111458469 ssrc=0x377fc538 

FFmpeg needs to know which codecs to use, what bitrate.
It's tricky to make SDP.

I will try with VLC and see how that goes.

Update: Yep, SDP is needed to play it in VLC. big_smile

Last edited by misko_2083 (2019-04-27 12:22:25)

Offline

#5 2019-04-27 20:17:45

misko_2083
Member
Registered: 2016-05-24
Posts: 252

Re: Viber vptt format conversion

Had a little sleep and it was so easy to calculate SDP:
Audio:

$ rtpdump -Fascii -f /home/misko/Desktop/video | grep "pt=113" | head -1
       0.041000 RTP len=663 from=0.0.0.0:0 v=2 p=0 x=0 cc=0 m=0 pt=113 (????,0,0) seq=16984 ts=950284177 ssrc=0xfd39ce7d 
$ rtpdump -Fascii -f /home/misko/Desktop/video | grep "pt=113" | tail -n 1
      19.120000 RTP len=663 from=0.0.0.0:0 v=2 p=0 x=0 cc=0 m=0 pt=113 (????,0,0) seq=17939 ts=950589777 ssrc=0xfd39ce7d 

So, (ts2 - ts1) / (t2 - t1)
( 950589777 - 950284177 ) / ( 19.120 - 0.041 ) ~= 16000

Video:

$ rtpdump -Fascii -f /home/misko/Desktop/video | grep "pt=120" | head -1
       0.000000 RTP len=1152 from=0.0.0.0:0 v=2 p=0 x=0 cc=0 m=0 pt=120 (????,0,0) seq=23389 ts=3109719489 ssrc=0x377fc538 
$ rtpdump -Fascii -f /home/misko/Desktop/video | grep "pt=120" | tail -n 1
      19.123000 RTP len=1102 from=0.0.0.0:0 v=2 p=0 x=0 cc=0 m=0 pt=120 (????,0,0) seq=24985 ts=3111458469 ssrc=0x377fc538 

(ts2 - ts1) / (t2 - t1)
( 3111458469 - 3109719489 ) / ( 19.123 - 0 ) ~= 90000

Video is definitely VP8
Audio not sure

SDP: https://tools.ietf.org/html/rfc4566

v=0
c=IN IP4 127.0.0.1
m=video 4646 RTP/AVP 120
a=rtpmap:120 VP8/90000
m=audio 4848 RTP/AVP 113
a=rtpmap:113 opus/16000

then I start vlc with SDP

vlc -vvv SDP

and rtpplay

rtpplay -T -f video 127.0.0.1/4646 & rtpplay -T -f video 127.0.0.1/4848

Video plays but no audio.
I wonder which audio codec Viber uses.
They did not specify it anywhere-https://en.wikipedia.org/wiki/Compariso … P_software

So far no luck with audio codecs:
https://www.iana.org/assignments/rtp-pa … ters.xhtml
With L24 there was only some noise.
-------
Edit: Hah, it was opus all along. smile
Just VLC can't play it for some reason, port or something else.
Did this (of course in one terminal like vlc):

ffmpeg -v warning -protocol_whitelist file,udp,rtp -f sdp  -i SDP  -copyts -c copy -y video.mkv

and then in another termial:

rtpplay -T -f video 127.0.0.1/4646 & rtpplay -T -f video 127.0.0.1/4848

video.mkv is created but VLC will not play it at all.
SMPlayer Video only.
QMPlay2 plays it with audio working.

Thank you for your help twoion and brontosaurusrex.

Edit 2: Converted the video with OpenShot to mpeg and now it plays in vlc and smplayer, both with sound.
No idea why Vlc can't use FFmpeg to decode the video.
Anyway Solved.

Last edited by misko_2083 (2019-04-27 21:08:17)

Offline

Board footer

Powered by FluxBB