Re: [FFmpeg-user] encode to RAW video

2022-10-26 Thread pehache


Le 24/10/2022 à 18:36, Naveen.B a écrit :


I tried by giving the input with -pix_fmt, it's the same error.

Yes, I want raw video. I have converted RAW files to .mp4 successfully with
uncompressed, the size of the .mp4 format video was less comparatively.
I have 30 RAW files with each file is around 4Mbps (so, 30 RAW
filesx4Mbps=180Mbps for one second), the output of the video file size
(.mp4) is coming around 18 Mbps, so I am assuming .mp4 video format is
doing some compression and hence I need to try this with RAW video.

This is the command I tried for .mp4 file video which is coming 18Mbps as
output video file size,
*ffmpeg -pixel_format gray10le -s 1600x1300 -r 30 -i CapturedImage-%03d.raw
-c:v libx264 -pix_fmt yuv420p -preset fast -profile:v main -level:v 4.0
-crf 1 raw_video.mp4*



Try this :

ffmpeg -pixel_format gray10le -s 1600x1300 -r 30 -i 
CapturedImage-%03d.raw -c:v rawvideo -pix_fmt yuv420p -f rawvideo output.raw


Alternatively you can put the raw video stream in a container such as MKV:

ffmpeg -pixel_format gray10le -s 1600x1300 -r 30 -i 
CapturedImage-%03d.raw -c:v rawvideo -pix_fmt yuv420p output.mkv


In either case I'm not sure it will easy to read the output file with 
classical players.


___
ffmpeg-user mailing list
ffmpeg-user@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-user] encode to RAW video

2022-10-26 Thread Paul B Mahol
On 10/25/22, Michael Koch  wrote:
> Am 25.10.2022 um 09:29 schrieb Naveen.B:
>>>
>>> What do you want to do with the RAW video? You know that you can't play
>>> it with most players?
>>>
>>> Yes, I know it cannot be played with most of th players, I need to see
>>> the
>>> size of the RAW video and make some compression on it for our further
>>> analysis.
>>  Could you please help me on the missing parameters to generate the
>> RAW
>> video?
>
> I did some tests and came to the conclusion that it's impossible to
> import a group of numbered raw images.
> It's possible to import a single raw image.
> It's possible to import a group of numbered images (JPG, PNG, TIF...)
> But it's not possible to import a numbered group of raw images.
> (To the experts: Please correct me if I'm wrong).
>
> Anyway it's a bad idea to save the images in raw format. You should use
> PNG images, which have a lossless compression, and 16-bit depth is possible.
> I recommend that you convert your images to PNG, and then things become
> much easier.
>
> Here is a (Windows) batch file with a few examples:
>
> rem  Make 30 PNG images (48-bit per pixel):
> ffmpeg -f lavfi -i testsrc2=s=320x200,format=rgb48 -frames 30 -f image2
> -y image-%%03d.png
>
> rem  Convert these 30 images to a raw video (this conversion is lossless):
> ffmpeg -i image-%%03d.png -s 320x200 -pixel_format rgb48 -f rawvideo
> -c:v rawvideo -y video.raw
>
> rem  The size of the raw video is exactly 320 * 200 * 2 * 3 * 30 =
> 1152 Bytes
>
> rem  Convert the first frame from the raw video to a PNG image (48-bit
> per pixel):
> ffmpeg -video_size 320x200 -pixel_format rgb48 -f rawvideo -i video.raw
> -frames 1 -y image.png
>
> rem  Convert the raw video to a (almost lossless) MP4 video:
> ffmpeg -video_size 320x200 -pixel_format rgb48 -f rawvideo -framerate 30
> -i video.raw -crf 0 -y video.mp4
>
> pause
>
>
> I have a question to the experts. The above example works fine with
> pixel format rgb48, but with pixel formats gray16 or gray10le the MP4
> output looks wrong. I don't yet understand why.
>

Not all muxers support all pixel formats as raw.

> Michael
>
> ___
> ffmpeg-user mailing list
> ffmpeg-user@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-user
>
> To unsubscribe, visit link above, or email
> ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".
>
___
ffmpeg-user mailing list
ffmpeg-user@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-user] encode to RAW video

