How to convert RTPDUMP video file to mp4

Recently, Viber received the option "instant video message", also called the "video stream" (vptt).

Inside the viber data, there are files with the vptt extension in the .vptt directory. An envelope format is a classic ZIP file, when you extract it you get a jpg-thumbnail and a video file.

The video says "#! Rtpplay1.0" inside the first line, so it should be the rtp-tools format used by wirehark too, and somehow related to the actual trends of WebRTC ...

So, if the video content inside this rtpdump file is not encrypted (?), "How to save a video with a quick viber message for conversation" comes down to a simple one: "how to convert rtpdump video to mp4".

rtpplay can send it to some port, but ffmpeg / ffplay / vlc needs the correct sdp file.

Does anyone else know about this?

+4
source share
1 answer

Rtpdump files can be converted to mp4 using rtpplayand FFmpeg.

For example, consider these files:

Analyze them:

$ rtpdump -Fascii -f narwhals-audio.rtpdump  | head -n 1
       0.000000 RTP len=15 from=0.0.0.0:0 v=2 p=0 x=0 cc=0 m=1 pt=97 (????,0,0) seq=1679 ts=249986024 ssrc=0xf944ac63 
$ rtpdump -Fascii -f narwhals-audio.rtpdump  | tail -n 1
      65.570000 RTP len=15 from=0.0.0.0:0 v=2 p=0 x=0 cc=0 m=1 pt=97 (????,0,0) seq=4959 ts=253134824 ssrc=0xf944ac63 

Analysis Results:

Audio sample rate = (253134824 - 249986024) / (65.57 - 0) ~= 48000
Audio codec: probably opus
Audio payload type: 97

Video sample rate: 90000
Video codec : probably VP8
Video payload type: 96

Codec names may require some guesswork / investment / just for everyone.

Let us assign port 4646 for video and 4848 for audio and create an SDP file:

v=0
c=IN IP4 127.0.0.1
m=video 4646 RTP/AVP 96
a=rtpmap:96 VP8/90000
m=audio 4848 RTP/AVP 97
a=rtpmap:97 opus/48000

Then prepare a command line to run FFmpeg, which will listen on these ports according to the SDP stored in the MP4 file:

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

FFmpeg 10 - , .

rtpplay:

rtpplay -T -f narwhals-video.rtpdump 127.0.0.1/4646 & rtpplay -T -f narwhals-audio.rtpdump 127.0.0.1/4848

. , rtpplay, .

, , FFmpeg, rtpplay s. , rtpplays ( ). FFmpeg - .

mkv MP4, , VP8 MP4. FFmpeg.

, /, FFmpeg; SDP, VP8/95000.

+1

Source: https://habr.com/ru/post/1671294/


All Articles