I'm converting .mov files to .mpg files using avconv. The command being run by my php application is as follows:
avconv -y -i '$finalvideo' -target ntsc-dvd -aspect 4:3 '$mpgvideo' > $logs
I'm able to convert small .mov files to .mpg without any problems. However, I'm unable to convert videos that are over ten or fifteen minutes long. The log file is completely empty. When I run the command directly the frame stops somewhere around 34000 no matter which video I pick.
The cpu shows 97% usage on this process, however, nothing is happening.
OS Ubuntu 10~
How can I gather more information about this stalled process?
Here's the frozen output
avconv version 0.7, Copyright (c) 2000-2011 the Libav developers
built on Nov 3 2011 13:39:09 with gcc 4.3.3
Seems stream 0 codec frame rate differs from container frame rate: 180000.00 (180000/1) -> 23.98 (24000/1001)
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/var/www/sites/default/files/compiled_videos/573-stream.mov':
Metadata:
major_brand : qt
minor_version : 512
compatible_brands: qt
creation_time : 1970-01-01 00:00:00
encoder : Lavf53.0.3
Duration: 00:18:53.49, start: 0.000000, bitrate: 1430 kb/s
Stream #0.0(eng): Video: h264 (Main), yuv420p, 854x480, 1387 kb/s, 25.60 fps, 23.98 tbr, 90k tbn, 180k tbc
Metadata:
creation_time : 1970-01-01 00:00:00
Stream #0.1(eng): Audio: aac, 48000 Hz, stereo, s16, 126 kb/s
Metadata:
creation_time : 1970-01-01 00:00:00
[buffer # 0x9d88820] w:854 h:480 pixfmt:yuv420p
[scale # 0x9d88b60] w:854 h:480 fmt:yuv420p -> w:720 h:480 fmt:yuv420p flags:0x4
Incompatible sample format 's16' for codec 'ac3', auto-selecting format 'flt'
Output #0, dvd, to '/var/www/sites/default/files/compiled_videos/573.mpg':
Metadata:
major_brand : qt
minor_version : 512
compatible_brands: qt
creation_time : 1970-01-01 00:00:00
encoder : Lavf53.10.0
Stream #0.0(eng): Video: mpeg2video, yuv420p, 720x480 [PAR 8:9 DAR 4:3], q=2-31, 6000 kb/s, 90k tbn, 29.97 tbc
Metadata:
creation_time : 1970-01-01 00:00:00
Stream #0.1(eng): Audio: ac3, 48000 Hz, stereo, flt, 448 kb/s
Metadata:
creation_time : 1970-01-01 00:00:00
Stream mapping:
Stream #0.0 -> #0.0 (h264 -> mpeg2video)
Stream #0.1 -> #0.1 (aac -> ac3)
Press ctrl-c to stop encoding
[mpeg2video # 0x9d8bf20] rc buffer underflow
Input stream #0.1 frame changed from rate:48000 fmt:s16 ch:2 to rate:48000 fmt:flt ch:2
frame=33910 fps= 91 q=2.0 size= 151922kB time=336.58 bitrate=3697.7kbits/s dup=5475 drop=530
Oh interesting. I used -loglevel debug -debug. I was seeing this information
stream #0:
keyframe=0
duration=0.000
dts=1133.449 pts=1133.533
size=103
*** 1 dup!
stream #0:
keyframe=0
duration=0.000
dts=1133.449 pts=1133.449
size=104
Until I finally received this message
*** drop!
I have posted my bug with libav
http://bugzilla.libav.org/show_bug.cgi?id=67
thanks for your help.
Try running avconv with a higher log level: -loglevel debug.
That should give you more data. Also, try -dump and -debug.
Are you sure it's not because you're hitting a storage cap?
I ran into this recently with ffmpeg while converting some oddly sized video clips to a "standard" 16:9 x264 & AAC streams inside a mp4 container. When that "Incompatible sample format 's16' for codec 'ac3', auto-selecting format 'flt'" message would show up, my ffmpeg process would frequently just hang indefinitely at 100% CPU use.
I finally found that the issue, at least in my case, was that because of the conversions I was doing (transcoding to an intermediary format then to the final, desired output), it was actually the number of audio stream channels that caused the encode process to hang. By telling ffmpeg to convert the audio stream to 2-channel, I was able to fix this issue permanently.
The same solution will probably apply to avconv. In the ffmpeg world (and because I'm stuck with an outdated version), I merely needed to add -ac 2 to my ffmpeg command and everything worked perfectly!
Hope that helps :)
Related
I get the error "No NVENC capable devices found" when trying a simple encoding like this, even skipping audio to make sure it's not an audio problem:
ffmpeg.exe -i input.mp4 -c:v hevc_nvenc -an out.mp4
I also tried with more details, like setting the pixel format, the preset, the rate-control, the format.
On the documentation page there:
https://trac.ffmpeg.org/wiki/HWAccelIntro
it says that if we get this error we should check for the pixel format. The video has yuv420p here and even specifying the format results in the same error.
i also checked the NVidia supported cards and it says GeForce, but no details about the models:
https://developer.nvidia.com/video-encode-decode-gpu-support-matrix#Encoder
I tried h264_nvenc and it works perfectly however, the problem is only with hevc_nvenc
Has anyone encountered this problem?
Complete console output:
[h264 # 0000000002534560] Reinit context to 1280x544, pix_fmt: yuv420p
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'input.mp4':
Metadata:
major_brand : isom
minor_version : 1
compatible_brands: isom
creation_time : 2014-05-23T13:04:15.000000Z
Duration: 01:54:03.95, start: 0.000000, bitrate: 3193 kb/s
Stream #0:0(und): Video: h264 (High), 1 reference frame (avc1 / 0x31637661), yuv420p(left), 1280x544 [SAR 1:1 DAR 40:17], 2750 kb/s, 23.98 fps, 23.98 tbr, 24k tbn, 47.95 tbc (default)
Metadata:
creation_time : 2014-05-23T11:25:27.000000Z
Stream #0:1(spa): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, 5.1, fltp, 439 kb/s (default)
Metadata:
creation_time : 2014-05-23T12:56:43.000000Z
Stream mapping:
Stream #0:0 -> #0:0 (h264 (native) -> hevc (hevc_nvenc))
Press [q] to stop, [?] for help
[h264 # 000000000260ea40] Reinit context to 1280x544, pix_fmt: yuv420p
[graph 0 input from stream 0:0 # 0000000003857ec0] w:1280 h:544 pixfmt:yuv420p tb:1/24000 fr:24000/1001 sar:1/1 sws_param:flags=2
[hevc_nvenc # 00000000038574e0] Loaded Nvenc version 8.0
[hevc_nvenc # 00000000038574e0] Nvenc initialized successfully
[hevc_nvenc # 00000000038574e0] 1 CUDA capable devices found
[hevc_nvenc # 00000000038574e0] [ GPU #0 - < GeForce GTX 950M > has Compute SM 5.0 ]
[hevc_nvenc # 00000000038574e0] Codec not supported
[hevc_nvenc # 00000000038574e0] No NVENC capable devices found
[hevc_nvenc # 00000000038574e0] Nvenc unloaded
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!
950M doesn't support h265 codec indeed.
From nvidia nvenc page or the detailed support matrix, we can learn that h265/hevc is supported only from 2nd generation maxwell GPU.
Also check the maxwell wiki page and list of NVIDIA GPU. You can see that 950M's code name is GM107 which is a 1st generation maxwell architecture, that means no h265 support. Sorry, you have to fall back to h264.
My Video file shows below meta-data with ffprobe/ffmpeg:
Duration: 00:44:27.52, start: 1333.760000, bitrate: 335 kb/s
Stream #0.0(und): Video: h264 (Main), yuv420p, 640x480, 25 tbr, 90k tbn, 50 tbc
Note: The file does not contain audio.
I am trying to convert this video file to other video file, using ffmpeg/avconv.
This works: (but encodes h.264 video to mpeg4)
ffmpeg -i input.mp4 output.mp4
& it generates output file of proper duration (44:27 - 1333 seconds = 22:14)
This does not work:
ffmpeg -i input.mp4 -vcodec copy output.mp4
Generates file without video.
The output contains:
$ avconv -i input.mp4 -vcodec copy output.mp4
avconv version 0.8.9-6:0.8.9-0ubuntu0.13.10.1, Copyright (c) 2000-2013 the Libav developers
built on Nov 9 2013 19:09:46 with gcc 4.8.1
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'input.mp4':
Metadata:
major_brand : dash
minor_version : 0
compatible_brands: iso6avc1mp41
creation_time : 2014-01-19 22:43:21
Duration: 00:44:27.52, start: 1333.760000, bitrate: 335 kb/s
Stream #0.0(und): Video: h264 (Main), yuv420p, 640x480, 25 tbr, 90k tbn, 50 tbc
Metadata:
creation_time : 2014-01-19 22:43:21
Output #0, mp4, to 'output.mp4':
Metadata:
major_brand : dash
minor_version : 0
compatible_brands: iso6avc1mp41
creation_time : 2014-01-19 22:43:21
encoder : Lavf53.21.1
Stream #0.0(und): Video: ![0][0][0] / 0x0021, yuv420p, 640x480, q=2-31, 90k tbn, 90k tbc
Metadata:
creation_time : 2014-01-19 22:43:21
Stream mapping:
Stream #0:0 -> #0:0 (copy)
Press ctrl-c to stop encoding
frame= 0 fps= 0 q=-1.0 Lsize= 0kB time=10000000000.00 bitrate= 0.0kbits/s
video:0kB audio:0kB global headers:0kB muxing overhead inf%
FFmpeg development is very active
When experiencing an issue it is best to get a new build of ffmpeg from FFmpeg to ensure that you are not encountering a bug that has already been fixed.
Ubuntu uses a fork
Ubuntu does not use ffmpeg from FFmpeg, but an old, fake version from a fork. See Who can tell me the difference and relation between ffmpeg, libav, and avconv?
Get ffmpeg
You can:
Simply download a build of ffmpeg, or
Follow a step-by-step guide to compile ffmpeg.
Using the build
The build is easy. You just download, extract, and execute (notice the ./ before ffmpeg):
wget http://ffmpeg.gusari.org/static/32bit/ffmpeg.static.32bit.$(date +"%F").tar.gz
tar xzvf ffmpeg.static.32bit.$(date +"%F").tar.gz
./ffmpeg -i input -codec copy -map 0 output
Compiling
Compiling ffmpeg allows you to customize it how you like. The compile guide is non-invasive and easy to undo.
Reporting a bug
If a recent build still has the suspected bug then you can get help at the ffmpeg-user mailing list, or perform a search at the FFmpeg Bug Tracker and report it if it is a new bug. If you report the bug make sure to:
Check that you are using a recent build.
Provide the complete ffmpeg command and the complete ffmpeg console output.
Provide all necessary samples.
Use the minimal command that still shows the issue.
Provide any additional information that is useful for others who will attempt to duplicate the issue.
When I try recording a screencast with Quicktime or Screenflow and then converting to .ogv for use on the web, I get this error many times:
$ ffmpeg2theora test.mov
[audioresample # 0x7fa903800ee0] Audio sample format conversion failed
The resulting test.ogv file does not play in VLC. I can use ffmpeg to successfully convert mov to mp4. Are there only certain audio types that ffmpeg2theora supports? ffmpeg2theora version 0.29
More output:
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'test.mov':
Metadata:
major_brand : qt
minor_version : 537199360
compatible_brands: qt
creation_time : 2013-08-26 20:50:37
Duration: 00:00:07.00, start: 0.000000, bitrate: 1458 kb/s
Stream #0:0(eng): Audio: aac (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 90 kb/s
Metadata:
creation_time : 2013-08-26 20:50:37
handler_name : Apple Alias Data Handler
Stream #0:1(eng): Video: h264 (Main) (avc1 / 0x31637661), yuv420p, 1920x1200, 1362 kb/s, 30 fps, 30 tbr, 3k tbn, 6k tbc
Metadata:
creation_time : 2013-08-26 20:50:37
handler_name : Apple Alias Data Handler
brew remove ffmpeg
brew install --with-theora --with-libvorbis ffmpeg
ffmpeg -i test.mov -c:v libtheora -c:a libvorbis -q:v 10 -q:a 10 test.ogv
You may be specifically interested in ffmpeg solution, but the Miro Video Convertor is another free OS X option that works great for converting mov to ogg.
I'm getting the error bitrate tolerance too small for bitrate so far no problem. I know that there are several switches to increase that but nothing works.
ffmpeg -y -r 1/30 -b:v 999999k -bt 999999k -maxrate 999999k -i in.flv out%03d.jpg
The source of that commandline is directly from ffmpeg. But that crashes:
ffmpeg version N-44123-g5d55830 Copyright (c) 2000-2012 the FFmpeg developers
built on Sep 2 2012 20:23:29 with gcc 4.7.1 (GCC)
[...]
Input #0, flv, from 'in.flv':
Duration: 00:05:00.13, start: 0.000000, bitrate: 259 kb/s
Stream #0:0: Video: flv1, yuv420p, 320x240, 1k tbr, 1k tbn, 1k tbc
Stream #0:1: Audio: nellymoser, 22050 Hz, mono, s16
[mjpeg # 04356860] bitrate tolerance too small for bitrate
[mjpeg # 04317540] ff_frame_thread_encoder_init failed
Output #0, image2, to 'out%03d.jpg':
Stream #0:0: Video: mjpeg, yuvj420p, 320x240, q=2-31, 200 kb/s, 90k tbn, 0.03 tbc
Stream mapping:
Stream #0:0 -> #0:0 (flv -> mjpeg)
Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height
Some ideas what I'm doing wrong?
I am trying to put a simple text on the bottom of video using ffmpeg on Ubuntu 12.04 . I tried this which is suggested in several places:
ffmpeg -i input.avi -vf drawtext="fontfile=/usr/share/fonts/truetype/ttf-dejavu/DejaVuSerif.ttf:text='Text to write':fontsize=20:fontcolor=black:x=100:y=100" output.avi
But I get this error each time:
ffmpeg version 0.8.3-4:0.8.3-0ubuntu0.12.04.1, Copyright (c) 2000-2012 the Libav developers
built on Jun 12 2012 16:37:58 with gcc 4.6.3
*** THIS PROGRAM IS DEPRECATED ***
This program is only provided for compatibility and will be removed in a future release. Please use avconv instead.
Input #0, avi, from 'input.avi':
Duration: 04:09:09.66, start: 0.000000, bitrate: 480 kb/s
Stream #0.0: Video: mpeg4 (Advanced Simple Profile), yuv420p, 320x240 [PAR 1:1 DAR 4:3], 45 tbr, 45 tbn, 45 tbc
Stream #0.1: Audio: mp3, 48000 Hz, stereo, s16, 64 kb/s
[buffer # 0x860d5a0] w:320 h:240 pixfmt:yuv420p
Incompatible sample format 's16' for codec 'ac3', auto-selecting format 'flt'
[ac3 # 0x8607a00] invalid bit rate
Output #0, avi, to 'output.avi':
Stream #0.0: Video: mpeg4, yuv420p, 320x240 [PAR 1:1 DAR 4:3], q=2-31, 200 kb/s, 90k tbn, 45 tbc
Stream #0.1: Audio: ac3, 48000 Hz, stereo, flt, 200 kb/s
Stream mapping:
Stream #0.0 -> #0.0
Stream #0.1 -> #0.1
Error while opening encoder for output stream #0.1 - maybe incorrect parameters such as bit_rate, rate, width or height
Appreciate your help.
The documentation shows that you can use other parameters with x or y such as input video height and width and text width and height. To place the text on the bottom one method is y=main_h-text_h. If you want a little padding on the bottom you can use y=main_h-(text_h*2) To center it horizontally use x=(main_w/2-text_w/2).