[Libav-user] help Encoding problem using libav API

Dirr Bernhard Bernhard.Dirr at newtec.de
Wed Feb 11 09:36:37 CET 2015

Dear ffmpeg community,

I am using the libav... libraries to build a system that encodes V210 raw video
images lossless to a video file on a FTP server.
The application compiles and runs on a CentOS 5 X86_64 Linux system.

Therefore I chose the nut container format as it does not require
"seeking" in output. Also the FFV1 codec was choosen with the
pixel format AV_PIX_FMT_YUV422P10 because this setting is supposed to
reproduce exactly the original YCbCr422-10bit components values
for Y, Cb and Cr.

The system is now running in so far, video format is 1920x1080p25.
The encoding and muxing produces video files, both local or on
a FTP server.

But playing this files with ffplay or with VLC player reveals
a problem. The frames seem to display only every other pixel line
correctly, the incorrect lines are rendered as uniform green pixels.

Tests with v210 codec, or with a local .mov file instead of FTP and
same pixel format showed the same problems.

I converted the video to images with:
ffmpeg -i testvideo.nut -f image2 img%05d.png
to separate images and analysed the pictures as follows:

The 1st 5 pixels of every line seem to have correct properties.
The 6th pixel of the "bad" pixel lines seems to have some other
color as it is the case with the very last pixel of the "good"
lines. The remaining pixels of the "bad" lines all have same
dark green color.

Please find attached an archive (tar gz) with the software modules
"VideoCoderTest.c", "VideoCoder.h" and "VideoCoder.c".
When the application is run, a file "testvideo.nut" should be
generated. "ffmpeg_libav.log" contains the command, which was used
to compile the test application. Further it shows the outputs of

Please view the image of the very 1st frame.

Questions - Where is my error?
Wrong initialization of format and codec contexts?
Wrong initialization of output stream?
Wrong allocation and usage of the AVFrame object?
Wrong parameters in format-, codec-, stream-contexts?
Wrong parameter setting in AVFrame object?
May be a timing problem between application and threads in libav?

Is there a general problem in using nut container with either v210
or ffv1 codecs for the above mentioned pixel format?

Every help using this great library is very appreciated.

May be, when my problems get solved, this test could be placed in
your "API examples" folder (with detailed comments).

Best regards
Bernhard Dirr

I apologize for not reading the netiquette thoroughly.
Now the source and log files are included directly and 
a link is available to the image.

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: VideoCoder.cpp
URL: <https://ffmpeg.org/pipermail/libav-user/attachments/20150211/c07ecde3/attachment.ksh>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: VideoCoder.h
URL: <https://ffmpeg.org/pipermail/libav-user/attachments/20150211/c07ecde3/attachment.h>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: VideoCoderTest.c
URL: <https://ffmpeg.org/pipermail/libav-user/attachments/20150211/c07ecde3/attachment.c>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ffmpeg_libav.log
Type: application/octet-stream
Size: 2825 bytes
Desc: ffmpeg_libav.log
URL: <https://ffmpeg.org/pipermail/libav-user/attachments/20150211/c07ecde3/attachment.obj>

More information about the Libav-user mailing list