Re: [Libav-user] how to set mjpeg encoding quality programmatically?
2016-06-09 23:29 GMT+10:00 Carl Eugen Hoyos: > YIRAN LI writes: > > > AVCodecContext.flags |= CODEC_FLAG_QSCALE > > and AVCodecContext.global_quality = qscale * FF_QP2LAMBDA, > > in my case qscale = 3 > > This is correct, qscale 3 ensures (with mpeg-4 asp) a > near-lossless visual quality. > > Thansk Carl, I think I can use the same way to set quality for mpeg4 video, right? What't the differenct between it and seting qmin qmax in codeccctx? Thanks > Carl Eugen > ___ > Libav-user mailing list > Libav-user@ffmpeg.org > http://ffmpeg.org/mailman/listinfo/libav-user > ___ Libav-user mailing list Libav-user@ffmpeg.org http://ffmpeg.org/mailman/listinfo/libav-user
Re: [Libav-user] Copying pixels directly from AVFrame->data, possible alignment error.
On Thu, Jun 9, 2016 at 11:53 AM, Peter Steinbachwrote: > Hi Jepser, > > I am not an expert on this (@all please correct what I err upon), but > AFAIK the data is padded per line! that's why you also have a linesize data > member of AVFrame: > https://ffmpeg.org/doxygen/3.0/structAVFrame.html > So in other words, say you have a 6x6 frame in GRAY8, this would mean that > AVFrame->data[0] would show for the first 2 lines of the frame: > item0 item1 item2 item3 item4 item5 unused0 unused1 > item6 item7 item8 item9 item10 item11 unused2 unused3 > ... > assuming that AVFrame->linesize[0] = 8! > > Also, a frame in AV_PIX_FMT_BGR24 encoding would map to > AVFrame->data[0] being the B channel > AVFrame->data[1] being the G channel > AVFrame->data[2] being the R channel > > Translating this to your code example, this would give: > > uint64_t src_i = (xx+(yy*src_camera_width))*3; > r = f->pAVFrame->data[2][yy*f->pAVFrame->linesize[2]+xx]; > g = f->pAVFrame->data[1][yy*f->pAVFrame->linesize[1]+xx]; > b = f->pAVFrame->data[0][yy*f->pAVFrame->linesize[0]+xx]; > > assuming that you f->pAVFrame was already filled by some other function. > Crossing fingers that I got everything right. > > Best, > P > > Wonder why his frame didn't look all garbled, using only B data and feeding it to other planes data (assuming those r,g,,b variables are put back into AVFrame->data) would've messed up the color values so much that would render into a gardbled frame. > > On 09.06.2016 20:32, Jesper Taxbøl wrote: > > Sorry about the toppost . Im afraid my phone and me had a slight accident. > > What I was trying to add was how I index the the source pixels, hoping it > can shed light on the offset error im experiencing. > > uint64_t src_i = (xx+(yy*src_camera_width))*3; > r = f->pAVFrame->data[0][src_i+0]; > g = f->pAVFrame->data[0][src_i+1]; > b = f->pAVFrame->data[0][src_i+2]; > > Kind regards > > Jesper > > > > ___ > Libav-user mailing > listLibav-user@ffmpeg.orghttp://ffmpeg.org/mailman/listinfo/libav-user > > > > ___ > Libav-user mailing list > Libav-user@ffmpeg.org > http://ffmpeg.org/mailman/listinfo/libav-user > > ___ Libav-user mailing list Libav-user@ffmpeg.org http://ffmpeg.org/mailman/listinfo/libav-user
Re: [Libav-user] Copying pixels directly from AVFrame->data, possible alignment error.
Hi Jepser, I am not an expert on this (@all please correct what I err upon), but AFAIK the data is padded per line! that's why you also have a linesize data member of AVFrame: https://ffmpeg.org/doxygen/3.0/structAVFrame.html So in other words, say you have a 6x6 frame in GRAY8, this would mean that AVFrame->data[0] would show for the first 2 lines of the frame: item0 item1 item2 item3 item4 item5 unused0 unused1 item6 item7 item8 item9 item10 item11 unused2 unused3 ... assuming that AVFrame->linesize[0] = 8! Also, a frame in AV_PIX_FMT_BGR24 encoding would map to AVFrame->data[0] being the B channel AVFrame->data[1] being the G channel AVFrame->data[2] being the R channel Translating this to your code example, this would give: uint64_t src_i = (xx+(yy*src_camera_width))*3; r = f->pAVFrame->data[2][yy*f->pAVFrame->linesize[2]+xx]; g = f->pAVFrame->data[1][yy*f->pAVFrame->linesize[1]+xx]; b = f->pAVFrame->data[0][yy*f->pAVFrame->linesize[0]+xx]; assuming that you f->pAVFrame was already filled by some other function. Crossing fingers that I got everything right. Best, P On 09.06.2016 20:32, Jesper Taxbøl wrote: Sorry about the toppost . Im afraid my phone and me had a slight accident. What I was trying to add was how I index the the source pixels, hoping it can shed light on the offset error im experiencing. uint64_t src_i = (xx+(yy*src_camera_width))*3; r = f->pAVFrame->data[0][src_i+0]; g = f->pAVFrame->data[0][src_i+1]; b = f->pAVFrame->data[0][src_i+2]; Kind regards Jesper ___ Libav-user mailing list Libav-user@ffmpeg.org http://ffmpeg.org/mailman/listinfo/libav-user ___ Libav-user mailing list Libav-user@ffmpeg.org http://ffmpeg.org/mailman/listinfo/libav-user
Re: [Libav-user] Copying pixels directly from AVFrame->data, possible alignment error.
Sorry about the toppost . Im afraid my phone and me had a slight accident. What I was trying to add was how I index the the source pixels, hoping it can shed light on the offset error im experiencing. uint64_t src_i = (xx+(yy*src_camera_width))*3; r = f->pAVFrame->data[0][src_i+0]; g = f->pAVFrame->data[0][src_i+1]; b = f->pAVFrame->data[0][src_i+2]; Kind regards Jesper ___ Libav-user mailing list Libav-user@ffmpeg.org http://ffmpeg.org/mailman/listinfo/libav-user
Re: [Libav-user] Copying pixels directly from AVFrame->data, possible alignment error.
uint64_t src_i = (xx+(yy*src_camera_width))*3; r = f->pAVFrame->data[0][src_i+0]; g = f->pAVFrame->data[0][src_i+1]; b = f->pAVFrame->data[0][src_i+2]; On 9 Jun 2016 3:02 pm, "Jesper Taxbøl"wrote: > I am doing a pixel based transformation directly on an AVFrame->data[0] > array, and I am experiencing the following artefact: > > http://i.imgur.com/vnABDjE.png > > The source frame I am working on is 3840x2160 pixels in AV_PIX_FMT_BGR24 > format which should place all pixels in the first data array, in BGR order. > > The bottom 1/3 part of the picture has a problem with the colors, and I > suspect that the pAVFrame has an alignment problem and I just by chance hit > some data that maps to pixels. > > Any Idea what I am doing wrong? > > Kind regards > > Jesper Taxbøl > > ___ Libav-user mailing list Libav-user@ffmpeg.org http://ffmpeg.org/mailman/listinfo/libav-user
Re: [Libav-user] how to set mjpeg encoding quality programmatically?
YIRAN LIwrites: > AVCodecContext.flags |= CODEC_FLAG_QSCALE > and AVCodecContext.global_quality = qscale * FF_QP2LAMBDA, > in my case qscale = 3 This is correct, qscale 3 ensures (with mpeg-4 asp) a near-lossless visual quality. Carl Eugen ___ Libav-user mailing list Libav-user@ffmpeg.org http://ffmpeg.org/mailman/listinfo/libav-user
[Libav-user] Copying pixels directly from AVFrame->data, possible alignment error.
I am doing a pixel based transformation directly on an AVFrame->data[0] array, and I am experiencing the following artefact: http://i.imgur.com/vnABDjE.png The source frame I am working on is 3840x2160 pixels in AV_PIX_FMT_BGR24 format which should place all pixels in the first data array, in BGR order. The bottom 1/3 part of the picture has a problem with the colors, and I suspect that the pAVFrame has an alignment problem and I just by chance hit some data that maps to pixels. Any Idea what I am doing wrong? Kind regards Jesper Taxbøl ___ Libav-user mailing list Libav-user@ffmpeg.org http://ffmpeg.org/mailman/listinfo/libav-user
Re: [Libav-user] Where and how to add a custom hardware decoder in libavcodec ?
Can anyone please guide me on this ! -- View this message in context: http://libav-users.943685.n4.nabble.com/Where-and-how-to-add-a-custom-hardware-decoder-in-libavcodec-tp4662203p4662233.html Sent from the libav-users mailing list archive at Nabble.com. ___ Libav-user mailing list Libav-user@ffmpeg.org http://ffmpeg.org/mailman/listinfo/libav-user