Open gamelaster opened 3 years ago
Yeah, I also have the same issue with an USB Webcam as Input. If you use ffmpegs builtin Test Video the Video engine produces encoded H.264 just fine. You can try for yourself: ffmpeg -f lavfi -i testsrc=duration=2:size=1280x720:rate=30 testsrc.h264 -y
Yeah, I also have the same issue with an USB Webcam as Input. If you use ffmpegs builtin Test Video the Video engine produces encoded H.264 just fine. You can try for yourself: ffmpeg -f lavfi -i testsrc=duration=2:size=1280x720:rate=30 testsrc.h264 -y
This works for me: ffmpeg -f v4l2 -r 30 -t 10 -s 640x480 -i /dev/video0 -pix_fmt yuv420p -c:v h264_omx output.avi -y
Hmm, I already abandoned idea of using their OMX driver, since it didn't worked both on FFMPEG but also GStreamer. @niyazFattahov I will probably try it again with your ffmpeg configuration.
@petit-miner what board you use with s3 chip? I also wanna try it for video encoding tests. I cannot find any board with this chip
@niyazFattahov PineCube have S3, and I'm testing everything on it.
@petit-miner what board you use with s3 chip? I also wanna try it for video encoding tests. I cannot find any board with this chip
I'm testing the Video encoder on a custom V3s board.
Hmm, I already abandoned idea of using their OMX driver, since it didn't worked both on FFMPEG but also GStreamer. @niyazFattahov I will probably try it again with your ffmpeg configuration.
do you try to use cedrus codec with v4l2_m2m ?
Yeah, I also have the same issue with an USB Webcam as Input. If you use ffmpegs builtin Test Video the Video engine produces encoded H.264 just fine. You can try for yourself: ffmpeg -f lavfi -i testsrc=duration=2:size=1280x720:rate=30 testsrc.h264 -y
This works for me: ffmpeg -f v4l2 -r 30 -t 10 -s 640x480 -i /dev/video0 -pix_fmt yuv420p -c:v h264_omx output.avi -y
Yeah, this works for me too, but I'm not very happy about the performance. I can encode a rawvideo with 720p however not in realtime. I get like ~8 FPs I tried baseline / medium / High but no difference in speed. The produced H264 files look fine and sharp and without any glitches. H264_omx hasn't much options to tweak:
Encoder h264_omx [OpenMAX IL H.264 video encoder]:
General capabilities: delay
Threading capabilities: none
Supported pixel formats: yuv420p
h264_omx AVOptions:
-omx_libname
@petit-miner there might be some problem in OMX driver. So far, when using raw CedarC library, the encoding is quite fast, but I seen some weird latencies too when testing. I need to finish my gstreamer plugin for libcedarc and that will show if it's capable of 720p live stream
okay, good to know. Where can I find this raw CedarC library? And how can I build it? I just need to capture 720p @ 30fps and encode it to H.264.
@petit-miner it's this repository 😊 OMX library is just additional wrapper for OMX support, which uses CedarC API
@petit-miner it's this repository 😊 OMX library is just additional wrapper for OMX support, which uses CedarC API
I know this is maybe a bit much to ask, but could you help me to compile the encoderdemo? I used these commands to compile: ./bootstrap ./configure --host=arm-linux-gnueabihf --enable-static make ARCH=arm Making all in memory make[2]: Entering directory '/home/mthuerm/libcedarc/memory' CC libMemAdapter_la-memoryAdapter.lo CC libMemAdapter_la-ionAlloc.lo CCLD libMemAdapter.la /usr/bin/ld: cannot find -lVE collect2: error: ld returned 1 exit status make[2]: [Makefile:441: libMemAdapter.la] Error 1 make[2]: Leaving directory '/home/mthuerm/libcedarc/memory' make[1]: [Makefile:398: all-recursive] Error 1 make[1]: Leaving directory '/home/mthuerm/libcedarc' make: *** [Makefile:330: all] Error 2
Furthermore it seems like the Makefile in /demo/vencoderDemo/ doesn't get updated to my build environment. It would be very nice if you could help me.
@petit-miner Do you have libVE.so in /usr/local/lib or /usr/lib directory?
Yeah I got that fixed now. If I use the encoderdemo in this repo the encoded video is super fast. I use a 17 second raw yuv420p video and convert it to H264 / MJPEG and I only get a video which is only a handful of frames long. Colours look fine in those few frames. The same happens with ffmpeg: (I also found that the bottleneck with ffmpeg was the generation of the testsrc video and not the encoder) ffmpeg -f lavfi -i testsrc=duration=10:size=1280x720:rate=30 -c:v rawvideo -pix_fmt yuv420p test.yuv and then pass it trough the encoder with ffmpeg: ffmpeg -re -f rawvideo -pix_fmt yuv420p -s:v 1280x720 -r 30 -i test.yuv output.h264
The video also seems speed up like crazy and is much shorter as my raw yuv420p testfile. I also verified that the testfile looks ok. I tried adding -re to ffmpeg to slow it down somewhat but it didn't help at all. Funny enough when we overloaded the CPU with generating the testsrc video directly, the encoded video file looked fine and I didn't have such issues. Maybe it has something to do with the fact that the encoder only received 14 frames per second when the CPU was bottlenecked? Do you have an idea?
@petit-miner about using encoding test, when you play raw .h264, there isn't information about frame rate, thus VLC / any media player picks how fast it will playback. About other things, I need to test it, but sadly, many things on my task list right now, but eventually I will get on it and will let you know about results, but mostly, the performance and quality was good.
@petit-miner I tried your method of generating a test vid first, then running the encoder. However, I'm still only getting about ~8 FPS. Is ffmpeg -re -f rawvideo -pix_fmt yuv420p -s:v 1280x720 -r 30 -i test.yuv output.h264
the correct command for invoking the encoder? Did you manage to get any good performances?
By the way, I'm only getting about 2.4 FPS when running the test vid generation command. This doesn't seem too normal, since I think you said that you were able to achieve ~8 FPS when generating the test vid AND encoding at the same time?
Many thanks.
By the way, how does the h264 encoding image quality look for you all? I tried to encode a 640x480 stream from a camera (ov5640) on the V3s, and the image quality appears to be quite poor, even with -profile 100
in the ffmpeg commands. Does this happen for anyone else?
This is the command I used ffmpeg -f v4l2 -r 30 -t 10 -s 640x480 -i /dev/video0 -pix_fmt yuv420p -c:v h264_omx output.avi -y
, same as the one used by @niyazFattahov
Here's an example of the blurry images that I get in the encoded video:
@Unturned3 Same here. Even simple testsrc gets messed up after encoding
By the way, how does the h264 encoding image quality look for you all? I tried to encode a 640x480 stream from a camera (ov5640) on the V3s, and the image quality appears to be quite poor, even with
-profile 100
in the ffmpeg commands. Does this happen for anyone else?
@Unturned3 Did you ever resolve the quality issue? Is this an issue in the H264 encoding core in the V3s, or maybe just the way you are using it? I'd like to try using the V3s for an IP camera, but it doesn't make sense if the encoding core produces very low quality encoding. Thanks.
@Unturned3 Did you ever resolve the quality issue? Is this an issue in the H264 encoding core in the V3s, or maybe just the way you are using it? I'd like to try using the V3s for an IP camera, but it doesn't make sense if the encoding core produces very low quality encoding. Thanks.
This was quite a while ago, but I did resolve the issue by manually editing the Qp (or something like that) parameter in the OMX source code & recompiling the whole thing. I've since abandoned using OMX + ffmpeg; it's just too buggy and limited.
Directly using V4L2 and the Cedar API gets me very good results.
By the way, how does the h264 encoding image quality look for you all? I tried to encode a 640x480 stream from a camera (ov5640) on the V3s, and the image quality appears to be quite poor, even with
-profile 100
in the ffmpeg commands. Does this happen for anyone else?@Unturned3 Did you ever resolve the quality issue? Is this an issue in the H264 encoding core in the V3s, or maybe just the way you are using it? I'd like to try using the V3s for an IP camera, but it doesn't make sense if the encoding core produces very low quality encoding. Thanks.
I had almost the same question. I needed to compress the video on the chip, and not get it from the camera. The quality of the output video was constantly disgusting
Added an encoder override in the omx_venc.c file
diff:
To get an mp4 container and .h264 encoding, you need to take the following two steps. First, we go through the encoder while saving the container. Then I change the container using ffmpeg without recoding the video.
ffmpeg -i test2.avi -c:v h264_omx outpui.avi -y
ffmpeg -i outpui.avi -c:v copy -c:a copy outpui.mp4
Added code mostly from https://github.com/Unturned3/h264enc_demo/blob/master/h264.c
Input video - mjpeg AVI 16mb 1024x656, 4838 kb/s, 10 fps Output video - h264 AVI 5mb 1024x656, 1913 kb/s, 10 fps
Next step - instant-time video conversion:
And done
By the way, how does the h264 encoding image quality look for you all? I tried to encode a 640x480 stream from a camera (ov5640) on the V3s, and the image quality appears to be quite poor, even with
-profile 100
in the ffmpeg commands. Does this happen for anyone else?@Unturned3 Did you ever resolve the quality issue? Is this an issue in the H264 encoding core in the V3s, or maybe just the way you are using it? I'd like to try using the V3s for an IP camera, but it doesn't make sense if the encoding core produces very low quality encoding. Thanks.
Here fix for baudrate (default is 200kbs and less)
https://github.com/Unturned3/v3s3/issues/2#issuecomment-1319895068
After that you can specify br. I'm still searching about sending qp-parameters via ffmpeg to encoder
ffmpeg -i test2.avi -c:v h264_omx -b:v 4096k outpui_high.avi -y
SoC: S3
I have verified that camera works good.