Quantcast

Not able to creating high-quality jpegs/mjpegs

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Not able to creating high-quality jpegs/mjpegs

Robert Krüger-2
Hi,

jpeg/mjpeg compression seems to have a certain limit that I am not
able to exceed and that is significantly lower than that of other
graphics programs.

To test I took a png image (a still frame exported from a video) in
1920x1080 and converted it to jpeg like so

ffmpeg -i test.png -c:v mjpeg -q:v 1 test-ffmpeg.jpg

The resulting image has 108k which corresponds to a bitrate of roughly
22 MBit at 25 FPS, which is not much for intra-only.

Compressing the same image using Apple Preview and Gimp at maximum
quality results in an image of approx. 700k, corresponding to a
bitrate of 140 MBit, which is what I want to be able to do with
ffmpeg.

Are there any other command line flags I can use to drive the quality
up? I also tried using -b:v 100M which resulted in an even smaller
file.

full CL and output:

ffmpeg -i test.png -c:v mjpeg -q:v 1 test-ffmpeg.jpg
ffmpeg version N-56463-g20101f4 Copyright (c) 2000-2013 the FFmpeg developers
  built on Sep 19 2013 20:18:44 with llvm-gcc 4.2.1 (LLVM build 2336.11.00)
  configuration:
  libavutil      52. 44.100 / 52. 44.100
  libavcodec     55. 33.100 / 55. 33.100
  libavformat    55. 18.100 / 55. 18.100
  libavdevice    55.  3.100 / 55.  3.100
  libavfilter     3. 86.102 /  3. 86.102
  libswscale      2.  5.100 /  2.  5.100
  libswresample   0. 17.103 /  0. 17.103
Input #0, image2, from 'test.png':
  Duration: 00:00:00.04, start: 0.000000, bitrate: N/A
    Stream #0:0: Video: png, rgba, 1920x1080 [SAR 1:1 DAR 16:9], 25
tbr, 25 tbn, 25 tbc
[swscaler @ 0x7f9eda812200] deprecated pixel format used, make sure
you did set range correctly
Output #0, image2, to 'test-ffmpeg.jpg':
  Metadata:
    encoder         : Lavf55.18.100
    Stream #0:0: Video: mjpeg, yuvj444p, 1920x1080 [SAR 1:1 DAR 16:9],
q=2-31, 200 kb/s, 90k tbn, 25 tbc
Stream mapping:
  Stream #0:0 -> #0:0 (png -> mjpeg)
Press [q] to stop, [?] for help
frame=    1 fps=0.0 q=0.0 Lsize=N/A time=00:00:00.04 bitrate=N/A
video:106kB audio:0kB subtitle:0 global headers:0kB muxing overhead -100.020319%

Thanks,

Robert
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Not able to creating high-quality jpegs/mjpegs

Paul B Mahol
On 9/20/13, Robert Krueger <[hidden email]> wrote:

> Hi,
>
> jpeg/mjpeg compression seems to have a certain limit that I am not
> able to exceed and that is significantly lower than that of other
> graphics programs.
>
> To test I took a png image (a still frame exported from a video) in
> 1920x1080 and converted it to jpeg like so
>
> ffmpeg -i test.png -c:v mjpeg -q:v 1 test-ffmpeg.jpg

-q:v 0 ?
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Not able to creating high-quality jpegs/mjpegs

Robert Krüger-2
On Fri, Sep 20, 2013 at 11:55 PM, Paul B Mahol <[hidden email]> wrote:

> On 9/20/13, Robert Krueger <[hidden email]> wrote:
>> Hi,
>>
>> jpeg/mjpeg compression seems to have a certain limit that I am not
>> able to exceed and that is significantly lower than that of other
>> graphics programs.
>>
>> To test I took a png image (a still frame exported from a video) in
>> 1920x1080 and converted it to jpeg like so
>>
>> ffmpeg -i test.png -c:v mjpeg -q:v 1 test-ffmpeg.jpg
>
> -q:v 0 ?

same result. The files are bit-identical.
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Not able to creating high-quality jpegs/mjpegs

Paul B Mahol
On 9/21/13, Robert Krueger <[hidden email]> wrote:

> On Fri, Sep 20, 2013 at 11:55 PM, Paul B Mahol <[hidden email]> wrote:
>> On 9/20/13, Robert Krueger <[hidden email]> wrote:
>>> Hi,
>>>
>>> jpeg/mjpeg compression seems to have a certain limit that I am not
>>> able to exceed and that is significantly lower than that of other
>>> graphics programs.
>>>
>>> To test I took a png image (a still frame exported from a video) in
>>> 1920x1080 and converted it to jpeg like so
>>>
>>> ffmpeg -i test.png -c:v mjpeg -q:v 1 test-ffmpeg.jpg
>>
>> -q:v 0 ?
>
> same result. The files are bit-identical.

