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.
Related
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 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?
This question already has answers here:
Using ffprobe to check if file is audio or video only
(5 answers)
Closed 5 years ago.
I'm trying to figure out if a video has audio present in it so as to extract the mp3 using ffmpeg. When the video contains no audio channels, ffmpeg creates an empty mp3 file which I'm using to figure out if audio was present in the video in the first place. I'm sure there is a better way to identify if audio is present in a video. Will avprobe help with this? Can anyone point me to a resource or probably a solution?
Edit: Surprisingly, the same command on my server running the latest build of ffprobe doesn't run. It throws an error saying
Unrecognized option 'select_stream'
Failed to set value 'a' for option 'select_stream'
Any ideas how to rectify this out?
I would use FFprobe (it comes along with FFMPEG):
ffprobe -i INPUT -show_streams -select_streams a -loglevel error
In case there's no audio it ouputs nothing. If there is an audio stream then you get something like:
[STREAM]
index=0
codec_name=mp3
codec_long_name=MP3 (MPEG audio layer 3)
profile=unknown
codec_type=audio
codec_time_base=1/44100
etc
etc...
[/STREAM]
That should be easy enough to parse regardless of the language you're using to make this process automated.
If it is normal video file from the local path, you can do something like this to find whether video has audio file or not.
You need to look into the MediaMetadataRetriever
By using METADATA_KEY_HAS_AUDIO you can check whether the video has the audio or not.
private boolean isVideoHaveAudioTrack(String path) {
boolean audioTrack =false;
MediaMetadataRetriever retriever = new MediaMetadataRetriever();
retriever.setDataSource(path);
String hasAudioStr = retriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_HAS_AUDIO);
if(hasAudioStr.equals("yes")){
audioTrack=true; }
else{
audioTrack=false; }
return audioTrack;
}
Here path is your video file path.
PS: Since it is old question , i am writing this answer to help some other folks , to whom it may help.
Found a round about to solve this problem. This seems to answer the question I asked.
ffprobe -i input.mp4 -show_streams 2>&1 | grep 'Stream #0:1'
ffprobe -v fatal # set log level to fatal
-of default=nw=1:nk=1 # use default format and hide wrappers and keys
-show_streams # show info about media streams
-select_streams a # show only audio streams
-show_entries stream=codec_type # show only stream.codec_type entries
video.mp4 # input file
A media file contains an audio stream returns:
audio
1
0
0
0
0
0
0
0
0
0
0
0
und
SoundHandler
A media file contains no audio stream retuns empty result.
A non-media file also returns empty result. If you want to return an error message for non-media files and on any other error case, use -v error instead:
ffprobe -v error # set log level to error
-of default=nw=1:nk=1 # use default format and hide wrappers and keys
-show_streams # show info about media streams
-select_streams a # show only audio streams
-show_entries stream=codec_type # show only stream.codec_type entries
video.mp4 # input file
So, you take this instead of empty result:
non-media-file.zip: Invalid data found when processing input
If you only want to know if there is audio and don't care about the stream details you can run the following command, which will extract the duration of the audio stream in the input file. If the response is null/whitespace the input file has no audio in it.
Command:
ffprobe -v error -of flat=s_ -select_streams 1 -show_entries stream=duration -of default=noprint_wrappers=1:nokey=1
In a command line, if I run:
ffmpeg -i inputVideo.mp4 -vn -f mp4 -acodec copy outputAudio.aac
everything works perfectly fine.
However if I do the same thing, except standard out instead of the output file ("pipe:1" instead of "outputAudio.aac") then I get this error:
"Could not write header for output file #0 (incorrect codec parameters ?)"
Help from anyone with ffmpeg experience is greatly appreciated
Thanks
Well the trouble is you are asking for a mp4 file with a filename of outputAudio.aac. So if you check outputAudio.aac it is actually a mp4 file. To write mp4 files ffmpeg will need a seekable file descriptor which stdout is not. [this is because mp4 moov atom is written at the end in the beginning of the file.
If you want aac to be dumped to stdout you should ask for a adts file
ffmpeg -i input.mp4 -acodec copy -vn -f adts -strict -2 -
If you need it in a mp4.. mux it after that into a file
mp4 is not a streaming format: see here Fix 3GP file after streaming from Android Media Recorder for my answer to a different question which explains this.
I have been trying to get lots of wav files delayed by 2 seconds at the start using ffmpeg. And so far, even though I have read the manual, I was not able to get it working. Here is my command:
for %%A in (*.wav) do (
ffmpeg -i "%%A" -itsoffset 00:00:02 "%%~NA"1.wav )
And nothing is being changed. Files are simply getting copied. I also tried the same with mp3 files. I also tried mkv and avi (to make sure it was not a container writing issue), but it gives the same result also.
Command is same here and here, but it does not work. Please, help.
You must put -itsoffset BEFORE you specify input. So:
ffmpeg -itsoffset 00:00:02 -i "%%A" "%%~NA"1.wav
Changing the input time offset like that isn't going to do anything noticeable for a single stream, it's meant for fixing out-of-sync issues between audio and video streams.
Do you want to tack on two seconds of silence at the start? If so, one simple way that'd work (although it may feel a bit hackish) is to simply tack on a 2 second WAV full of silence, before the actual input. This would be accomplished by simply adding another -i option before the actual file:
ffmpeg -i 2secsilence.wav -i "%%A" "%%~NA"1.wav
I know this question is over 9 months old, but I came across it and wanted to add some more information about '-itsoffset'. From the ffmpeg trouble ticket pages (https://ffmpeg.org/trac/ffmpeg/ticket/1349):
This command should display file1 content one second earlier than file2 content:
ffmpeg -itsoffset -1 -i file1.ts -i file2.ts -vcodec copy -acodec copy -map 0:0 -map 1:1 out.ts
1) What I see is that -itsoffset adds or subtracts from all the timestamps (both the video and audio streams) in a file. So this option is only going to be useful when remuxing from separate input files.
2) outfile has expected playback behavior with .ts and .mkv containers.
3) It does not work with .avi (no timestamps, so not a surprise)
4) It does not work with .mp4 container (a bug?)
And that is where this issue stands as of today.