how to convert RTPDUMP video file to mp4
Asked Answered
C

2

7

Viber recently got "instant video message" option, called also "video push-to-talk" (vptt).

Inside viber data in directory ".vptt" there are files with vptt extension. Envelope format is classic ZIP file, when extracted gives jpg-thumbnail and 'video' file.

Video file says "#!rtpplay1.0" inside first line, so it should be format of rtp-tools, used by wireshark too, and somehow related to actual WebRTC trends...

So if video content inside this rtpdump file is not encrypted ( ? ), "how to save viber instant message push to talk video" boils down to just: "how to convert rtpdump video to mp4".

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

does someone knows something further about this?

Cramer answered 2/3, 2017 at 20:8 Comment(0)
H
7

rtpdump files can be converted to mp4 using rtpplay and FFmpeg.

For example, let's 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 

Analyis 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/investination/just trying all of them.

Let's assign port 4646 for video and 4848 for audio and create some 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

Let's then prepare a command line to start FFmpeg that will listen those ports according to SDP save to MP4 file:

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

FFmpeg exits after 10 seconds of failing to receive any packet, so don't start that command line just yet.

Then, in another console tab, prepare rtpplay command lines:

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

Also don't start it yet. Note that there are two rtpplays which should be started simultaneously.

Now, in quick succession, start the prepared FFmpeg command line, then the rtpplays. Wait until rtpplays finish (about a minute). FFmpeg should then time out and your file is done.

The mkv file may be converted to MP4, but it requires transcoding because of VP8 is not supported in MP4. The transcoding may also be done with FFmpeg.

Unfortunately, audio/video synchronisation may be an issue, which may also be addressed using FFmpeg trickery; or by adjusting the sample rate in SDP like VP8/95000.

Hysteresis answered 5/11, 2017 at 4:57 Comment(0)
H
1

It works with Viber for Ubuntu:

  • Open your Viber for PC
  • play the message
  • find it in folder Viber -> Media with .mp4 extension.

I haven't tried with others

Helms answered 11/11, 2020 at 12:46 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.