Error Converting MOV to MP4 with avconv - mp4

I use:
avconv -i '/INPUT.MOV' -vcodec libx264 -vprofile baseline -acodec aac \
-strict experimental -r 24 -b 255k -ar 44100 -ab 59k 'OUTPUT.mp4'
The conversion is done correctly and smoothly plays PC / MAC, but the video does not play on mobile devices.
Does anyone have the same problem? How to solve it?

-strict experimental goes before -acodec.
In your script it is written after -acodec
Best regards,
Tomás Hernández

Related

Raspberry Pi libcamera-vid to Youtube

I'm setting up a nature cam using a Raspberry Pi 4 livestreaming to Youtube. I can live stream video to Youtube using:
raspivid -o - -t 0 -w 1280 -h 720 -fps 25 -b 4000000 -g 50 | ffmpeg -re -ar 44100 -ac 2 -acodec pcm_s16le -f vs16le -ac 2 -i /dev/zero -f h264 -i - -vcodec copy -acodec aac -ab 128k -g 50 -strict experimental -f flv rtmp://a.rtmp.youtube.com/live2/<mykey>
but this requires legacy support to be enabled - which means I can't remote to my pi using VNC. I can use Putty to run the raspivid command, but I then need to have another computer running Youtube in a browser to enable the live stream. I'd rather just have the Pi do this, but I can't open Chromium from the Putty command line. If I turn off legacy support, I can use VNC and run Chromium, but I can't run Raspivid. libcamera-vid is meant to replace Raspivid, but I have not found anything that tells me what settings to use.
libcamera-vid -o - -t 0 --width 854 --height 480 --brightness 0.1 --inline --autofocus --framerate 25 -g 50 | ffmpeg -f lavfi -i anullsrc -thread_queue_size 1024 -use_wallclock_as_timestamps 1 -i pipe:0 -c:v copy -b:v 2500k -f flv rtmp://a.rtmp.youtube.com/live2/mykey
gives errors, particularly around audio settings (my Pi isn't recording audio).
I'd be grateful if someone could give me a newbies guide to converting Raspivid commands to Libcamera-vid!
Thanks
Thanks
Yes, you have to define null audio like this -i anullsrc=channel_layout=stereo:sample_rate=44100
So I have something similar to you:
libcamera-vid --inline --nopreview -t 0 --width 640 --height 480 --framerate 15 --codec h264 -o - | ffmpeg -f lavfi -i anullsrc=channel_layout=stereo:sample_rate=44100 -thread_queue_size 1024 -use_wallclock_as_timestamps 1 -i pipe:0 -c:v copy -c:a aac -preset fast -strict experimental -f flv rtmp://0.0.0.0:1935/live/1

ffmpeg monochrome rawvideo

I am trying to generate a raw video stream with luma only (monochrome, YUV400) 8bit pixel data using the following command:
ffmpeg -i input.mp4 -vcodec rawvideo -pix_fmt raw.yuv
After that I want to h.264 encode the raw stream with the profiles that support monochrome pixel data (eg: high)
ffmpeg -f rawvideo -vcodec rawvideo -pix_fmt gray -s 640x512 -r 60 -i raw.yuv -codec:v libx264 -profile:v high -c:a copy out.mp4
However, i always get the following error, which indicates that the raw stream is not in the monochrome format that I expected:
x264 [error]: high profile doesn't support 4:4:4
I am new to ffmpeg and video formats in general. Can somebody please point out what I am missing?
Thank you!
Edit:
I also tried to use the following filter to extract only the luma channel. Unfortunately, the end result was the same.
ffmpeg -i input.mp4 -vcodec rawvideo -pix_fmt gray -filter_complex 'extractplanes=y[y]' -map '[y]' raw.yuv
The ffmpeg version installed was quite old (3.4.7). After installing 4.2.3 everything worked fine.

FFmpeg - Down-mix AC3 5.1 to Fraunhofer FDK ACC 2.1

I'm trying to re-encode some of my old videos to "archive" them.
I do not need to keep the audio 5.1, but I would like to down-mix it to 2.1 instead of Stereo which sounds just too dull.
This is the relevant part which takes care of the down-mix to Stereo and re-encodes the audio, I would like to adjust it to down-mix to 2.1.
-ac 2 -c:a libfdk_aac -vbr 3
I did some research and it seems that there is a -layouts switch which does support 2.1, but I don't know, how to use it. What channel should go where?
Just for illustration and for you to get the whole picture - I'm currently using this script:
#!/bin/bash
for i in *.mkv;
do
#Output new files by prepending "x265" to the names
/cygdrive/c/media-autobuild_suite/local32/bin-video/ffmpeg.exe -y -i "$i" -c:v libx265 -preset slow -b:v 512k -x265-params pass=1 -c:s copy -c:a copy -f matroska NUL && \
/cygdrive/c/media-autobuild_suite/local32/bin-video/ffmpeg.exe -i "$i" -c:v libx265 -preset slow -b:v 512k -x265-params pass=2 -c:s copy -ac 2 -c:a libfdk_aac -vbr 3 x265_"$i"
done
The FDK aac encoder does not support 2.1, but the native encoder does.
ffmpeg -i "$i" ... -c:s copy -af pan=2.1 -c:a aac x265_"$i"

Encoding 25mp video

I have a 25MP uncompressed video file of 100 frames.
I tried to encode it with ffmpeg and h264 encoder into a .mp4 file, but the encoding got stuck around the 10th frame.
This is the script:
avconv -y -i input.avi -c:v libx264 -preset medium -b:v 5000K -pass 1 -c:a libfdk_aac -b:a 5000K -f mp4 /dev/null && \
avconv -i input.avi -c:v libx264 -preset medium -b:v 5000K -pass 2 -c:a libfdk_aac -b:a 5000K output.mp4
I am running it on a jetson TK1 with nvidia gpu, is there any way to use an accelarating encoding in order to make the encoding possible?
Please, if you can, give me a sampler script of something that might work.
Right now, I dont care how much time the encoding take, as long as it will work.
Thank you in advance! :)

ffmpeg rtmp webcam live stream iphone/pad segment size too big

I'm transcoding a rtmp stream from a red5 server for use to live stream on a iphone or ipad device. I built latest ffmpeg version from git repo using the built in segmenter to create .ts files and m3u8 playlist file using the following:
ffmpeg -probesize 50k -i "rtmp://localhost/oflaDemo/red5StreamDemo live=1" \
-c:v libx264 -b:v 128k -vpre ipod320 -flags -global_header -map 0 \
-f segment -segment_time 3 -segment_list foo.m3u8 -segment_list_flags +live \
-segment_list_type m3u8 -segment_list_size 5 -segment_format mpegts foo%d.ts
This works fine, but I can't get the segment size smaller than about 12 sec even set to 3 (-segment_time 3). It seems to be caused by libx264 vcodec.
Am I missing any flag?
By the way, you can simple run the ffmpeg command above successfully by starting red5 SimpleBroadcaster example.
i suspect it is because of GOP size. segmenter needs I-frame boundary to be able to create segments.
ffmpeg -probesize 50k -i "rtmp://localhost/oflaDemo/red5StreamDemo live=1" \
-c:v libx264 -b:v 128k -g 90 -vpre ipod320 -flags -global_header -map 0 \
-f segment -segment_time 3 -segment_list foo.m3u8 -segment_list_flags +live \
-segment_list_type m3u8 -segment_list_size 5 -segment_format mpegts foo%d.ts
added -g 90. could help.