मैं एंड्रॉइड के साथ ffmpeg का उपयोग कर रहा हूं। मैं अपने MP4 में एक SRT फ़ाइल (उपशीर्षक) को जलाना चाहता हूं। मेरा कोड है:
ffmpeg -i /sdcard/AddSrtToVideoTemp/video.mp4 -i /sdcard/AddSrtToVideoTemp/video.srt -c:s mov_text -c:v copy -c:a copy /sdcard/AddSrtToVideoTemp/new.mp4
कोड सफलतापूर्वक संकलित करता है लेकिन उपशीर्षक new.mp4 में नहीं जोड़े जाते हैं।
मेरा कंसोल आउटपुट है:
ffmpeg version N-69972-g6c91afe Copyright (c) 2000-2015 the FFmpeg developers
built with gcc 4.9 (GCC) 20140827 (prerelease)
ffmpeg4android 2.5_24p6_full_no_x264
libavutil 54. 19.100 / 54. 19.100
libavcodec 56. 25.100 / 56. 25.100
libavformat 56. 23.100 / 56. 23.100
libavdevice 56. 4.100 / 56. 4.100
libavfilter 5. 11.100 / 5. 11.100
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 1.100 / 1. 1.100
libpostproc 53. 3.100 / 53. 3.100
Splitting the commandline.
Reading option '-i' ... matched as input file with argument '/sdcard/AddSrtToVideoTemp/video.mp4'.
Reading option '-i' ... matched as input file with argument '/sdcard/AddSrtToVideoTemp/video.srt'.
Reading option '-c:s' ... matched as option 'c' (codec name) with argument 'mov_text'.
Reading option '-c:v' ... matched as option 'c' (codec name) with argument 'copy'.
Reading option '-c:a' ... matched as option 'c' (codec name) with argument 'copy'.
Reading option '/sdcard/AddSrtToVideoTemp/Video_11611173526.mp4' ... matched as output file.
Finished splitting the commandline.
Parsing a group of options: global .
Successfully parsed a group of options.
Parsing a group of options: input file /sdcard/AddSrtToVideoTemp/video.mp4.
Successfully parsed a group of options.
Opening an input file: /sdcard/AddSrtToVideoTemp/video.mp4.
Format mov,mp4,m4a,3gp,3g2,mj2 probed with size=2048 and score=100
ISO: File Type Major Brand: isom
rfps: 29.916667 0.008074
rfps: 29.916667 0.008074
rfps: 30.000000 0.000128
rfps: 30.000000 0.000128
rfps: 60.000000 0.000511
rfps: 60.000000 0.000511
rfps: 120.000000 0.002045
rfps: 120.000000 0.002045
rfps: 240.000000 0.008182
rfps: 29.970030 0.001565
rfps: 29.970030 0.001565
rfps: 59.940060 0.006258
Before avformat_find_stream_info() pos: 5610022 bytes read:35643 seeks:1
All info found
After avformat_find_stream_info() pos: 73704 bytes read:109315 seeks:2 frames:48
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from /sdcard/AddSrtToVideoTemp/video.mp4:
Metadata:
major_brand : isom
minor_version : 0
compatible_brands: isom3gp4
creation_time : 2016-10-12 22:23:37
Duration: 00:00:04.01, start: 0.000000, bitrate: 11189 kb/s
Stream #0:0(eng), 1, 1/90000: Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1280x720, 12229 kb/s, SAR 1:1 DAR 16:9, 29.79 fps, 30 tbr, 90k tbn, 180k tbc (default)
Metadata:
rotate : 180
creation_time : 2016-10-12 22:23:37
handler_name : VideoHandle
encoder :
Side data:
displaymatrix: rotation of 180.00 degrees
Stream #0:1(eng), 47, 1/48000: Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 128 kb/s (default)
Metadata:
creation_time : 2016-10-12 22:23:37
handler_name : SoundHandle
Successfully opened the file.
Parsing a group of options: input file /sdcard/AddSrtToVideoTemp/video.srt.
Successfully parsed a group of options.
Opening an input file: /sdcard/AddSrtToVideoTemp/video.srt.
Format srt probed with size=2048 and score=100
Before avformat_find_stream_info() pos: 167 bytes read:167 seeks:0
All info found
After avformat_find_stream_info() pos: 167 bytes read:167 seeks:0 frames:0
Input #1, srt, from '/sdcard/AddSrtToVideoTemp/video.srt':
Duration: N/A, bitrate: N/A
Stream #1:0, 0, 1/1000: Subtitle: subrip
Successfully opened the file.
Parsing a group of options: output file /sdcard/AddSrtToVideoTemp/Video_11611173526.mp4.
Applying option c:s (codec name) with argument mov_text.
Applying option c:v (codec name) with argument copy.
Applying option c:a (codec name) with argument copy.
Successfully parsed a group of options.
Opening an output file: /sdcard/AddSrtToVideoTemp/Video_11611173526.mp4.
Successfully opened the file.
Output #0, mp4, to '/sdcard/AddSrtToVideoTemp/Video_11611173526.mp4':
Metadata:
major_brand : isom
minor_version : 0
compatible_brands: isom3gp4
encoder : Lavf56.23.100
Stream #0:0(eng), 0, 1/90000: Video: h264 ([33][0][0][0] / 0x0021), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], q=2-31, 12229 kb/s, 29.79 fps, 30 tbr, 90k tbn, 90k tbc (default)
Metadata:
rotate : 180
creation_time : 2016-10-12 22:23:37
handler_name : VideoHandle
encoder :
Side data:
displaymatrix: rotation of 180.00 degrees
Stream #0:1(eng), 0, 1/48000: Audio: aac ([64][0][0][0] / 0x0040), 48000 Hz, stereo, 128 kb/s (default)
Metadata:
creation_time : 2016-10-12 22:23:37
handler_name : SoundHandle
Stream #0:2, 0, 1/1000: Subtitle: mov_text ([8][0][0][0] / 0x0008)
Metadata:
encoder : Lavc56.25.100 mov_text
Stream mapping:
Stream #0:0 -> #0:0 (copy)
Stream #0:1 -> #0:1 (copy)
Stream #1:0 -> #0:2 (subrip (srt) -> mov_text (native))
Press [q] to stop, [?] for help
Delay between the first packet and last packet in the muxing queue is 3242975044 > 10000000: forcing output
Delay between the first packet and last packet in the muxing queue is 11245000 > 10000000: forcing output
No more output streams to write to, finishing.
frame= 108 fps=0.0 q=-1.0 Lsize= 5480kB time=00:54:15.24 bitrate= 13.8kbits/s
video:5413kB audio:63kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.076349%
Input file #0 (/sdcard/AddSrtToVideoTemp/video.mp4):
Input stream #0:0 (video): 108 packets read (5542944 bytes);
Input stream #0:1 (audio): 188 packets read (64171 bytes);
Total: 296 packets (5607115 bytes) demuxed
Input file #1 (/sdcard/AddSrtToVideoTemp/video.srt):
Input stream #1:0 (subtitle): 4 packets read (16 bytes); 4 frames decoded;
Total: 4 packets (16 bytes) demuxed
Output file #0 (/sdcard/AddSrtToVideoTemp/Video_11611173526.mp4):
Output stream #0:0 (video): 108 packets muxed (5542944 bytes);
Output stream #0:1 (audio): 188 packets muxed (64171 bytes);
Output stream #0:2 (subtitle): 4 frames encoded; 4 packets muxed (24 bytes);
Total: 300 packets (5607139 bytes) muxed
4 frames successfully decoded, 0 decoding errors
ffmpeg4android: 0
@ ir.appstudio मैंने सिर्फ वीडियो के एक टुकड़े पर आपके कोड का परीक्षण किया। यह भव्यता से काम करता है। तो, शायद आपको लगता है कि सबटाइटल जोड़ा नहीं गया है क्योंकि ऐप जिस पर वीडियो देखने की कोशिश करता है, वह सबटाइटल प्रारूप का समर्थन नहीं करता है। मैंने विंडोज में पोटलपेयर की कोशिश की। समस्या को अलग करने के लिए मैं आपको वही करने की सलाह देता हूं।
Output stream #0:2 (subtitle): 4 frames encoded; 4 packets muxed (24 bytes);
क्या आप वाकई एक सही .srt फ़ाइल का उपयोग कर रहे हैं? (जिसमें वास्तविक सामग्री शामिल है?)