-qmin 1 -qmax 1

I forgot this and searched web to learn it again.
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Not able to creating high-quality jpegs/mjpegs

Robert Krüger-2
On Sun, Sep 22, 2013 at 2:03 AM, Paul B Mahol <[hidden email]> wrote:

> On 9/21/13, Robert Krueger <[hidden email]> wrote:
>> On Fri, Sep 20, 2013 at 11:55 PM, Paul B Mahol <[hidden email]> wrote:
>>> On 9/20/13, Robert Krueger <[hidden email]> wrote:
>>>> Hi,
>>>>
>>>> jpeg/mjpeg compression seems to have a certain limit that I am not
>>>> able to exceed and that is significantly lower than that of other
>>>> graphics programs.
>>>>
>>>> To test I took a png image (a still frame exported from a video) in
>>>> 1920x1080 and converted it to jpeg like so
>>>>
>>>> ffmpeg -i test.png -c:v mjpeg -q:v 1 test-ffmpeg.jpg
>>>
>>> -q:v 0 ?
>>
>> same result. The files are bit-identical.
>
> -qmin 1 -qmax 1
>
> I forgot this and searched web to learn it again.

That doubled the bitrate. Thanks. ffmpeg rate control is indeed a
mysterious art that only few really understand ;-).

I would like to compare psnr for all these different versions but
somehow I am not doing it right. I could swear that I have used the
psnr filter like this before but now I can't get it to work.

I first converted the files (original and compressed versions) into
ffv1 with yuv444p pixel format, so the pixel formats match for psnr
comparison and are supported by the psnr filter. Then I used the
command line below and got no psnr output (stats.log is empty as
well). I have used this command line with other files before and it
worked (I may overlook something, of course), so I am guessing now,
what I am doing wrong. I cannot see any error message either.

ffmpeg -i test-ffmpeg-g5-ffv1.mkv -vf "movie=test-ffv1.mkv,
setpts=PTS-STARTPTS [main]; [main][ref] psnr="stats_file=stats.log"
[out]" -f null /dev/null
ffmpeg version N-56463-g20101f4 Copyright (c) 2000-2013 the FFmpeg developers
  built on Sep 19 2013 20:18:44 with llvm-gcc 4.2.1 (LLVM build 2336.11.00)
  configuration:
  libavutil      52. 44.100 / 52. 44.100
  libavcodec     55. 33.100 / 55. 33.100
  libavformat    55. 18.100 / 55. 18.100
  libavdevice    55.  3.100 / 55.  3.100
  libavfilter     3. 86.102 /  3. 86.102
  libswscale      2.  5.100 /  2.  5.100
  libswresample   0. 17.103 /  0. 17.103
Input #0, matroska,webm, from 'test-ffmpeg-g5-ffv1.mkv':
  Metadata:
    ENCODER         : Lavf55.18.100
  Duration: 00:00:00.04, start: 0.000000, bitrate: 52926 kb/s
    Stream #0:0: Video: ffv1 (FFV1 / 0x31564646), yuv444p, 1920x1080,
SAR 1:1 DAR 16:9, 25 fps, 25 tbr, 1k tbn, 1k tbc (default)
Output #0, null, to '/dev/null':
  Metadata:
    encoder         : Lavf55.18.100
    Stream #0:0: Video: rawvideo (444P / 0x50343434), yuv444p,
1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 200 kb/s, 90k tbn, 25 tbc
(default)
Stream mapping:
  Stream #0:0 -> #0:0 (ffv1 -> rawvideo)
Press [q] to stop, [?] for help
[null @ 0x7fe30381a000] Encoder did not produce proper pts, making some up.
frame=    1 fps=0.0 q=0.0 Lsize=N/A time=00:00:00.04 bitrate=N/A
video:0kB audio:0kB subtitle:0 global headers:0kB muxing overhead -122.916667%

Any ideas, what I am doing wrong here?
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Not able to creating high-quality jpegs/mjpegs

Paul B Mahol
On 9/22/13, Robert Krueger <[hidden email]> wrote:

