begeekmyfriend / yasea

RTMP live streaming client for Android
MIT License
4.89k stars 1.32k forks source link

Video output in landscape returns severe pixelated portrait video #434

Open mcxycross opened 7 years ago

mcxycross commented 7 years ago

Hi, Thanks for sharing your codes. I'm creating a project for streaming live video (to YouTube) using your library. I'm facing an issue when streaming video while in landscape mode. The output video turned out to be in portrait and severely pixelated. It looks like the image below. screenshot_20170518-164255 copy 1 I thought it might be my devices, but I already tried on Xperia M5 and Nexus 5x and it's just the same. Do you know how can I fix this? I really appreciate the help.

begeekmyfriend commented 7 years ago

Did you modify the original code? You can stream to some RTMP server like SRS for checking.

mcxycross commented 7 years ago

Not really, the only thing that I added is a function to toggle on/off the flash. I don't really know how to use SRS. Do I need to use the latest library? I used the one that I took on March. Is there anything else that might cause it?

begeekmyfriend commented 7 years ago

You'd better upgrade to the latest version.

SRS is not hard to use. After installing from scratch, just run

sudo ./obj/srs -c conf/push.flv.conf

mcxycross commented 7 years ago

I just realized that I did remove the coremedia.iso and mp4parser library because I get 'duplicate zip entry error' which happened because I'm using another library (k4l-video-trimmer) that uses those two as dependencies too. So I delete those two and add the other library (k4l-video-trimmer) as dependencies in your library. Do you think this might cause it?

By the way, I tried to run your latest project from your repo and I get this error Error:org.gradle.internal.UncheckedException: Build command failed. . Do you know how can I fix this?

begeekmyfriend commented 7 years ago

Mp4Muxer does nothing with streaming. UncheckedException never comes up to me.

mcxycross commented 7 years ago

Ok, so I removed the externalNativeBuild lines and now it works. But I got this error can't find .so files. So I used the old one from the previous project, because I don't know how to generate one. But I'm still facing the same issue. Can you help provide the latest generated .so file? It would really help me.

begeekmyfriend commented 7 years ago

externalNativeBuild is used for ndk-bundle. Enter system settings in AS to download the ndk-bundle in SDK tools. It would build the so files automatically.

mcxycross commented 7 years ago

I already have NDK tools, but nothing generated. I got this error from the event log:

Failed to get the compiler information for file /.../yasea-master/library/src/main/cpp/libyuv/source/compare_neon.cc

Failed to get the compiler information for file /.../yasea-master/library/src/main/cpp/libyuv/source/compare.cc

Failed to get the compiler information for file /.../yasea-master/library/src/main/cpp/libyuv/source/compare.cc

Failed to get the compiler information for file /.../yasea-master/library/src/main/cpp/libyuv/source/scale_argb.cc

Failed to get the compiler information for file /.../yasea-master/library/src/main/cpp/libyuv/source/scale_common.cc

Failed to get the compiler information for file /.../yasea-master/library/src/main/cpp/libyuv/source/convert_to_argb.cc

Failed to get the compiler information for file /.../yasea-master/library/src/main/cpp/libyuv/source/convert_from_argb.cc
...

From the event log, all source file are failed.

begeekmyfriend commented 7 years ago

Please try to upgrade your AS

mcxycross commented 7 years ago

I already have the latest version of AS and NDK tools. Still getting the issue.

begeekmyfriend commented 7 years ago

The path of ndk-bundle on Windows should be

%LOCALAPPDATA%\Android\sdk\ndk-bundle

or on Linux:

$HOME/Android/Sdk/ndk-bundle

mcxycross commented 7 years ago

Well, the path are already correct. And still getting the issue.

begeekmyfriend commented 7 years ago

Look , it works by other people https://github.com/begeekmyfriend/yasea/issues/436#event-1091178027

mcxycross commented 7 years ago

Well, maybe I'm just unlucky :( I'll try it on different machine.

lomoya90 commented 7 years ago

@mcxycross Do you push the video stream to YouTube RTMP server successfully?

mcxycross commented 7 years ago

Sorry it took me months to reply, @lomoya90 yes I successfully streamed it to YouTube, just set the rtmp URL with the URL that YouTube provided. @begeekmyfriend I think I found the problem from my question. From what I've been tried and tried, I think YouTube doesn't support dynamic video resolution changes (I guess). Because, YouTube only accepts the first sent video resolution and when new resolution sent, the video severely rendered. I said so because when I tried firstly sent video in landscape and then changed to portrait, the video sent to YouTube severely rendered but still in landscape. But when I changed it back to landscape, the video worked. And vice versa. That's how I concluded the problem, and I don't really know if it's true though. Oh and about the ndk thing, I tried on different machine and it worked.

begeekmyfriend commented 7 years ago

It seems that it is YouTube player that does not support dynamic resolution change. I never have tried streaming to YouTube. I have got it now. Thank you for your reply.