 |
|
C# WinApp ขอคำแนะนำเกี่ยวกับการจัดการไฟล์ mkv หน่อยครับ |
|
 |
|
|
 |
 |
|
จากรูปเสียงไทยคือ track 1
ใช้ของสำเร็จรูปดีแล้ว ถ้าไม่มีพื้นฐาน media file systems อย่าเขียนเอง เพราะเสียเวลาเปล่า
mkvtoolnix จัดการได้ทุกอย่างอยู่แล้ว
|
 |
 |
 |
 |
Date :
2020-12-17 17:09:28 |
By :
ล่องหน |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ไม่ลองใช้ command line search in file ดู ลองจาก explorer ดูก่อน ถ้าทำได้ ก็จะเร็วมากเลยนะครับ
แบบไม่เคยทำกับไฟล์ หนังหรือ music เหมือนกัน
แต่อาศัยประสบการณ์จากการ ค้นหาข้อมูลในไฟล์ แบบ หลายๆ ไฟล์
แบบรู้ format ที่แน่ชัด
|
 |
 |
 |
 |
Date :
2020-12-17 21:14:58 |
By :
Chaidhanan |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ไม่ต้องเช็คแทร็ก แต่ระบุ th กับ audio stream ไปเลย
พยายามทำความเข้าใจลิงค์เอกสารที่ผมให้ไป อ่านอิงค์ ไม่เก่งใช้ bing ช่วย
|
 |
 |
 |
 |
Date :
2020-12-21 07:49:43 |
By :
ล่องหน |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
Unicode ต้องใส่เป็น "absolute path" ที่มีเครื่องหมายคำพูด และถ้านำไปใช้ใน .NET ต้อง escape string ด้วย
|
 |
 |
 |
 |
Date :
2020-12-21 16:02:23 |
By :
ล่องหน |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
เพื่อพิสูจน์เรื่อง path ลองรันใน cmd ได้หรือไม่
และอีกอย่าง รหัสภาษาที่ใส่ไปกับเสียงรองรับ ISO 639-1 ด้วยรึ เห็นในเอกสารเขาบอกให้ใช้เป็น ISO 639-2
|
 |
 |
 |
 |
Date :
2020-12-21 16:25:05 |
By :
ล่องหน |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
เรื่อง Unicode ลองเช็คที่ File -> Advanced Save Options
http://i.stack.imgur.com/R1ohF.png
ส่วน language ใน GUI น่าจะเป็น country code
เท่าที่อ่านเจอในเอกสาร การใช้คำสั่งใน command line ต้องใช้ tag code (ISO 639-2)
mkvmerge จะแปลงหรือลิงค์ข้อมูลไปยัง country code เอง
แต่ก็แค่อ่านยังไม่พิสูจน์เพราะไม่มีหนูทดลอง
|
 |
 |
 |
 |
Date :
2020-12-21 16:37:02 |
By :
ล่องหน |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ขอบคุณมากครับ
|
 |
 |
 |
 |
Date :
2020-12-21 16:59:37 |
By :
lamaka.tor |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
เพิ่งได้หนูทดลองใหม่ เผื่อมีประโยชน์ครับ (ภาษาจะแสดงเฉพาะใน JSON format)
option ที่ใช้ดู TrackID ของภาษา
C:\>"D:\ThaiCreate\mkvtoolnix\mkvmerge.exe" -F json -i "Z:\TCMOV\Monster.Hunter.2020.720p.HDCAM.Hindi.Dub.Dual-Audio.x264-1XBET..mkv"
{
"attachments": [],
"chapters": [],
"container": {
"properties": {
"container_type": 17,
"duration": 5499332000000,
"is_providing_timestamps": true,
"muxing_application": "Lavf58.20.100",
"segment_uid": "2dd58f2ec64171adf23d150cb9149e4f",
"writing_application": "Lavf58.20.100"
},
"recognized": true,
"supported": true,
"type": "Matroska"
},
"errors": [],
"file_name": "Z:\\TCMOV\\Monster.Hunter.2020.720p.HDCAM.Hindi.Dub.Dual-Audio.x264-1XBET..mkv",
"global_tags": [
{
"num_entries": 1
}
],
"identification_format_version": 13,
"track_tags": [
{
"num_entries": 1,
"track_id": 0
},
{
"num_entries": 1,
"track_id": 1
},
{
"num_entries": 1,
"track_id": 2
}
],
"tracks": [
{
"codec": "MPEG-4p10/AVC/H.264",
"id": 0,
"properties": {
"codec_id": "V_MPEG4/ISO/AVC",
"codec_private_data": "01640020ffe1002a67640020acd1c05004bf9f014202020280000003008000001e71300007270e0000e4e1d261c07c60c47801000668e9bb2cc00bfdf8f800",
"codec_private_length": 63,
"default_duration": 33333333,
"default_track": true,
"display_dimensions": "1280x580",
"display_unit": 0,
"enabled_track": true,
"forced_track": false,
"language": "und",
"minimum_timestamp": 33000000,
"number": 1,
"packetizer": "mpeg4_p10_video",
"pixel_dimensions": "1280x580",
"tag_duration": "01:31:39.332000000",
"uid": 1
},
"type": "video"
},
{
"codec": "AAC",
"id": 1,
"properties": {
"audio_channels": 2,
"audio_sampling_frequency": 48000,
"codec_id": "A_AAC",
"codec_private_data": "1190",
"codec_private_length": 2,
"default_track": true,
"enabled_track": true,
"forced_track": false,
"language": "hin",
"minimum_timestamp": 0,
"number": 2,
"tag_duration": "01:31:39.263000000",
"uid": 2
},
"type": "audio"
},
{
"codec": "AAC",
"id": 2,
"properties": {
"audio_channels": 2,
"audio_sampling_frequency": 48000,
"codec_id": "A_AAC",
"codec_private_data": "1190",
"codec_private_length": 2,
"default_track": true,
"enabled_track": true,
"forced_track": false,
"language": "eng",
"minimum_timestamp": 0,
"number": 3,
"tag_duration": "01:31:39.263000000",
"uid": 3
},
"type": "audio"
}
],
"warnings": []
}
C:\>
ที่เหลือก็ต่อยอดที่ .NET
|
 |
 |
 |
 |