> On Sun, Sep 22, 2013 at 2:03 AM, Paul B Mahol <[hidden email]> wrote:
>> On 9/21/13, Robert Krueger <[hidden email]> wrote:
>>> On Fri, Sep 20, 2013 at 11:55 PM, Paul B Mahol <[hidden email]> wrote:
>>>> On 9/20/13, Robert Krueger <[hidden email]> wrote:
>>>>> Hi,
>>>>>
>>>>> jpeg/mjpeg compression seems to have a certain limit that I am not
>>>>> able to exceed and that is significantly lower than that of other
>>>>> graphics programs.
>>>>>
>>>>> To test I took a png image (a still frame exported from a video) in
>>>>> 1920x1080 and converted it to jpeg like so
>>>>>
>>>>> ffmpeg -i test.png -c:v mjpeg -q:v 1 test-ffmpeg.jpg
>>>>
>>>> -q:v 0 ?
>>>
>>> same result. The files are bit-identical.
>>
>> -qmin 1 -qmax 1
>>
>> I forgot this and searched web to learn it again.
>
> That doubled the bitrate. Thanks. ffmpeg rate control is indeed a
> mysterious art that only few really understand ;-).
>
> I would like to compare psnr for all these different versions but
> somehow I am not doing it right. I could swear that I have used the
> psnr filter like this before but now I can't get it to work.
>
> I first converted the files (original and compressed versions) into
> ffv1 with yuv444p pixel format, so the pixel formats match for psnr
> comparison and are supported by the psnr filter. Then I used the
> command line below and got no psnr output (stats.log is empty as
> well). I have used this command line with other files before and it
> worked (I may overlook something, of course), so I am guessing now,
> what I am doing wrong. I cannot see any error message either.
>
> ffmpeg -i test-ffmpeg-g5-ffv1.mkv -vf "movie=test-ffv1.mkv,
> setpts=PTS-STARTPTS [main]; [main][ref] psnr="stats_file=stats.log"
> [out]" -f null /dev/null
> ffmpeg version N-56463-g20101f4 Copyright (c) 2000-2013 the FFmpeg
> developers
>   built on Sep 19 2013 20:18:44 with llvm-gcc 4.2.1 (LLVM build 2336.11.00)
>   configuration:
>   libavutil      52. 44.100 / 52. 44.100
>   libavcodec     55. 33.100 / 55. 33.100
>   libavformat    55. 18.100 / 55. 18.100
>   libavdevice    55.  3.100 / 55.  3.100
>   libavfilter     3. 86.102 /  3. 86.102
>   libswscale      2.  5.100 /  2.  5.100
>   libswresample   0. 17.103 /  0. 17.103
> Input #0, matroska,webm, from 'test-ffmpeg-g5-ffv1.mkv':
>   Metadata:
>     ENCODER         : Lavf55.18.100
>   Duration: 00:00:00.04, start: 0.000000, bitrate: 52926 kb/s
>     Stream #0:0: Video: ffv1 (FFV1 / 0x31564646), yuv444p, 1920x1080,
> SAR 1:1 DAR 16:9, 25 fps, 25 tbr, 1k tbn, 1k tbc (default)
> Output #0, null, to '/dev/null':
>   Metadata:
>     encoder         : Lavf55.18.100
>     Stream #0:0: Video: rawvideo (444P / 0x50343434), yuv444p,
> 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 200 kb/s, 90k tbn, 25 tbc
> (default)
> Stream mapping:
>   Stream #0:0 -> #0:0 (ffv1 -> rawvideo)
> Press [q] to stop, [?] for help
> [null @ 0x7fe30381a000] Encoder did not produce proper pts, making some up.
> frame=    1 fps=0.0 q=0.0 Lsize=N/A time=00:00:00.04 bitrate=N/A
> video:0kB audio:0kB subtitle:0 global headers:0kB muxing overhead
> -122.916667%
>
> Any ideas, what I am doing wrong here?

If there is only one frame it will not work... its bug I hope will be
fixed soon.
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Not able to creating high-quality jpegs/mjpegs

Robert Krüger-2
On Sun, Sep 22, 2013 at 4:29 PM, Paul B Mahol <[hidden email]> wrote:

