0

I have saved a video call to a .pcap file with Wireshark, and I want to acquire the video from RTP packets. RTP packets payload type is vp8, I could find out the vp8 RTP packets by using libpcap library in C++. Then I saved the contents of all RTP vp8 packets to a file. But i can not convert this raw vp8 data to .mp4 by using ffmpeg. ffmpeg gives error during conversion. ffmpeg conversion error : Invalid data found when processing input

What are the steps to get .mp4 or .webm video file from vp8 RTP packets?

Edit : I could get raw VP8 data excluding VP8 payload descriptor, payload header and keyframe header. Then I added ivf header and frame header for each vp8 raw frame, according to ivf document IVF Document

But When I want to convert my ivf file (output1) to output1.mp4 by using ffmpeg

ffmpeg -i output1 -c:v vp8 output1.mp4

I get errors

convertion error

Pankaj Vavadiya
  • 481
  • 7
  • 15
Ibrahim
  • 320
  • 2
  • 7
  • "Then I saved the contents of all RTP vp8 packets to a file." - did you maintain packet boundaries? I.e. is it just binary concatenated garbage or is each packet still an individual VP8 frame with valid timestamps etc.? – Ronald S. Bultje May 08 '17 at 14:41
  • I get all RTP packets including VP8 and Then I have extracted RTP header from these packets and I saved RTP payload data. The data that I saved is only concatenated RTP payloads. And now I want to acquire the video from that raw data.Probably, Firstly I have to find the boundaries of each frame and then I have to add a header for each frame to be able to play in vp8 format. I could extract vp8 payload header by using S bit and Part ID. So that I think I could find right the boundary of each frame. – Ibrahim May 09 '17 at 07:34

1 Answers1

2

JanusGateway is having functionality to convert RTP (VP8/VP9/H264/Opus) to (webm/mp4). It will just encode RTP to corresponding container(webm/mp4/opus), no transcoder is included.

You can use ffmpeg to transcode it to any other format.

In brief, janus will store RTP packets in a file by adding a prefix header in each packet. Then we can use post processor to convert vp8 RTP packets to webm.

https://github.com/meetecho/janus-gateway/blob/master/postprocessing/pp-webm.c

You can see the live demo & Documentation.

Ajay
  • 2,483
  • 2
  • 16
  • 27
  • I could get raw VP8 data excluding .VP8 payload descriptor, header and keyframe header. Then I added ivf header and frame header for each vp8 raw frame, according to ivf document. https://wiki.multimedia.cx/index.php/IVF But When I want to convert my ivf file (output1) to output1.mp4 by using ffmpeg ffmpeg -i output1 -c:v vp8 output1.mp4 I get errors Invalid sync code 48c11d. and Could not find tag for codec vp8 in stream #0, codec not currently supported in container Could not write header for output file #0 (incorrect codec parameters – Ibrahim May 17 '17 at 14:15
  • 1
    Anyone could give information about details of prefix header that must be added for each vp8 frame? – Ibrahim May 17 '17 at 14:25
  • Can I convert RTP(VP8 packets) to webm from wireshark pcap? Is JanusGatway use IVF header? – Pankaj Vavadiya Oct 03 '17 at 13:01