I am a newbie to libav-users and I'm struggling a bit to get something to work.

I have 2 input files: 1) samples of uncompressed 16 bit audio 2) h.264 compressed frames (with SPS/PPS). The output should be an MP4 file with AAC audio and the same h.264 video. I've modeled my code after the output-example.c program in ffmpeg. This is the overview.

raw audio -> avcodec_encode_audio(AAC) -> av_interleaved_write_frame  \
                                                                      \
---> .mp4 output
                                                                      /
compressed H.264 frames   -> av_interleaved_write_frame               /

The audio part works correctly, but I am unable to get the video to play. As you can see, I write the individual H.264 frames directly, without going through any kind of encoder as I want to preserve the frame rate/bit rate, etc. The SPS/PPS are also sent to the output as the first 2 frames. I looked at a standard .mp4 file and it seems that the size of the frame is output first, then the frame itself. So I mimicked the output by adding the size of the frame into the output packet buffer before sending it to av_interleaved_write_frame, but still no luck.

I know when using ffmpeg to copy the frames instead of encoding that we should use -vcodec copy? Should my H.264 frames still go through some kind of copy encoder before sending to av_interleaved_write_frame? If so, does anyone know how to setup the encoder to just copy the data instead of encoding it?

Any help or other code samples would be greatly appreciated, I'm stuck.

Michael

~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
"email.txt" 18 lines, 1567 characters

_______________________________________________
libav-user mailing list
[email protected]
https://lists.mplayerhq.hu/mailman/listinfo/libav-user

Reply via email to