Missing of image when conversion from flv to 3gp - ffmpeg

I use in command line for ffmpeg
-i Input.flv -vcodec h263 -b 256k -r 15 -s 320x240 -acodec libopencore_amrnb \
-ab 7.4k -ar 8000 -ac 1 -f 3gp Output.3gp
The result is audio-only, without video. But when the 176x144, it works great.
What's wrong in using of frame size (320x240)? And what is the solution?

Are you sure there is no video in the resulting Output.3gp file? Is it possible that the end device does not support 320x240?
It would help significantly if you were to include the entire FFmpeg output in your question.

Related

Is there a way to pipe input video into ffmpeg?

ffmpeg -f avfoundation -i "1:0" -vf "crop=1920:1080:0:0" -pix_fmt yuv420p -y -r 30 -c:a aac -b:a 128k -f flv rtmp://RTMP_SERVER:RTMP_PORT/STREAM_KEY
Hello guys, the above command works pretty well. It records the audio/video of the computer. But what I want to do is pipe a repeating video or image(png/jpeg/gif), so that there is no live video feed from the computer, but just the image on the stream with the audio.
How would you go about doing this?
Also, if you know any programming interfaces that can do this same thing, please give suggestions. Because I would rather not use a CLI.
I think you should be able to achieve this by using -loop and some -map:ing. I can't test with avfoundation myself but something like this works for me:
ffmpeg -loop 1 -i image.png -i file_to_take_audio_from.mp4 -vf "scale=1920:1080:0:0" -pix_fmt yuv420p -r 30 -c:a aac -b:a 128k -map 0:v -map 1:a output.mp4
Replace -i file_to_take_audio_from.mp4 with -f avfoundation -i "1:0" and output.mp4 with -f flv rtmp://RTMP_SERVER:RTMP_PORT/STREAM_KEY.
Also you might be able to skip -vf if the image has correct resolution.
Hope that helps!
Use none or no value at all (:0) for the video device index and provide a secondary input:
ffmpeg -f avfoundation -i :0 -i image.png ...
There's a loop option for images such as animated GIFs and -stream_loop for input streams.
You can use the FFmpeg APIs directly instead of CLI.

How to overlay a png to piped video source with audio mixed in via ffmpeg?

I'm successfully streaming silent video with music added from my Raspberry Pi (Raspbian) to YouTube via ffmpeg, with the help of this GitHub gist and this post:
raspivid -o - -t 0 -vf -hf -w 1280 -h 720 -fps 25 -b 4000000 | \
ffmpeg -i music.wav \
-f h264 -i - -vcodec copy -acodec aac -ab 128k -g 50 -strict experimental \
-f flv rtmp://a.rtmp.youtube.com/live2/STREAMKEY
The last step of my project to add a transparent, full width/height png overlay to the video (1280x720 size in my case). I've seen a few related answers such as this one and this one.
With the added complexity of piping in a camera feed, mixing in an audio source and outputting to a video stream, I haven't succeeded in adding the image overlay. Where/how would I add a transparent image overlay in the example above?
The ffmpeg part will be
ffmpeg -i music.wav \
-f h264 -i - -i overlay.png
-filter_complex "[1][2]overlay"
-vcodec libx264 -preset ultrafast -tune zerolatency -acodec aac -ab 128k -g 50 -strict experimental \
-f flv rtmp://a.rtmp.youtube.com/live2/STREAMKEY
Since you're altering the video contents, copy can't be used, and the video has to be re-encoded.

Videos converted using FFMPEG do not have video duration information

I am using FFMPEG to convert uploaded videos to .flv, after conversion the flv video doesn't have information about it's duration. So the user cannot rewind/forward, replay or see a specific part of it. The code is as follows:
"ffmpeg -i $srcfile_path -s 320x240 -ar 44100 -b 2048k -r 12 $desfilepath";
Please help. Thanks in advance.
I ran the following command and it worked.
"ffmpeg -i $srcfile_path -f flv - | flvtool2 -U stdin $desfilepath"
This requires flvtool installed on your system. I am using an FFMPEG and FLVTOOL2 enabled server, so it worked.
That's very strange, I have been using ffmpeg to convert videos from one format to another without any issues. See example below:
ffmpeg -i input.avi -b:a 192K -b:v 2400 -s hd720 -c:v mpeg2video output.mpg
I am sure you know the syntax.

How to get better quality converting MP4 to WMV with ffmpeg?

I am converting MP4 files to WMV with these two rescaling commands:
ffmpeg -i test.mp4 -y -vf scale=-1:360 test1.wmv
ffmpeg -i test.mp4 -y -vf scale=-1:720 test2.wmv
I've also tried:
ffmpeg -g 1 -b 16000k -i test1.mp4 test1.wmv
However, the .wmv files that are produced are "blocky and grainy" as you can see here in a small section of a video screenshot:
These are the sizes:
test.mp4 - 106 MB
test1.wmv - 6 MB
test2.wmv - 16 MB
How can I increase the quality/size of the resulting .wmv files (the size of the .wmv files is of no concern)?
Consider the following command instead (some outdated commands in the final answer section):
ffmpeg -i test.mp4 -c:v wmv2 -b:v 1024k -c:a wmav2 -b:a 192k test1.wmv
REFERENCES
https://askubuntu.com/questions/352920/fastest-way-to-convert-videos-batch-or-single
You can simply use the -sameq parameter ("use same quantizer as source") which produces a much larger sized video file (227 MB) but with excellent quality.
ffmpeg -sameq -i test.mp4 -y -vf scale=-1:360 test1.wmv
In newer versions of ffmpeg flag '-sameq' has been removed. To achieve similar results one should use 'qscale' flag with 0 value:
ffmpeg -sameq -i test.mp4 -qscale 0 -vf scale=-1:360 test1.wmv
Working answer in 2020, producing an output video without blockiness:
ffmpeg -i input.mp4 -q:v 1 -q:a 1 output.wmv
One thing I discovered after many frustrating attempts of enhancing the final quality was that if you don't specify a bitrate, it'll use a quite low average. Try -b 1000k for a starting point, and experiment increasing or decreasing it until you reach the desired result. Your file will be quite bigger or smaller, accordingly.
I used this and it turned out quite well
ffmpeg -i "file1.mp4" -q:v 0 -c:v wmv2 -b:v 1024k -c:a wmav2 -b:a 192k test2.wmv

ffmpeg, conversion to flv: how to get better quality?

I am using ffmpeg to convert any avi/wmv videos to flv.
My trouble is that the flv result is quite poor: it gives me big pixelitaed boxes.
I tried to use some -b parameters with no good results:
ffmpeg -i 1268459654.wmv -ar 22050 -ab 32 -f flv -s 640x480 x.flv
ffmpeg -i 1268459654.wmv -ar 22050 -ab 32 -f flv -s 640x480 -b 500k x.f4v
I also tried
ffmpeg -i 1268459654.wmv -vcodec libx264 -s 360x240 x.mp4
ans got: "Unknown encoder 'libx264'"
Any solution for that ?
libx264 does not come pre-installed (licensing issues I believe) if you've downloaded it via yum/RPM. You'll need to download the source and compile it yourself and specify libx264. Here's a command line I've used in the past with decent results, and I would consider the MP4 Container over the dated, FLV format personally.
ffmpeg -i (file) -acodec libfaac -ab 44k -vcodec libx264 -vpre normal -crf 30 -threads 0
Make note of the "-vpre normal", as you should have some presets available under:
/usr/share/ffmpeg/libx264-normal.ffpreset or similar.
More details on compiling from source.

Resources