[FFmpeg-devel] [PATCH] Add example transcoding.c
Andrey Utkin
andrey.krieger.utkin at gmail.com
Tue Feb 18 12:23:29 CET 2014
2014-02-18 11:02 GMT+02:00 Nicolas George <george at nsup.org>:
> Le decadi 30 pluviôse, an CCXXII, Andrey Utkin a écrit :
>> Besides comments, _testing_ is appreciated.
>> I have tested it under valgrind with file with mpeg4 video and mp2 audio,
>> generated with:
>> ffmpeg -f lavfi -i testsrc -f lavfi -i aevalsrc=0 -map 0 -map 1 -vcodec mpeg4 -acodec mp2 -f mpegts ~/testmp4_long.ts -y
>> With this file it works without leaks, except for
>> ==20556== 40 bytes in 1 blocks are still reachable in loss record 1 of 1
>> ==20556== at 0x4C2A018: memalign (vg_replace_malloc.c:727)
>> ==20556== by 0x4C2A0A7: posix_memalign (vg_replace_malloc.c:876)
>> ==20556== by 0xCE7A29: av_malloc (mem.c:94)
>> ==20556== by 0xA294F9: default_lockmgr_cb (utils.c:78)
>> ==20556== by 0xA3007B: ff_lock_avcodec (utils.c:3292)
>> ==20556== by 0xA30288: avcodec_open2 (utils.c:1190)
>> ==20556== by 0x5C59B1: avformat_find_stream_info (utils.c:2989)
>> ==20556== by 0x465533: main (transcoding.c:62)
>>
>> anybody knows is this curable?
>
> What would need to be cured?
Non-empty valgrind report. This wasn't here before.
>> Haven't tried with subtitles yet.
>> This example doesn't work with h264 reencoding, because i libx264 refuses
>> to work because of "broken settings". I gave up investigating what is
>> wrong with that. Apparently this has something to do with
>> avcodec_copy_context() (which i used to init encoders' avctxs, too),
>> because libx264 behaves well if you manually setup all AVCodecContext
>> fields from scratch.
>
> Then you probably should not be using avcodec_copy_context() at all.
I haven't used it in my apps before in this case, but i would like to
use it at last here for brevity, because internally it really does
what is needed - it copies all properties. And it feels wrong to
rewrite similar procedure in each project. It just copies something
what is usually not set, and this confuses libx264.
--
Andrey Utkin
More information about the ffmpeg-devel
mailing list