Hello,
I am encoding video data on an Android device, sending the encoded video
data to a server via websocket, and decoding the video data on the server.
This seems to work fine, except it appears that the timestamps are not set
in the decoded video frames.
On the Android client:
AVRational time_base = new AVRational();
time_base.num(1);
time_base.den(m_videoFormat.getFrameRate());
video_c.time_base(time_base);
frame.pts(0)
// For each frame:
frame.pts(frame.pts() + 1);
int ret = avcodec_encode_video2(video_c, pkt, frame, got_output);
if (ret < 0) {
return(-1);
}
if (got_output) {
System.out.printf("Write frame %3d, (size=%5d), (milliseconds: %14d),
(tstamp: %8d)\n",
m_iFrames, pkt.size(), time, pkt.pts());
// Send pkt.data to server via websocket
:
:
:
}
On the client the printf appears to display valid timestamps.
Write frame 37, (size= 1275), (milliseconds: 1415727731456), (tstamp:
20)
On the server:
// For each chunk of video data read from websocket...
avpkt.size = iBytes; // iBytes is length of data read from websocket
avpkt.data = cBytes; // cBytes is data read from websocket
int len = avcodec_decode_video2(c, frame, &got_frame, &avpkt);
if (len < 0) {
return(-1);
}
if (got_frame) {
printf("Frame timestamps: pts: %lld, dts: %lld, base: %lld. \n",
(long long)avpkt.pts, (long long)avpkt.dts,
av_q2d(c->time_base));
// Write frame to disk...
}
On the server the timestamps appear to be not set.
Frame timestamps: pts: -9223372036854775808, dts: -9223372036854775808,
base: 222879922077.
Any idea what I'm doing wrong? Thanks in advance for any suggestions!
Charles_______________________________________________
Libav-user mailing list
[email protected]
http://ffmpeg.org/mailman/listinfo/libav-user