Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some informations #2

Open
Angelk90 opened this issue Jul 3, 2018 · 12 comments
Open

Some informations #2

Angelk90 opened this issue Jul 3, 2018 · 12 comments

Comments

@Angelk90
Copy link

Angelk90 commented Jul 3, 2018

@umair13adil : Hi, it would be possible to use this module, on a video that is online (http), the video weighs 658 (mb)?

@umair13adil
Copy link
Owner

Hi, currently this module only supports video files stored on SD card of mobile device. It can certainly work on huge video files. For online videos, this module can not work.
Alternatively you can first download your video and then process it using this module.

@Angelk90
Copy link
Author

Angelk90 commented Jul 3, 2018

@umair13adil : But think to download a video of (658mb) that lasts 2 hours and 30 minutes, I think it is very heavy, like what.
I can not find a solution.

Being that I am developing a player based on exoplayer, I would like to implement PreviewSeekBar on it: https://github.com/rubensousa/PreviewSeekBar

which allows you to have a preview of the video.

What would you recommend?

@umair13adil
Copy link
Owner

If you wan to use FFMpeg to display preview like in YouTube, you can use thumbnails, using following command:

ffmpeg -ss 00:00:10 -i 'yourVideo.mov' -vframes:v 1 'thumbnail.jpg'

Give it a try.

@Angelk90
Copy link
Author

Angelk90 commented Jul 3, 2018

@umair13adil : Everything must run on an android app, without using anything else.

@kasim1011
Copy link

kasim1011 commented Aug 1, 2018

@umair13adil

will this work on online video urls?

ffmpeg -ss 00:00:10 -i 'yourVideo.mov' -vframes:v 1 'thumbnail.jpg'

@umair13adil umair13adil reopened this Aug 1, 2018
@umair13adil
Copy link
Owner

I have't tried it myself. But yes it's possible. Check this answer on Stackoverflow:

You can give a URL if the video is directly accessible at that URL.

umair13adil pushed a commit that referenced this issue Aug 1, 2018
… video file.

#2 Added option to kill/stop running tasks.
#3 Added option to view name of running process on progress dialog.
umair13adil pushed a commit that referenced this issue Aug 1, 2018
… video file.

#2 Added option to kill/stop running tasks.
#3 Added option to view name of running process on progress dialog.
@HemanthKumarGB
Copy link

Hi , many thanks to you for this great work. Is there any way you can share with us regarding where to refer for how to use ffmpeg commands in Android ? It is hard to find any tutorials regarding it. If you have referred any link/document please share with us. Thank you once again.

@umair13adil
Copy link
Owner

umair13adil commented Aug 2, 2018

Hi, there is no single source of link/document for ffmpeg. You can use any ffmpeg command in Android using this library:

WritingMinds/ffmpeg-android

All commands have to be in array[] instead of plain string.

You can find some useful commands here:
Useful FFmpeg commands

@HemanthKumarGB
Copy link

HemanthKumarGB commented Aug 2, 2018

Thank you for such a quick reply. Can we use the VideoMerge that you have implemented for concat/append video formats apart from Mp4 ? and what should be the value of scale in {stringBuilder.append("[$i:v]setpts=PTS-STARTPTS,setsar=1,setdar=4/3,scale=640x480[v$i]; [$i:a]asetpts=PTS-STARTPTS[a$i];")} to keep the original scaling of the video ? and also setdar to be as same as video's aspect ? Sorry to ask such silly queries , we have been digging ffmpeg from past 2 weeks and we are new to the ffmpeg library. Is there any way to reduce merging time as well ?

@umair13adil
Copy link
Owner

Yes, you can use it to merge videos of different format.

Scale value is optional. If all your videos have some resolution , then simply don't add this filter, otherwise add it to specify single resolution for all videos.

If you wan't to keep original aspect ratio, scaling then just remove these filters.

You can reduce merge time by adding crf, preset and other options in your command, but they will reduce output video quality.

Here are some commands that you can use:

-crf: Quality. Range is logarithmic 0 (lossless) to 51 (worst quality). Default is 23. Subjective sane range is ~18-28 or so. Use the highest value that still gives you an acceptable quality. If you are re-encoding impractically large inputs to upload to YouTube or similar then try a value of 17 or 18 since these video services will re-encode anyway.

-preset: Encoding speed. A slower preset provides better compression (quality per file size) but is slower. Use the slowest that you have patience for: ultrafast, superfast, veryfast, faster, fast, medium (the default), slow, slower, veryslow.

-movflags +faststart: Allows video to playback before it is completely downloaded in the case of progressive download viewing. Useful if you are hosting the video, otherwise superfluous if uploading to a video service like YouTube.

-vf scale=-2:720,format=yuv420p: A filtergraph using scale and format video filters. Scale to 720 pixels in height, and automatically choose width that will preserve aspect, and then make sure the pixel format is compatible with dumb players.

-b:a 128k: Audio bitrate. If your ffmpeg is outdated then you'll need to add -strict experimental to use -c:a aac.

@HemanthKumarGB
Copy link

Great! thanks . So my final filter after removing scaling and aspect ratio would be : [$i:v]setpts=PTS-STARTPTS; [$i:a]asetpts=PTS-STARTPTS[a$i]; ? as all my videos will be of same resolution and aspect ratio.

@umair13adil
Copy link
Owner

yes, that's right.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants