Following the examples of ffmpeg: decoding_encoding.c and filtering_video.c, I process one video file made by iPhone. Video file: .mov, video sizes; 480x272, video codec: H.264 / AVC, 30 frames per second, bit: 605 kbps.
First, I retrieve every frame that is YUV. I convert YUV to RGB24 and process RGB24 and then write RGB24 to a .ppm file. It shows that the .ppm file is correct.
Then I plan to encode the processed RGB24 frames into a video file. Since MPEG does not support the RGB24 image format, I used AV_CODEC_ID_HUFFYUV. But the output video file (showing 18.5 MB) does not play. Movie Player on Ubuntu reports an error: could not determine the type of stream. I also tried this on VCL. It just does not work without any errors.
My minor questions: For each extracted frame from the input video file, I get its pts as follows according to filtering_video.c:
frame->pts = av_frame_get_best_effort_timestamp(frame);
I print each frame of the frame and find that it is incremented by 20, as shown below:
pFrameRGB_count: 0, frame->pts: 0
pFrameRGB_count: 1, frame->pts: 20
pFrameRGB_count: 2, frame->pts: 40
pFrameRGB_count: 3, frame->pts: 60
Where frame is the extracted frame from the input video, and pFrameRGB_count is the counter for the processed frame in the form of RGB24.
Why are they wrong?
source
share