I'm trying convert a gif to a webm for files uploaded to my site, to get smaller files (gifs are so big...) and get all the advantages of videos like pausing.
The problem is ffmpeg gives this error:
Input #0, gif, from '1.gif': Duration: N/A, bitrate: N/A
Stream #0:0: Video: gif, bgra, 960x540, 16.67 fps, 16.67 tbr, 100 tbn, 100 tbc Stream mapping: Stream #0:0 -> #0:0 (gif (native) ->
vp8 (libvpx)) Press [q] to stop, [?] for help [libvpx #
0x5560ca413960] v1.6.1 [libvpx # 0x5560ca413960] Transparency encoding
with auto_alt_ref does not work Error initializing output stream 0:0
-- Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height
Conversion failed!
Here's my ffmpeg line:
ffmpeg -r 16 -i 1.gif -c:v libvpx -crf 12 -b:v 500k test.webm
ffmpeg -y -i 1.gif -r 16 -c:v libvpx -quality good -cpu-used 0 -b:v 500K -crf 12 -pix_fmt yuv420p -movflags faststart test.webm
Related
I've been using this command to convert my public rtmp audio/video stream to a local mp3 audio icecast2 stream, but I have been unable to do the same for both video and audio.
[Audio Only] (This works fine)
ffmpeg -re -i rtmp://162.142.xx.xxx:xxx/stream -vn -codec:a libmp3lame -b:a 128k -f mp3 -content_type audio/mpeg icecast://source:password#192.168.1.xxx:80/live
I've tried to re-write in order to support video, but I keep hitting dead ends
[Audio & Video Attempt] (this does not work)
ffmpeg -re -i rtmp://162.142.xx.xxx:xxx/stream -codec:v -f mpeg4 -b:v -f mpeg4 -content_type video/mpeg4 icecast://source:password#192.168.1.xxx:80/live
When I run this command, it gives me the error below asking for a suitable format.
$ ffmpeg -re -i rtmp://162.142.xx.xxx:xxx/stream -codec:v -f mpeg4 -b:v -f mpeg4 -content_type video/mpeg4 icecast://source:password#192.168.1.xxx:80/live
[h264 # 0x5598ffbb8980] co located POCs unavailable
[h264 # 0x5598ffbb8980] mmco: unref short failure
Input #0, flv, from 'rtmp://162.142.xx.xxx:xxx/stream':
Metadata:
|RtmpSampleAccess: true
Server : NGINX RTMP (github.com/sergey-dryabzhinsky/nginx-rtmp-module)
displayWidth : 1280
displayHeight : 720
fps : 48
videokeyframe_frequency: 0
profile :
level :
Duration: 00:00:00.00, start: 28117.779000, bitrate: N/A
Stream #0:0: Audio: aac (LC), 48000 Hz, stereo, fltp, 327 kb/s
Stream #0:1: Video: h264 (High), yuv420p(tv, bt709, progressive), 1280x720 [SAR 1:1 DAR 16:9], 2560 kb/s, 48 fps, 48 tbr, 1k tbn
[NULL # 0x5598ffb8bec0] Unable to find a suitable output format for 'mpeg4'
mpeg4: Invalid argument
I am positive that icecast2 can support video streams, however on the few occasions that I was able to actively stream successfully to it, it only showed an empty video embed.
I've re-written the command for AV multiple times while referencing ffmpeg documentation, however my above attempt seems to be the closest (concept-wise) that I have gotten.
What flags/formatting might I be missing which are causing the stream not to work?
I'm attempting to transcode a DVD to a single MKV file. I've had success in the past with other DVDs, but I'm running into an error I haven't seen before.
First I concatenate the VOB files I want to transcode:
cat VTS_02_1.VOB VTS_02_2.VOB VTS_02_3.VOB > WMAV.VOB
ffprobe output:
$ ffprobe -analyzeduration 100M -probesize 100M WMAV.VOB Input #0, mpeg, from 'WMAV.VOB':
Duration: 01:05:19.42, start: 0.300300, bitrate: 5686 kb/s
Stream #0:0[0x1bf]: Data: dvd_nav_packet
Stream #0:1[0x1e0]: Video: mpeg2video (Main), yuv420p(tv, smpte170m, top first), 720x480 [SAR 32:27 DAR 16:9], 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc
Stream #0:2[0x80]: Audio: ac3, 48000 Hz, stereo, fltp, 192 kb/s
Unsupported codec with id 100357 for input stream 0
Then I run this command to transcode the file:
ffmpeg -analyzeduration 100M -probesize 100M \
-i WMAV.VOB \
-map 0:1 -map 0:2 \
-c:v libx264 -preset slow -tune film -crf 21 \
-c:a aac -b:a 192k \
wmav.mkv
However, when I include -c:a aac, I get thousands of errors like this:
Error while decoding stream #0:2: Error number -16976906 occurred
[ac3 # 000002bd24d8eec0] expacc 127 is out-of-range
[ac3 # 000002bd24d8eec0] error decoding the audio block
There doesn't seem to be any issue with the audio stream since it plays back fine in VLC. The transcode succeeds if I use -c:a copy.
What is causing this error and how could I fix the problem?
i have .ts file looks like the following
Input #0, mpegts, from 'i.ts':
Duration: 00:00:36.32, start: 28752.398067, bitrate: 57694 kb/s
Program 50
Metadata:
service_name : aaa HD
service_provider:
Stream #0:51[0x1f5]: Video: h264 ([27][0][0][0] / 0x001B), none, 90k tbr, 90k tbn, 180k tbc
Stream #0:52[0x1f6]: Audio: mp3 ([3][0][0][0] / 0x0003), 0 channels, fltp
Program 51
Metadata:
service_name : b Music HD
service_provider:
Stream #0:16[0x1ff]: Video: h264 ([27][0][0][0] / 0x001B), none, 90k tbr, 90k tbn, 180k tbc
Stream #0:17[0x200]: Audio: mp3 ([3][0][0][0] / 0x0003), 0 channels, fltp
Program 52
Metadata:
service_name : c ch HD
service_provider:
Stream #0:14[0x209]: Video: h264 ([27][0][0][0] / 0x001B), none, 90k tbr, 90k tbn, 180k tbc
Stream #0:15[0x20a]: Audio: mp3 ([3][0][0][0] / 0x0003), 0 channels, fltp
Program 1510
Metadata:
service_name : asd
service_provider: xyz
Stream #0:18[0x5e7]: Video: h264 ([27][0][0][0] / 0x001B), none, 90k tbr, 90k tbn, 180k tbc
Stream #0:19[0x5e8]: Audio: mp3 ([3][0][0][0] / 0x0003), 0 channels, fltp
i need to extract one video stream and its audio stream from this file for example related to program 50 i tried
ffmpeg -i i.ts -map 0:51 output.mp4
but i got this error
Stream mapping:
Stream #0:51 -> #0:0 (h264 (native) -> h264 (libx264))
Press [q] to stop, [?] for help
Cannot determine format of input stream 0:51 after EOF
Error marking filters as finished
Conversion failed!
I found a solution here
For mapping the whole programs, the syntax is:
ffmpeg -i i.ts -c:v copy -c:a copy -map 0:p:51 output.mp4
I can't verify that solution is actually working with your .ts file.
I created the following sample, that builds a .ts file with two programs, and then extracts each program to .mp4 file:
ffmpeg -y -r 10 -f lavfi -i testsrc=rate=10:size=160x120 -f lavfi -i sine=frequency=1000 -t 5 -c:v libx264 -c:a aac in1.mp4
ffmpeg -y -r 10 -f lavfi -i mandelbrot=rate=10:size=160x120 -f lavfi -i sine=frequency=300 -t 5 -c:v libx264 -c:a aac in2.mp4
ffmpeg -y -i in1.mp4 -i in2.mp4 -map 0:0 -map 0:1 -map 1:0 -map 1:1 -program title=ProgOne:st=0:st=1 -program title=ProgTwo:st=2:st=3 -c:v copy -c:a copy in.ts
ffmpeg -y -i in.ts -c:v copy -c:a copy -map 0:p:1 output1.mp4
ffmpeg -y -i in.ts -c:v copy -c:a copy -map 0:p:2 output2.mp4
1st command builds video test pattern with high frequency beep (output: in1.mp4).
2nd command builds video Mandelbrot pattern with low frequency beep (output: in2.mp4).
3rd command builds transport stream with two programs (output: in.ts).
4th command extracts first program (output: output1.mp4).
5th command extracts second program (output: output2.mp4).
I am trying to transcode tv streams but with only the english audio stream included. I have tried using the -map 0:m:language:eng stream specifier, but I get:
"Automatic encoder selection failed for output stream #0:3. Default encoder for format mpegts (codec none) is probably disabled. Please choose an encoder manually.
Error selecting an encoder for stream 0:3"
This is despite including an encoder. I have tried all sorts of variations on this theme without success.
Full output for one attempt is below:
ffmpeg -i http://192.168.1.74:8001/1:0:1:189E:7FD:2:11A0000:0:0:0: -ignore_unknown -map 0:a -map 0:m:language:eng -map 0:v -acodec aac -vcodec libx264 -b:v 1100000 -t 00:00:30 "somethin.ts" 2>output.txt
Consider increasing the value for the 'analyzeduration' and 'probesize' options
[mpegts # 03db7b60] Could not find codec parameters for stream 17 (Unknown: none ([11][0][0][0] / 0x000B)): unknown codec
Consider increasing the value for the 'analyzeduration' and 'probesize' options
[mpegts # 03db7b60] Could not find codec parameters for stream 18 (Unknown: none ([11][0][0][0] / 0x000B)): unknown codec
Consider increasing the value for the 'analyzeduration' and 'probesize' options
Input #0, mpegts, from 'http://192.168.1.74:8001/1:0:1:189E:7FD:2:11A0000:0:0:0:':
Duration: N/A, start: 23690.732933, bitrate: N/A
Program 6321
Program 6322
Program 6338
Program 6301
Program 6302
Stream #0:0[0x13ec]: Video: mpeg2video (Main) ([2][0][0][0] / 0x0002), yuv420p(tv, top first), 720x576 [SAR 64:45 DAR 16:9], 25 fps, 25 tbr, 90k tbn, 50 tbc
Stream #0:1[0x13ee](NAR): Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz, stereo, s16p, 224 kb/s
Stream #0:2[0x13ed](eng): Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz, stereo, s16p, 224 kb/s
Stream #0:3[0x13ef](eng,eng): Subtitle: dvb_teletext ([6][0][0][0] / 0x0006)
Stream #0:4[0x13f0](eng): Subtitle: dvb_subtitle ([6][0][0][0] / 0x0006)
Stream #0:5[0xf04]: Unknown: none ([5][0][0][0] / 0x0005)
Stream #0:6[0xf03]: Unknown: none ([5][0][0][0] / 0x0005)
Stream #0:7[0xf02]: Unknown: none ([5][0][0][0] / 0x0005)
Stream #0:8[0xf01]: Unknown: none ([5][0][0][0] / 0x0005)
Stream #0:9[0xf00]: Unknown: none ([5][0][0][0] / 0x0005)
Stream #0:10[0x92a]: Unknown: none ([5][0][0][0] / 0x0005)
Stream #0:11[0x913]: Unknown: none ([5][0][0][0] / 0x0005)
Stream #0:12[0x912]: Unknown: none ([5][0][0][0] / 0x0005)
Stream #0:13[0x911]: Unknown: none ([5][0][0][0] / 0x0005)
Stream #0:14[0x919]: Unknown: none ([5][0][0][0] / 0x0005)
Stream #0:15[0xf09]: Unknown: none ([11][0][0][0] / 0x000B)
Stream #0:16[0xf08]: Unknown: none ([11][0][0][0] / 0x000B)
Stream #0:17[0xf07]: Unknown: none ([11][0][0][0] / 0x000B)
Stream #0:18[0xf06]: Unknown: none ([11][0][0][0] / 0x000B)
Program 6318
Program 6390
Program 6391
Program 6351
Program 6361
Program 6306
Program 6341
Automatic encoder selection failed for output stream #0:3. Default encoder for format mpegts (codec none) is probably disabled. Please choose an encoder manually.
Error selecting an encoder for stream 0:3
Any ideas on how to do this. I cant specify streams by number as I want to use it for lots of tv streams and the order is often different.
Thanks
Output stream 0:3 is a image-based subtitle stream. Since you've not specified an encoder for subtitles, ffmpeg is trying to pick one and fails since it doesn't have an image-based subtitle encoder. You can copy or drop the stream.
ffmpeg -i http://192.168.1.74:8001/1:0:1:189E:7FD:2:11A0000:0:0:0: -ignore_unknown -c copy -map 0:a -map 0:m:language:eng -map 0:v -acodec aac -vcodec libx264 -b:v 1100000 -t 00:00:30 "somethin.ts" 2>output.txt
Of course, your primary aim is to map only the audio stream by language. Your command will map the video twice, as it is tagged as English.
To avoid this, you can use two ffmpeg commands:
ffmpeg -i http://192.168.1.74:8001/1:0:1:189E:7FD:2:11A0000:0:0:0: -ignore_unknown -c copy -map 0:v:0 -map 0:m:language:eng -f mpegts - | ffmpeg -f mpegts -i - -map 0:v:0 -map 0:a:0 -c:a aac -c:v libx264 -b:v 1.1M out.ts
I am using this command to convert an avi,mov,m4v video files to flv format via FFMPEG
/usr/local/bin/ffmpeg -i '/home/public_html/files/video_1355440448.m4v' -s '640x360' -sameq -ab '64k' -ar '44100' -f 'flv' -y /home/public_html/files/video_1355440448.flv
[flv # 0x68b1a80] requested bitrate is too low
Output #0, flv, to '/home/files/1355472099-50cadce349290.flv':
Stream #0.0: Video: flv, yuv420p, 640x360, q=2-31, pass 2, 200 kb/s, 90k tbn, 25 tbc
Stream #0.1: Audio: adpcm_swf, 44100 Hz, 2 channels, s16, 64 kb/s
Stream mapping:
Stream #0.0 -> #0.0
Stream #0.1 -> #0.1
Error while opening encoder for output stream #0.0 - maybe incorrect parameters such as bit_rate, rate, width or height
-------------------------------
RESULT
-------------------------------
Execute error. Output for file "/home/public_html/files/video_1355472099.avi" was found, but the file contained no data. Please check the available codecs compiled with FFmpeg can support this type of conversion. You can check the encode decode availability by inspecting the output array from PHPVideoToolkit::getFFmpegInfo().
But if I manually used this command then its working
/usr/local/bin/ffmpeg -i '/home/public_html/files/video_1355440448.m4v' -s '640x360' -sameq -ab '64k' -ar '44100' -f 'flv' -y /home/public_html/files/video_1355440448.flv
This is because you have two streams and output will be encoding then resizing, see your output messages:
Stream #0.0 -> #0.0
Stream #0.1 -> #0.1
... you use adpcm_swf audio and yuv420p video
The answer is very simple, you need to put copy as your audio codec ...
See my example with video mpeg4,yuv420p and audio ac3 ...
ffmpeg -i input.mkv -vf scale=720:-1 -acodec copy -threads 12 output.mkv
this will change first size = 720 with aspect ratio = -1 (unknown). Also you need to use:
-acodec copy -threads 12
If don't use this you will have one error.
For example: When I used it, the output encoding messages show me this and it works well:
[h624 # 0x874e4a0] missing picture in access unit93 bitrate=1034.4kbits/s
Last message repeated 1163 times5974kB time=53.47 bitrate= 915.3kbits/s
You need to use for flv format file, something like this:
ffmpeg -i input.mp4 -c:v libx264 -crf 19 output.flv
You are given an error message
[flv # 0x68b1a80] requested bitrate is too low
You need to change bitrate to a valid. It is better if you use a different codec
-acodec libmp3lame
And remove the option -sameq. This option does NOT mean 'same quality'. Actually means 'same quantizers'!
I had a similar problem due to size constraints. The original image size was strange (width=1343), meaning that when I tried to specify a new size with -s, any rounding error caused problems. Make sure that the new image size can have the exact same aspect ratio!
I have got the same issue
- requested bitrate is too low
and just resolved this issue by lowering down the bit rate
by adding -b:a 32k