Date :
2020-12-21 17:56:10 |
By :
ล่องหน |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ตัวอย่างการใช้ ISO 639-1
C:\>"D:\ThaiCreate\mkvtoolnix\mkvmerge.exe" -o Y:\test.mkv -d -a hi "Z:\TCMOV\Monster.Hunter.2020.720p.HDCAM.Hindi.Dub.Dual-Audio.x264-1XBET..mkv"
mkvmerge v51.0.0 ('I Wish') 64-bit
Error: '-a' is not a valid IETF BCP 47/RFC 5646 language tag in '-d -a'. Additional information from the parser: The value does not adhere to the general structure of IETF BCP 47/RFC 5646 language tags.
C:\>"D:\ThaiCreate\mkvtoolnix\mkvmerge.exe" -o Y:\test.mkv -d -a hin "Z:\TCMOV\Monster.Hunter.2020.720p.HDCAM.Hindi.Dub.Dual-Audio.x264-1XBET..mkv"
mkvmerge v51.0.0 ('I Wish') 64-bit
Error: '-a' is not a valid IETF BCP 47/RFC 5646 language tag in '-d -a'. Additional information from the parser: The value does not adhere to the general structure of IETF BCP 47/RFC 5646 language tags.
C:\>"D:\ThaiCreate\mkvtoolnix\mkvmerge.exe" -o Y:\test.mkv -d --audio-tracks hi "Z:\TCMOV\Monster.Hunter.2020.720p.HDCAM.Hindi.Dub.Dual-Audio.x264-1XBET..mkv"
mkvmerge v51.0.0 ('I Wish') 64-bit
Error: '--audio-tracks' is not a valid IETF BCP 47/RFC 5646 language tag in '-d --audio-tracks'. Additional information from the parser: The value does not adhere to the general structure of IETF BCP 47/RFC 5646 language tags.
C:\>"D:\ThaiCreate\mkvtoolnix\mkvmerge.exe" -o Y:\test.mkv -d --audio-tracks hin "Z:\TCMOV\Monster.Hunter.2020.720p.HDCAM.Hindi.Dub.Dual-Audio.x264-1XBET..mkv"
mkvmerge v51.0.0 ('I Wish') 64-bit
Error: '--audio-tracks' is not a valid IETF BCP 47/RFC 5646 language tag in '-d --audio-tracks'. Additional information from the parser: The value does not adhere to the general structure of IETF BCP 47/RFC 5646 language tags.
C:\>"D:\ThaiCreate\mkvtoolnix\mkvmerge.exe" -o "Y:\test.mkv" -d -a hin "Z:\TCMOV\Monster.Hunter.2020.720p.HDCAM.Hindi.Dub.Dual-Audio.x264-1XBET..mkv"
mkvmerge v51.0.0 ('I Wish') 64-bit
Error: '-a' is not a valid IETF BCP 47/RFC 5646 language tag in '-d -a'. Additional information from the parser: The value does not adhere to the general structure of IETF BCP 47/RFC 5646 language tags.
C:\>"D:\ThaiCreate\mkvtoolnix\mkvmerge.exe" -o Y:\test.mkv -d 0 -a hi "Z:\TCMOV\Monster.Hunter.2020.720p.HDCAM.Hindi.Dub.Dual-Audio.x264-1XBET..mkv"
mkvmerge v51.0.0 ('I Wish') 64-bit
'Z:\TCMOV\Monster.Hunter.2020.720p.HDCAM.Hindi.Dub.Dual-Audio.x264-1XBET..mkv': Using the demultiplexer for the format 'Matroska'.
'Z:\TCMOV\Monster.Hunter.2020.720p.HDCAM.Hindi.Dub.Dual-Audio.x264-1XBET..mkv' track 0: Using the output module for the format 'AVC/H.264'.
'Z:\TCMOV\Monster.Hunter.2020.720p.HDCAM.Hindi.Dub.Dual-Audio.x264-1XBET..mkv' track 1: Using the output module for the format 'AAC'.
The file 'Y:\test.mkv' has been opened for writing.
Progress: 100%
The cue entries (the index) are being written...
Multiplexing took 57 seconds.
C:\>"D:\ThaiCreate\mkvtoolnix\mkvmerge.exe" -F json -i Y:\test.mkv
{
"attachments": [],
"chapters": [],
"container": {
"properties": {
"container_type": 17,
"date_local": "2020-12-22T10:37:18+07:00",
"date_utc": "2020-12-22T03:37:18Z",
"duration": 5499332000000,
"is_providing_timestamps": true,
"muxing_application": "libebml v1.4.0 + libmatroska v1.6.2",
"segment_uid": "383a30f8f2487f74593a8c6f64d7185c",
"writing_application": "mkvmerge v51.0.0 ('I Wish') 64-bit"
},
"recognized": true,
"supported": true,
"type": "Matroska"
},
"errors": [],
"file_name": "Y:\\test.mkv",
"global_tags": [
{
"num_entries": 1
}
],
"identification_format_version": 13,
"track_tags": [],
"tracks": [
{
"codec": "MPEG-4p10/AVC/H.264",
"id": 0,
"properties": {
"codec_id": "V_MPEG4/ISO/AVC",
"codec_private_data": "01640020ffe1002a67640020acd1c05004bf9f014202020280000003008000001e71300007270e0000e4e1d261c07c60c47801000668e9bb2cc00bfdf8f800",
"codec_private_length": 63,
"default_duration": 33333333,
"default_track": true,
"display_dimensions": "1280x580",
"display_unit": 0,
"enabled_track": true,
"forced_track": false,
"language": "und",
"language_ietf": "und",
"minimum_timestamp": 33000000,
"number": 1,
"packetizer": "mpeg4_p10_video",
"pixel_dimensions": "1280x580",
"uid": 1
},
"type": "video"
},
{
"codec": "AAC",
"id": 1,
"properties": {
"audio_channels": 2,
"audio_sampling_frequency": 48000,
"codec_id": "A_AAC",
"codec_private_data": "1190",
"codec_private_length": 2,
"default_duration": 21333333,
"default_track": true,
"enabled_track": true,
"forced_track": false,
"language": "hin",
"language_ietf": "hi",
"minimum_timestamp": 0,
"number": 2,
"uid": 2
},
"type": "audio"
}
],
"warnings": []
}
C:\>
สีน้ำเงินคือ tag ใหม่ที่เพิ่มเข้ามา
|
 |
 |
 |
 |
Date :
2020-12-22 10:56:34 |
By :
ล่องหน |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ตอนนี้ผมลองเขียนคร่าวๆไว้ประมาณนี้ครับ

https://mega.nz/folder/1BwEkQAY#dW0EmqiWZ73OPqgA0W5EIw
-มีการลบข้อความที่ไม่ต้องการในชื่อไฟล์
-ตั้งค่าให้ลบ/ไม่ลบ ไฟล์ หลังจากทำงานเรียบร้อยแล้ว
-ทำงานแบบ backgroundWorker และ มี % บอกความคืบหน้า
ตอนนี้ก็ติดอีกข้อ คือ ขนาด vedio
ผมลองใช้ --display-dimensions '1:640x480' และ --aspect-ratio '16/9' ก็ยังไม่ได้
เห็นใน format factory มีก็เลยอยากมีกะเขามั่งครับ

อาจจะค่อยๆทำต่อไปเพื่อให้โค้ดดีขึ้นเรื่อยๆ ครับ
|
ประวัติการแก้ไข 2020-12-22 18:03:53 2020-12-22 18:04:42 2020-12-22 18:05:40 2020-12-22 18:06:14
 |
 |
 |
 |
Date :
2020-12-22 18:01:39 |
By :
lamaka.tor |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|