2022-10-26 Thread Paul B Mahol
On 10/25/22, Michael Koch  wrote:
> Am 25.10.2022 um 09:29 schrieb Naveen.B:
>>>
>>> What do you want to do with the RAW video? You know that you can't play
>>> it with most players?
>>>
>>> Yes, I know it cannot be played with most of th players, I need to see
>>> the
>>> size of the RAW video and make some compression on it for our further
>>> analysis.
>>  Could you please help me on the missing parameters to generate the
>> RAW
>> video?
>
> I did some tests and came to the conclusion that it's impossible to
> import a group of numbered raw images.
> It's possible to import a single raw image.
> It's possible to import a group of numbered images (JPG, PNG, TIF...)
> But it's not possible to import a numbered group of raw images.
> (To the experts: Please correct me if I'm wrong).
>
> Anyway it's a bad idea to save the images in raw format. You should use
> PNG images, which have a lossless compression, and 16-bit depth is possible.
> I recommend that you convert your images to PNG, and then things become
> much easier.
>
> Here is a (Windows) batch file with a few examples:
>
> rem  Make 30 PNG images (48-bit per pixel):
> ffmpeg -f lavfi -i testsrc2=s=320x200,format=rgb48 -frames 30 -f image2
> -y image-%%03d.png
>
> rem  Convert these 30 images to a raw video (this conversion is lossless):
> ffmpeg -i image-%%03d.png -s 320x200 -pixel_format rgb48 -f rawvideo
> -c:v rawvideo -y video.raw
>
> rem  The size of the raw video is exactly 320 * 200 * 2 * 3 * 30 =
> 1152 Bytes
>
> rem  Convert the first frame from the raw video to a PNG image (48-bit
> per pixel):
> ffmpeg -video_size 320x200 -pixel_format rgb48 -f rawvideo -i video.raw
> -frames 1 -y image.png
>
> rem  Convert the raw video to a (almost lossless) MP4 video:
> ffmpeg -video_size 320x200 -pixel_format rgb48 -f rawvideo -framerate 30
> -i video.raw -crf 0 -y video.mp4
>
> pause
>
>
> I have a question to the experts. The above example works fine with
> pixel format rgb48, but with pixel formats gray16 or gray10le the MP4
> output looks wrong. I don't yet understand why.
>

Not all muxers support all pixel formats as raw.

> Michael
>
> ___
> ffmpeg-user mailing list
> ffmpeg-user@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-user
>
> To unsubscribe, visit link above, or email
> ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".
>
___
ffmpeg-user mailing list
ffmpeg-user@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-user] ffmpeg on IMX8QM

2022-10-26 Thread Kévin L'hôpital
Hi everyone,

I have an issue using ffmpeg and h264_v4l2m2m encoder/decoder with the IMX8QM.
I can encode and decode a file without error, but the output video is green 
when encoding and completely messy when decoding.
Here are the commands that I am using:
Encoding:

ffmpeg -f rawvideo -pix_fmt nv12 -s:v 1920x816 -framerate 30 -i my_file.yuv 
-c:v h264_v4l2m2m my_file.h264

Decoding:

ffmpeg -c:v h264_v4l2m2m -i my_file.h264 my_file.yuv

I also tested with the v4l2 codec of gstreamer and I can encode and decode 
without problem.

Do you have any idea of what could be the issue ?
Did someone has ever tested the hardware encoder/decoder of the IMX8QM with 
ffmpeg ?

I saw that the IMX8QM hardware decoder outputs a specific tiled format, that's 
maybe the reason why the output video is messy. But at least the encoder should 
be ok, right ?

I am using a linux-imx version 5.4 and ffmpeg version 5.1.1
I also tried the encoder/decoder drivers of the 5.15 imx kernel version with 
the same results.

Thanks,

Kévin L'hôpital
Free Software Consultant | Rennes, Fr
Savoir-faire Linux
___
ffmpeg-user mailing list
ffmpeg-user@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".