FFMpeg printing "Option pixel_format not found" when using "pix_fmt" - ffmpeg

I'm trying to do a relatively simple task - convert a video from one pixel format to another by re-encoding. This is my current command:
ffmpeg -hide_banner -loglevel error -pix_fmt yuv444p -i "%1" video.mp4
Where %1 is the filename. However, strangely enough, ffmpeg prints out this:
Option pixel_format not found.
It's in red, so it's an error. Adding -loglevel verbose does not give any more information. I'm really confused about this - I did not define any "pixel_format" option. This issue occurs both when calling this command from a batch file and directly from a cmd.exe instance.
Replacing "pix_fmt" with "pixel_format" and putting pix_fmt after -i does not solve the issue.

You're trying to read the input file forcibly with yuv444p. Try
ffmpeg -hide_banner -loglevel error -i "%1" -pix_fmt yuv444p video.mp4
The h264 decoder does not support user-specified pixel format thus the error: Option pixel_format not found. The default h264 encoder (libx264) on the other hand allows -pix_fmt option to specify the output pixel format.

Related

ffmpeg watermark: scale2ref output can't be used in second overlay

I was able to add a watermark to 2 position(top left & bottom right) of a video with scaling image height to tenth of the video height in one command
ffmpeg -hide_banner -i /path/to/input.mp4 -i /path/to/watermark.jpg -filter_complex "[1:v][0:v]scale2ref=oh*mdar:ih/10[logo-out][video-out];[video-out][logo-out]overlay=10:10[flag];[1:v][flag]scale2ref=oh*mdar:ih/10[logo-out2][video-out2];[video-out2][logo-out2]overlay=W-w-10:H-h-10" -c:a copy /path/to/output.mp4
But the above command is too redundant, so I remove the second scale2ref
ffmpeg -hide_banner -i /path/to/input.mp4 -i /path/to/watermark.jpg -filter_complex "[1:v][0:v]scale2ref=oh*mdar:ih/10[logo-out][video-out];[video-out][logo-out]overlay=10:10[flag];[flag][logo-out]overlay=W-w-10:H-h-10" -c:a copy /path/to/output.mp4
But sadly, error occurs
[mov,mp4,m4a,3gp,3g2,mj2 # 0x7fb195013c00] Invalid stream specifier: logo-out.
Last message repeated 1 times
Stream specifier 'logo-out' in filtergraph description [1:v][0:v]scale2ref=oh*mdar:ih/10[logo-out][video-out];[video-out][logo-out]overlay=10:10[flag];[flag][logo-out]overlay=W-w-10:H-h-10 matches no streams
I know error occurs because of the first overlay didn't set an image output specifier, but it seems we can't do this? I only know overlay can set a video stream specifier.
How can I use the [logo-out] specifier which output from scale2ref in the second overlay?
An output generated inside a filtergraph can only be consumed once. To reuse it, split it first.
ffmpeg -hide_banner -i /path/to/input.mp4 -i /path/to/watermark.jpg -filter_complex "[1:v][0:v]scale2ref=oh*mdar:ih/10[logo-out][video-out];[logo-out]split=2[logo-left][logo-right];[video-out][logo-left]overlay=10:10[flag];[flag][logo-right]overlay=W-w-10:H-h-10" -c:a copy /path/to/output.mp4

ffmpeg converting from mkv to mp4 without re-encoding

I am using ffmpeg to switch container from mkv to mp4 via this command:
ffmpeg -i filename.mkv -vcodec copy 1.mp4
this is the simplest command that I found when converting from mkv container to mp4 without re-encoding. The output stated otherwise (if I am not mistaken)
This is a small screen shot of the the output:
Where it said Stream Mapping, #0:0 (264 (native)) -> 264 (libx264)). Does this mean that it's re-encoding from x264 to libx264? What Did I do wrong?
Any help is appreciated...
problem solved, specify the audio codec solve my problem...
ffmpeg -i filename.mkv -vcodec copy -acodec copy 1.mp4
Remuxing containers, e.g. MKV or AVI to MP4, with FFmpeg will only keep a single – it tries to choose the best one available – audio and video stream from the input file in the output file. This can be avoided by providing -map 0.
Matroska files frequently contain subtitles in a format not supported in MOV/MPEG containers by FFmpeg, esp. SRT/Subrip or ASS/SSA. They can either simply be dropped with -sn or be converted to a native format like mov_text. (You could also burn hard subtitles into a video stream with filters.)
Sometimes, adding missing information by using heuristics might help. This is activated with -find_stream_info, but I am not sure whether this should be used by default.
I shall assume that built configuration is not important to know (-hide_banner) and only serious problems should be logged to the console (-loglevel warning, alternatively: quiet | panic | fatal | error | warning | info (default) | verbose | debug | trace).
Therefore, a rather universal conversion command looks like this:
$ ffmpeg -find_stream_info -i input.mkv \
-map 0 -codec copy -codec:s mov_text output.mp4 \
-hide_banner -loglevel warning; \
rm input.mkv
For batch processing multiple files on a Windows box within cmd and overwriting existing files (-y), use for:
FOR /r %F IN (*.mkv) DO (#ffmpeg \
-find_stream_info -i "%F" \
-map 0 -codec copy -codec:s mov_text "%~pnF.mp4" \
-hide_banner -loglevel warning -y)
ffmpeg.exe -i input_file_name.mkv output_file_name.mp4
It converts to mp4 but it making a bigger size. :)
For those who use Windows and want to convert a directory of MKV files, throw this batch file in the same directory and execute it:
#ECHO OFF
FOR %%F IN (*.mkv) DO (
ffmpeg -i %%~nF.mkv -acodec copy -vcodec copy %%~nF.mp4
)
Some context in case anyone else is facing the same:
I'd previously recorded my desktop using OBS; the mkv file wasn't accepted by Sony Vegas. I ran the above batch which called ffmpeg on each of the captures and the resultant MP4s were accepted by Sony Vegas.

