[Libav-user] Example for recompressing a video?
Nicolas George
nicolas.george at normalesup.org
Tue Jun 5 10:50:59 CEST 2012
Le septidi 17 prairial, an CCXX, jettoblack a écrit :
> Thanks for the input. I managed to get video encoding working and
> everything looks good there. The solution was to use the
> picture.best_effort_timestamp as the pts of encoded frame instead of the
This is the right choice. Also, please note that:
* Code outside libavcodec should access this field using:
* av_frame_get_best_effort_timestamp(frame)
> pkt.pts (since I have now learned that a pkt could contain 0 or more
> pictures, not necessarily one picture per packet).
It should not, as libavutil splits the format-level packets into frame
(provided it has a parser). But the frame you get from
avcodec_decode_video42() is not necessarily the one encoded by the packet
you just gave it, so the PTS do
not match.
> However I'm still having trouble with the audio, specifically resampling and
> encoding. If I simply pass the source audio through, it works ok. The call
> to avresample_convert() seems to work ok (returns a valid length). The
> first call to avcodec_encode_audio2() will succeed, but all subsequent calls
> after the first will return -22 (Illegal argument error). I'm not sure what
> argument is illegal especially since the first call succeeds.
>
> Does anyone have any ideas where I went wrong on the audio encoding part? I
> put the whole source code below. I'm looking forward to any suggestions. :)
You should start by trimming your code to the bare minimum exhibiting the
bad behaviour. Your current code is quite long, and seems to have
accumulated some dead code (I see video_outbuf allocated but never used).
Reviewing it in this state would be tiring and not very productive effort.
Regards,
--
Nicolas George
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20120605/1d7ea3db/attachment.asc>
More information about the Libav-user
mailing list