[Libav-user] help Encoding problem using libav API

Dirr Bernhard Bernhard.Dirr at newtec.de
Tue Feb 10 13:26:27 CET 2015

Dear ffmpeg community,

I am using the 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, as 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, local .mov file and same pixel format showed
the same problems.

Converting the video to images with:
ffmpeg -i testvideo.nut -f image2 img%05d.png
I analysed the pictures.

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".
Also included is a small script that will compile the application.
When the application is run, a file "testvideo.nut" should be
generated. See ffmpeg_libav.log.

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 --------------
A non-text attachment was scrubbed...
Name: buildVideoCoderTest.sh
Type: application/octet-stream
Size: 155 bytes
Desc: buildVideoCoderTest.sh
URL: <https://ffmpeg.org/pipermail/libav-user/attachments/20150210/1fc1a4c1/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ffmpeg_libav.log
Type: application/octet-stream
Size: 2138 bytes
Desc: ffmpeg_libav.log
URL: <https://ffmpeg.org/pipermail/libav-user/attachments/20150210/1fc1a4c1/attachment-0001.obj>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: VideoCoder.cpp
URL: <https://ffmpeg.org/pipermail/libav-user/attachments/20150210/1fc1a4c1/attachment.ksh>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: VideoCoder.h
URL: <https://ffmpeg.org/pipermail/libav-user/attachments/20150210/1fc1a4c1/attachment.h>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: VideoCoderTest.c
URL: <https://ffmpeg.org/pipermail/libav-user/attachments/20150210/1fc1a4c1/attachment.c>

More information about the Libav-user mailing list