How to get a lossless encoding with ffmpeg - libx265

I would like to convert 16 bits grayscale images in an HEVC/mkv video with the x265 encoder without loss, using ffmpeg. I use the monochrome12 profile. My first step is to convert images into yuv format:
ffmpeg -f image2 -i "C:\DATA FOLDER\images%d.png" video.yuv
And I try to convert it as a .mkv file, losslessly:
ffmpeg video.yuv video.mkv -c:v libx265 -x265-params "profile=monochrome12:crf=0:lossless=1:preset=veryslow:qp=0"
But I get
Unrecognized option '-lossless'
Error splitting the argument list : Option not found
When I don't write lossless=1 everything's right, but I don't manage to have a lossless video by this way.
thank you for your help.
It works for me if I make a few changes:
ffmpeg -i video.avi -c:v libx265 \
-x265-params "profile=monochrome12:crf=0:lossless=1:preset=veryslow:qp=0" \
video.mkv
This is like the command you've provided, except I'm using a different input format, and prepend -i to mark it as an input file.
I also put the output filename at the end, after the output options, otherwise they are not applied, and I get this warning among the output:
Trailing options were found on the commandline.
I don't think the command you gave would cause the error you get though.
libx265 will not give an error on params it doesn't recognise, but show a warning like:
[libx265 # 0x563e4520e740] Unknown option: lessloss.
I can reproduce your exact error by trying to add --lossless as a parameter to ffmpeg:
ffmpeg --lossless -i video.avi video.mkv
Unrecognized option '-lossless'.
Error splitting the argument list: Option not found

Error setting option pix_fmt to value -1: Pipe a mp4 video with ffmpeg

I was piping a mp4 file and always got Error setting option pix_fmt to value -1.
I was trying to put -pix_fmt option in front of '-i inputfile', as in the ffmpeg output I found a message: unspecified pixel format but it seems not work
The ffmpeg outpus is here: http://pastebin.com/8hNdLeQ2
By the way, the ffmpeg version I was using is the latest one from git repo
And the mp4 video clip is from a sumsung tablet.
The command I use:
$ cat b2.mp4 | ./ffmpeg -i pipe:0 -c:a copy a.mp4
I also tried:
The video is at: https://www.dropbox.com/s/oz0e51ggkbpgj0f/b2.mp4
Anyone can tell me how to pipe this mp4 video, Thanks,
Lewis

ffmpeg speed up video - Windows

In manual it says:
ffmpeg -i input.mkv -filter:v 'setpts=0.5*PTS' output.mkv
But when I run:
ffmpeg -i input.mp4 -filter:v 'setpts=0.5*PTS' speedup.mp4
I get an error:
[AVFilterGraph # 0000000002500600] No such filter: 'setpts=0.5*PTS'
Error opening filters!
Not sure if it means that filter can't be opened at all or simply this filter is not available.
How do I run it correctly? Or maybe my release does not support it, then where can I get the release that would work right? Win32/x64 binary
Use both setpts and atempo to speed up both video and audio:
ffmpeg -i input-video.mp4 -vf "setpts=0.68*PTS" -filter:a "atempo=1.467" output-video.mp4
From: https://trac.ffmpeg.org/wiki/How%20to%20speed%20up%20/%20slow%20down%20a%20video
You'll have to do the right math for the numbers, of course. The setpts needs to be smaller to make the video go faster, but atempo needs to be larger to speed up the audio.
Audio value needed = 1 / Video value
if you have your ffmpeg.exe (mine for windows) for ex you can list all the available filters with this command line, you can edit the txt file c:\filters.txt to see them.
ffmpeg -filters > c:\yfilters.txt
in mine i can se the filter SETPS (VIDEO TO VIDEO only):
setpts V->V Set PTS for the output video frame.
your command line is correct and work with the ffmpeg version that have this filter(try to download the latest version)
this command line works also for me :
ffmpeg -i video_input -vf "setpts=factor*PTS" video_output
the factor can be :
1.for speeding the video 0.2,0.4,0.6,0.8..(<1)
2.for slowing the video:1.2,1.4,1.6,1.8,2.0,3.0,4.0,5.0,10.0... (>1)
Try using double quotes. e.g. ffmpeg -i input.mp4 -filter:v "setpts=0.5*PTS" speedup.mp4

Resources