से वीडियो की थंबनेल छवि प्राप्त करें क्या वीडियो यूआरएल से थंबनेल छवि प्राप्त करना संभव है? मुझे सूची दृश्य में वीडियो के थंबनेल की आवश्यकता है।वीडियो यूआरएल
उत्तर
किसी समस्या के घटकों की पहचान करना बहुत महत्वपूर्ण है। मैं वास्तव में कहूंगा कि आपके पास दो अलग-अलग समस्याएं हैं:
किसी URL से फ़ाइल डाउनलोड करना।
एक अपूर्ण वीडियो फ़ाइल से थंबनेल छवि बनाना।
उन दोनों को अलग से देखें, आपको बहुत सारी जानकारी मिल जाएगी।
हाँ थंबनेलउट्स का उपयोग करके वीडियो के थंबनेल को प्राप्त करना संभव है।
FileOutputStream out;
File land=new File(Environment.getExternalStorageDirectory().getAbsoluteFile()
+"/portland.jpg");// image file use to create image u can give any path.
Bitmap bitmap=ThumbnailUtils.createVideoThumbnail(filePath, MediaStore.Video.Thumbnails.FULL_SCREEN_KIND);//filePath is your video file path.
ByteArrayOutputStream stream = new ByteArrayOutputStream();
bitmap.compress(Bitmap.CompressFormat.JPEG, 100, stream);
byte[] byteArray = stream.toByteArray();
out=new FileOutputStream(land.getPath());
out.write(byteArray);
out.close();
मैं इस लाइन का उपयोग नहीं कर सकता, यह त्रुटि दिखा रहा है, फ़ाइल भूमि = नई फ़ाइल (पर्यावरण .getExternalStorageDirectory()। GetAbsoluteFile() + "/ पोर्टलैंड।jpg "); – Anitha
मुझे वीडियो यूआरएल से छवि मिल रही है तो मैं क्या करूँ? .. कृपया मेरी मदद करें। –
सर्वश्रेष्ठ अद्वितीय समाधान, चूंकि MINI_KIND और MICRO_KIND के विपरीत, FULL_SCREEN_KIND केवल डीबी पर संग्रहीत है और यूआरआई पथ द्वारा उपयोग करना असंभव है। – MPaulo
आप विशेष रूप से youtube
के बारे में वीडियो पूछ रहे हैं, तो ThumbnailUtils प्रयास करें, फ़ाइल पथ
ThumbnailUtils.createVideoThumbnail(filePath,MediaStore.Video.Thumbnails.MINI_KIND);
जब आप स्ट्रीमिंग नहीं कर रहे हैं। –
से वीडियो बिटमैप पाने के लिए फिर वहाँ स्वचालित रूप से कर रहे हैं 4 यूट्यूब से छवियों उत्पन्न।
http://img.youtube.com/vi/video_url_here/0.jpg
http://img.youtube.com/vi/video_url_here/1.jpg
http://img.youtube.com/vi/video_url_here/2.jpg
http://img.youtube.com/vi/video_url_here/3.jpg
मानक छवि आकारों
प्लेयर पृष्ठभूमि झलक (480x360 पिक्सल) http://i1.ytimg.com/vi/G0wGs3useV8/0.jpg
प्रारंभ झलक (120x90 पिक्सल) http://i1.ytimg.com/vi/G0wGs3useV8/1.jpg
मध्य झलक (120x90 पिक्सल) http://i1.ytimg.com/vi/G0wGs3useV8/2.jpg
समाप्ति झलक (120x90 पिक्सल) http://i1.ytimg.com/vi/G0wGs3useV8/3.jpg
उच्च गुणवत्ता झलक (480x360 पिक्सल) http://i1.ytimg.com/vi/G0wGs3useV8/hqdefault.jpg
मध्यम गुणवत्ता झलक (320x180 पिक्सल) http://i1.ytimg.com/vi/G0wGs3useV8/mqdefault.jpg
सामान्य गुणवत्ता की झलक (120x90 पिक्सल) http://i1.ytimg.com/vi/G0wGs3useV8/default.jpg
मानक परिभाषा थंबनेल (640x480 पिक्सेल) http://i1.ytimg.com/vi/G0wGs3useV8/sddefault.jpg
अधिकतम संकल्प थंबनेल (1920x1080 पिक्सल) http://i1.ytimg.com/vi/G0wGs3useV8/maxresdefault.jpg
यह एक वीडियो फ़ाइल या यूआरएल FFMPEG का उपयोग करने से एक थंबनेल प्राप्त करने के लिए संभव है।
एफएफएमपीईजी एनडीके का उपयोग करके बनाया जाना चाहिए (या आप कुछ एंड्रॉइड निर्मित एफएफएमपीईजी बाइनरी पा सकते हैं)।एक का उपयोग कर
https://github.com/guardianproject/android-ffmpeg
तब आप अपने अनुप्रयोग के साथ FFMPEG बाइनरी शामिल कर सकते हैं और (स्थानीय या यूआरएल) वीडियो से एक छवि उत्पन्न करने के लिए अपने अनुप्रयोग में कोड से FFMPEG पर अमल: यहाँ FFMPEG निर्माण करने के लिए एक GitHub परियोजना है आदेश की तरह: विचार करने के लिए
ffmpeg -i videosite.com/video.flv -ss 00:00:15.000 -vframes 1 thumbnail_out.png
एक बात यह एक सार्थक छवि है जो वीडियो का प्रतिनिधित्व करता है होने के लिए क्या समय (विकल्प -ss) आप थंबनेल हड़पने की तलाश में है।
URL से थंबनेल पाने के लिए, मैं केवल अब तक एक ही समाधान है, आप का उपयोग करने के This library
यह समर्थन करता है फ़ाइल, http, https, एमएमएस, mmsh और RTMP प्रोटोकॉल
और
यह एएसी, एसीसी +, एवी, फ्लैक, एमपी 2, एमपी 3, एमपी 4, ओग, 3 जीपी और अधिक का समर्थन करता है! प्रारूप (ऑडियो और वीडियो):
वीडियो यूआरएल से वीडियो की थंबनेल छवि प्राप्त करना संभव है।
अपना विडियो प्रकार Vimeo नीचे दिए चरणों का पालन है:
1) मान लीजिए कि आपके वीडियो यूआरएल है: http://player.vimeo.com/video/17314292
2) यूआरएल से वीडियो आईडी प्राप्त करें: जैसे।
वीडियो ID और XML स्वरूप के साथ 3) कॉल WS http://vimeo.com/api/v2/video/17314292.xml
आप वीडियो आईडी से वीडियो अंगूठे के लिए XML स्वरूप में "thumbnail_small", "thumbnail_medium", "thumbnail_large" मिल जाएगा
अगर आपके वीडियो प्रकार यूट्यूब है नीचे दिए गए चरणों का पालन करें:
1) वीडियो यूआरएल: http://www.youtube.com/embed/Nl2iMF0yKW8
2) यूआरएल से वीडियो आईडी प्राप्त करें: उदाहरण के लिए। Nl2iMF0yKW8
3) इस यूआरएल http://i3.ytimg.com/vi/Nl2iMF0yKW8/default.jpg
नोट में वीडियो आईडी बदलें: बस अपने आईडी यहां बदलें।
यह मेरे मामले
Uri videoUri = data.getData();
String selectedPathVideo="";
selectedPathVideo = ImageFilePath.getPath(getApplicationContext(), videoUri);
Log.i("Image File Path", ""+selectedPathVideo);
try {
Bitmap thumb = ThumbnailUtils.createVideoThumbnail(selectedPathVideo, MediaStore.Video.Thumbnails.MICRO_KIND);
imgFarmerVideo.setImageBitmap(thumb);
} catch (Exception e) {
e.printStackTrace();
}
समर्थन फ़ाइल
public class ImageFilePath {
/**
* Method for return file path of Gallery image
*
* @param context
* @param uri
* @return path of the selected image file from gallery
*/
public static String getPath(final Context context, final Uri uri)
{
//check here to KITKAT or new version
final boolean isKitKat = Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT;
// DocumentProvider
if (isKitKat && DocumentsContract.isDocumentUri(context, uri)) {
// ExternalStorageProvider
if (isExternalStorageDocument(uri)) {
final String docId = DocumentsContract.getDocumentId(uri);
final String[] split = docId.split(":");
final String type = split[0];
if ("primary".equalsIgnoreCase(type)) {
return Environment.getExternalStorageDirectory() + "/" + split[1];
}
}
// DownloadsProvider
else if (isDownloadsDocument(uri)) {
final String id = DocumentsContract.getDocumentId(uri);
final Uri contentUri = ContentUris.withAppendedId(
Uri.parse("content://downloads/public_downloads"), Long.valueOf(id));
return getDataColumn(context, contentUri, null, null);
}
// MediaProvider
else if (isMediaDocument(uri)) {
final String docId = DocumentsContract.getDocumentId(uri);
final String[] split = docId.split(":");
final String type = split[0];
Uri contentUri = null;
if ("image".equals(type)) {
contentUri = MediaStore.Images.Media.EXTERNAL_CONTENT_URI;
} else if ("video".equals(type)) {
contentUri = MediaStore.Video.Media.EXTERNAL_CONTENT_URI;
} else if ("audio".equals(type)) {
contentUri = MediaStore.Audio.Media.EXTERNAL_CONTENT_URI;
}
final String selection = "_id=?";
final String[] selectionArgs = new String[] {
split[1]
};
return getDataColumn(context, contentUri, selection, selectionArgs);
}
}
// MediaStore (and general)
else if ("content".equalsIgnoreCase(uri.getScheme())) {
// Return the remote address
if (isGooglePhotosUri(uri))
return uri.getLastPathSegment();
return getDataColumn(context, uri, null, null);
}
// File
else if ("file".equalsIgnoreCase(uri.getScheme())) {
return uri.getPath();
}
return null;
}
/**
* Get the value of the data column for this Uri. This is useful for
* MediaStore Uris, and other file-based ContentProviders.
*
* @param context The context.
* @param uri The Uri to query.
* @param selection (Optional) Filter used in the query.
* @param selectionArgs (Optional) Selection arguments used in the query.
* @return The value of the _data column, which is typically a file path.
*/
public static String getDataColumn(Context context, Uri uri, String selection,
String[] selectionArgs) {
Cursor cursor = null;
final String column = "_data";
final String[] projection = {
column
};
try {
cursor = context.getContentResolver().query(uri, projection, selection, selectionArgs,
null);
if (cursor != null && cursor.moveToFirst()) {
final int index = cursor.getColumnIndexOrThrow(column);
return cursor.getString(index);
}
} finally {
if (cursor != null)
cursor.close();
}
return null;
}
/**
* @param uri The Uri to check.
* @return Whether the Uri authority is ExternalStorageProvider.
*/
public static boolean isExternalStorageDocument(Uri uri) {
return "com.android.externalstorage.documents".equals(uri.getAuthority());
}
/**
* @param uri The Uri to check.
* @return Whether the Uri authority is DownloadsProvider.
*/
public static boolean isDownloadsDocument(Uri uri) {
return "com.android.providers.downloads.documents".equals(uri.getAuthority());
}
/**
* @param uri The Uri to check.
* @return Whether the Uri authority is MediaProvider.
*/
public static boolean isMediaDocument(Uri uri) {
return "com.android.providers.media.documents".equals(uri.getAuthority());
}
/**
* @param uri The Uri to check.
* @return Whether the Uri authority is Google Photos.
*/
public static boolean isGooglePhotosUri(Uri uri) {
return "com.google.android.apps.photos.content".equals(uri.getAuthority());
}
}
- 1. वीडियो यूआरएल
- 2. यूआरएल में यूट्यूब वीडियो आईडी प्राप्त करना और यूआरएल
- 3. यूआरएल से यूट्यूब वीडियो आईडी - उद्देश्य सी
- 4. एचटीएमएल 5 वीडियो टैग और आरटीपी यूआरएल
- 5. यूआरएल से स्ट्रीमिंग ऑडियो/वीडियो कैसे चलाएं?
- 6. यूआरएल
- 7. मैं यूआरएल से वीडियो आईडी कैसे प्राप्त करूं? (Vimeo)
- 8. एक वीडियो
- 9. वीडियो व्यू लूपिंग वीडियो
- 10. एंड्रॉइड वीडियो व्यू - वीडियो
- 11. रेगेक्स: यूआरएल
- 12. उस वीडियो के वीडियो आईडी से डेलीमोशन वीडियो से वीडियो थंबनेल कैसे प्राप्त करें जैसे यूट्यूब में?
- 13. वीडियो
- 14. वीडियो
- 15. वीडियो
- 16. यूट्यूब यूआरएल
- 17. वीडियो बदलें एचटीएमएल 5 वीडियो
- 18. ऑटोस्टार्ट + लूप वीडियो यूट्यूब वीडियो
- 19. वीडियो फ़ाइल डाउनलोड मुद्दा
- 20. यूट्यूब वीडियो डाउनलोड URL
- 21. एंड्रॉइड वीडियो स्ट्रीमिंग उदाहरण
- 22. एंड्रॉइड एसडीके - यूआरएल
- 23. एंड्रॉइड वीडियो व्यू में यूट्यूब वीडियो कैसे खेलें?
- 24. FFmpegPHP बाहरी यूआरएल
- 25. एचटीएमएल 5 वीडियो स्ट्रीमिंग/
- 26. वीडियो स्ट्रीमिंग और एंड्रॉइड
- 27. एंड्रॉइड वीडियो व्यू अनुक्रमिक वीडियो नहीं चला रहा
- 28. वीडियो प्ले करें जब वीडियो usinng mediaplayer
- 29. यूआरएल योजना यूआरएल योजना
- 30. एचटीएमएल यूआरएल - मौजूदा यूआरएल
मेरा उत्तर देखें ... – Lokesh
@ user3726986 यह ContentProvider URL या URL यूट्यूब की तरह है में काम कर रहा है? – SMR