I have a problem and I hope someone can help:
I'm trying to convert 287000 jpegs into a video. I tried the following command:
avconv -r 360 -i img%06d.jpg -r 30 out.mkv
But I also tried it without the framerate options with the same result:
img%06d.jpg: Input/output error
Does anyone have any idea why this is? The images are all the same format, resolution, etc... but maybe some are corrupt. If this could be the reason for stopping the conversion, is there an option to drop corrupt input images automatically?
Related
I want to use ffmpeg to trim some mp3s without re-encoding. The command I used was
ffmpeg -i "inputfile.mp3" -t 00:00:12.414 -c copy out.mp3
However, out.mp3 has a length of 12.460s, and when I load the file in Audacity I can see that it was cut at the wrong spot, and not at 12.414s.
Why is this? I googled a bit and tried some other commands like ffmpeg -i "inputfile.mp3" -ss 0 -to 00:00:12.414 -c copy out.mp3 (which interestingly results in a different length of 12.434s) but could never get the milliseconds to be cut right.
PS. I wasn't sure whether SO was the right place to ask since it isn't technically programming related, however most of the stuff I found on ffmpeg for trimming audio files were stackoverflow questions, e. g. ffmpeg trimming videos with millisecond precision
You can't trim MP3 (nor most lossy codec output) with that level of precision. An MP3 frame or so of padding is added during encoding. (See also: https://wiki.hydrogenaud.io/index.php?title=Gapless, and all the hacks required to make this work.)
If you need precision timing, use something uncompressed like PCM in WAV, or a lossless compression like FLAC.
On Linux you can use mp3splt:
mp3splt -f mp3file.mp3 from to -o output file format
Example:
mp3splt -f "/home/audio folder/test.mp3" 0.11.89 3.25.48 -o #f_trimmed
this will create a "/home/audio folder/test_trimmed.mp3"
For more info to the parameters, check the mp3splt man page here
On Windows you can use mp3DirectCut
mp3DirectCut has a GUI, but it also have command line support
I'm trying to remove a logo from an .mp4 video file with ffmpeg on linux machine without re-encoding (for preserving the same quality) with the following command:
ffmpeg -i input.mp4 -vf delogo=x=270:y=190:w=40:h=40 -c:a copy output.mp4
and it gives me the following errors:
Unrecognized option 'vf'
then a new error came up:
Unable to find a suitable output format for 'delogo=x=270:y=190:w=40:h=40'
ffmpeg is always updating and it seems that they change command line arguments a lot so any material or tutorial I find online seems to get outdated quickly ...
I reviewed the documentation but can't get it to work, I think I'm missing something...?
So: What is the correct command line in linux shell? Also, how to view or find out the exact coordinates of the area to be removed before actually removing the logo? And how can I overlay a solid color in a certain area instead of removing the logo transparently?
Unrecognized option 'vf'
What version of ffmpeg? (You should be able to tell from the output of running just "ffmpeg" without arguments.) My guess is that you have a terribly old version, "-vf" is still current syntax.
put the delogo phrase in quotation marks: "delogo=x=270:y=190:w=40:h=40"
I am attempting to convert a directory full of .bmp files into a .mp4 file (or similar format).
The bitmap files have the following name scheme:
output_N_1024.bmp
Where N is an integer in the range 0 to 1023. (No zero padding / fixed width.)
The command I am using is:
avconv -r 25 -i output_{0..1023}_1024.bmp outputfile.mp4
This appears to run okay, and takes about a minute to convert all 1024, 1024 by 1024 resolution - (confusing?) bitmap images into a new file, outputfile.mp4.
However, when I attempt to open this file with VLC, a black window briefly flashes up and then closes. VLC then goes back to its mode where it waits for you to tell it which file to open next. No error or warning messages appear from VLC, which seems kind of strange since it seems to be refusing to play.
What can I do to fix this? Perhaps my converting command is incorrect?
The problem most likely is that you haven't actually passed the command to encode these files to avconv. This has happened because your shell has expanded the filenames already.
The command i have just managed to get to work on my machine is:
avconv -r 2 -i "%d.bmp" -s 600x400 -an out.ogv
Also for whatever reason it didn't want to work without explicitely giving it the size, but i don't think this is your problem.
In here quotes tell your shell not to touch this string. %d means digits from 1 to whatever the last file is (if you would want them to be 0-padded this would look like %000d to have maximum of three naughts in front).
VLC has then opened and ran my file just fine.
I am trying to convert midi files to ogg or mp3. Eventually this will happen on a linux webserver but currently I am using a Windows 7 machine. I am using timidity to convert the midi to wav and then either sox or ffmpeg to convert the wav to ogg/mp3.
When I use an intermediate file the process works fine (in the first line below timidity creates file.wav)
timidity.exe file.mid -Ow
sox.exe file.wav file.ogg
However, when I try to pipe the timidity output into sox (as below), the resulting file ogg is horribly distorted
timidity.exe file.mid -Ow -o - | sox.exe -t wav - file.ogg
and I get a warning
sox.exe WARN wav: Premature EOF on .wav input file
I also get the same distortion problem when I replace sox with ffmpeg (and the appropriate command line options), or when I replace ogg with mp3 as the output format.
So what am I doing wrong?
Thanks,
Chris
Regarding the warning itself, you're doing nothing wrong. You may also see a warning from timidity that reads something like
Warning: -: Illegal seek: Can't make valid header
What's happening there is explained in the timidity manual page:
If output is directed to a non-seekable file, or if TiMidity++ is interrupted before closing the file, the file header will contain 0xffffffff in the RIFF and data block length fields.
Note that RIFF is the encoding format commonly called by its file extension, .wav. When timidity writes a RIFF file, it doesn't know how long the file will be, so it writes some placeholder junk in the header and moves on to writing the data. When it finishes with the data, it knows how long the file is, so it goes back to the beginning of the file and writes over that junk in the header. When you write to a pipe, it has no way to go back and rewrite anything: the downstream program has to handle the placeholder junk. Also from the timidity manual page:
The popular sound conversion utility sox is able to read such malformed files, so you can pipe data directly to sox for on-the-fly conversion to other formats.
Thus, the message you mentioned. Sox is informing you that the chef prepared the file wrong BUT SOX IS HAPPY TO EAT IT ANYWAY BECAUSE SOX IS NOT PICKY. Sox is apparently passive-aggressive. Who knew?
You can ignore those warning messages, because now they are telling you something you already know. Or, you can use a raw format and explicitly tell timidity and sox how to play well with one another:
timidity file.midi -Or1Ssl -s44.1 -o- | sox -t raw -b 16 -e signed -r 44.1k -c 2 - file.ogg
As for the distortion, that may be caused in part by quirks in the audio libraries on the Windows system. I note that the pipeline in the question, sans .exe extensions, produces output with no notable distortion on a linux system. Using a well-defined raw format in the pipeline may also help with that issue.
Note that for Ogg output, you can now get that directly from timidity:
timidity file.midi -o file.ogg -Ov
I am trying to play yuv file in mplayer, it working fine till yesterday. But now i tried to play,its not working. It is trying to playback,i didnt see a visualization. While it's working,i didnt got this
Could not find matching colorspace - retrying with -vf scale...
Opening video filter: [scale]
Movie-Aspect is undefined - no prescaling applied.
as now i am getting.Can any body tell me what will be the reason? I am using this command
mplayer -demuxer rawvideo -rawvideo w=176:h=144:format=i420 a.yuv -loop 0
Play the *.yuv file in a manner. I am not too sure that this will run but try this.
In the command w & h should be exactly mention as it is in *.yuv file.
mplayer a.yuv -demuxer rawvideo -rawvideo w=352:h=288
I have a yuv 4:2:0 file, with format:i420 it gives the same error. it works with "mplayer -demuxer rawvideo -rawvideo w=352:h=288:format=yv12 a.yuv". you may try with format "yv12, yuy2, y8", if you are not sure the video colorspace.