> On 9/22/13, Robert Krueger <[hidden email]> wrote:
>> On Sun, Sep 22, 2013 at 2:03 AM, Paul B Mahol <[hidden email]> wrote:
>>> On 9/21/13, Robert Krueger <[hidden email]> wrote:
>>>> On Fri, Sep 20, 2013 at 11:55 PM, Paul B Mahol <[hidden email]> wrote:
>>>>> On 9/20/13, Robert Krueger <[hidden email]> wrote:
>>>>>> Hi,
>>>>>>
>>>>>> jpeg/mjpeg compression seems to have a certain limit that I am not
>>>>>> able to exceed and that is significantly lower than that of other
>>>>>> graphics programs.
>>>>>>
>>>>>> To test I took a png image (a still frame exported from a video) in
>>>>>> 1920x1080 and converted it to jpeg like so
>>>>>>
>>>>>> ffmpeg -i test.png -c:v mjpeg -q:v 1 test-ffmpeg.jpg
>>>>>
>>>>> -q:v 0 ?
>>>>
>>>> same result. The files are bit-identical.
>>>
>>> -qmin 1 -qmax 1
>>>
>>> I forgot this and searched web to learn it again.
>>
>> That doubled the bitrate. Thanks. ffmpeg rate control is indeed a
>> mysterious art that only few really understand ;-).
>>
>> I would like to compare psnr for all these different versions but
>> somehow I am not doing it right. I could swear that I have used the
>> psnr filter like this before but now I can't get it to work.
>>
>> I first converted the files (original and compressed versions) into
>> ffv1 with yuv444p pixel format, so the pixel formats match for psnr
>> comparison and are supported by the psnr filter. Then I used the
>> command line below and got no psnr output (stats.log is empty as
>> well). I have used this command line with other files before and it
>> worked (I may overlook something, of course), so I am guessing now,
>> what I am doing wrong. I cannot see any error message either.
>>
>> ffmpeg -i test-ffmpeg-g5-ffv1.mkv -vf "movie=test-ffv1.mkv,
>> setpts=PTS-STARTPTS [main]; [main][ref] psnr="stats_file=stats.log"
>> [out]" -f null /dev/null
>> ffmpeg version N-56463-g20101f4 Copyright (c) 2000-2013 the FFmpeg
>> developers
>>   built on Sep 19 2013 20:18:44 with llvm-gcc 4.2.1 (LLVM build 2336.11.00)
>>   configuration:
>>   libavutil      52. 44.100 / 52. 44.100
>>   libavcodec     55. 33.100 / 55. 33.100
>>   libavformat    55. 18.100 / 55. 18.100
>>   libavdevice    55.  3.100 / 55.  3.100
>>   libavfilter     3. 86.102 /  3. 86.102
>>   libswscale      2.  5.100 /  2.  5.100
>>   libswresample   0. 17.103 /  0. 17.103
>> Input #0, matroska,webm, from 'test-ffmpeg-g5-ffv1.mkv':
>>   Metadata:
>>     ENCODER         : Lavf55.18.100
>>   Duration: 00:00:00.04, start: 0.000000, bitrate: 52926 kb/s
>>     Stream #0:0: Video: ffv1 (FFV1 / 0x31564646), yuv444p, 1920x1080,
>> SAR 1:1 DAR 16:9, 25 fps, 25 tbr, 1k tbn, 1k tbc (default)
>> Output #0, null, to '/dev/null':
>>   Metadata:
>>     encoder         : Lavf55.18.100
>>     Stream #0:0: Video: rawvideo (444P / 0x50343434), yuv444p,
>> 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 200 kb/s, 90k tbn, 25 tbc
>> (default)
>> Stream mapping:
>>   Stream #0:0 -> #0:0 (ffv1 -> rawvideo)
>> Press [q] to stop, [?] for help
>> [null @ 0x7fe30381a000] Encoder did not produce proper pts, making some up.
>> frame=    1 fps=0.0 q=0.0 Lsize=N/A time=00:00:00.04 bitrate=N/A
>> video:0kB audio:0kB subtitle:0 global headers:0kB muxing overhead
>> -122.916667%
>>
>> Any ideas, what I am doing wrong here?
>
> If there is only one frame it will not work... its bug I hope will be
> fixed soon.

thanks.
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

How to concatenate with start timecode bigger than 0

Eric13a
In reply to this post by Paul B Mahol
Hello,

I am trying to split a movie and concatenate it. It works fine except that
the concatenate isn't perfect because of the start timecode and I don't
know if my mistake is in the splitting process or in the concatenation
one.

Here is my simple code:

The splitting:
ffmpeg -ss 00:00:00.000 -t 00:00:04.234 -i sample.mov -acodec copy -vcodec
copy -async 1 temp1.mov
ffmpeg -ss 00:00:05.329 -t 00:00:07.361 -i sample.mov -acodec copy -vcodec
copy -async 1 temp2.mov


Then the concatenation:

ffmpeg -f concat -i files.txt -c copy final.mov

The result is temp1.mov from 00:00:00 to 00:00:04:234 then temp2.mov from
00:00:05:000 to 00:00:12:690

So the temp2.mov starts too early in the concatenation. I noticed that for
temp2.mov infos are:
Duration: 00:00:07.71, start: 0.336712 so I suspect that my problem comes
from the fact that start timecode is not managed by the concat.

I would appreciate your help on this.

Thanks !

Eric

_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user
Loading...