i am converting x265 video having two audio streams and sutitles too, I am using this command but it create output file without video stream and with one audio stream and one sutitle, so what i am missing here
!ffmpeg -ss 00:03:00 -i "input file x265.mkv" -t 00:00:50 -c:v libx264 -crf 18 -map 0:a -map 0:s -c copy "output file x264.mkv"
You only told it to copy audio and subtitles. Assuming you want all video, audio, and subtitle streams use:
ffmpeg -ss 00:03:00 -i "input file x265.mkv" -t 00:00:50 -map 0 -c copy -c:v libx264 -crf 18 "output file x264.mkv"
-map 0 selects all streams from input file x265.mkv.
-c copy sets stream copy mode for all selected streams.
-c:v libx264 overrides -c copy for all video streams, and encodes all video with libx264.
Result: Stream copy all stream types except video. Encode video to H.264 using encoder libx264.
See FFmpeg Wiki: Map.
Related
How can I create a MP4 file with ffmpeg out of a M2V-Video-File and two WAV-Files (one file for the right audio channel and one for the left audio channel)?
try this:
ffmpeg -i video.m2v -i audio1.wav -i audio2.wav -c:v copy -c:a aac -map 0:v:0 -filter_complex "[1:a][2:a]join=inputs=2:channel_layout=stereo[a]" -map "[a]" output.mp4
I believe mp4 files cannot contain PCM audio, hence converting to aac.
I have some DVDs that I would like to encode so that I can play them on a Chromecast, with subtitles. It seems that Chromecast only supports text-based subtitle formats, while DVD subtitles are in a bitmap format, so I need to hardcode the subtitles onto the video stream.
First I use vobcopy to create a VOB file:
vobcopy -I /dev/sr0
Next I want to use ffmpeg to encode it as a video stream in a format that is supported by the Chromecast. This is the closest I've come so far (based on the ffmpeg documentation):
ffmpeg -analyzeduration 100M -probesize 100M -i in.vob \
-filter_complex "[0:v:0][0:s:0]overlay[vid]" -map "[vid]" \
-map 0:3 -codec:v libx264 -crf 20 -codec:a copy out.mkv
The -filter_complex "[0:v:0] [0:s:0]overlay[vid] parameters should overlay the first subtitle stream on the first video stream (-map 0:3 is for the audio). This partially works, but the subtitles are only shown for a fraction of a second (I'm guessing one frame).
How can I make the subtitles display for the correct duration?
I'm using ffmpeg 4.4.1 on Linux, but I've also tried the latest snapshot version, and tried gstreamer and vlc (but didn't get far).
The only solution I found that worked perfectly was a tedious multi-stage process.
Copy the DVD with vobcopy
vobcopy -I /dev/sr0
Extract the subtitles in vobsub format using mencoder. This command will write subs.idx and subs.sub. The idx file can be edited if necessary to tweak the appearance of the subtitles.
mencoder *.vob -nosound -ovc frameno -o /dev/null \
-vobsuboutindex 0 -sid 0 -vobsubout subs
Copy the audio and video from the VOB into an mkv file. ffprobe can be used to identify the relevant video and audio stream numbers.
ffmpeg -fflags genpts -i *vob -map 0:1 -map 0:3 \
-codec:v copy -codec:a copy copied_av.mkv
Merge the subtitles with the audio/video stream.
mkvmerge -o merged.mkv copied_av.mkv subs.sub subs.idx
Then ffmpeg will work reliably with the mkv file to write hardcoded subtitles to the video stream.
ffmpeg -i merged.mkv -filter_complex "[0:v:0][0:s:0]overlay[vid]" \
-map [vid] -map 0:1 -codec:v libx264 -codec:a copy hardcoded.mkv
I am trying to add audio(repeat it until the end of the video) to a .webm file. but getting an error-
code i am using is-
ffmpeg -i 1.webm -stream_loop -1 -i 1.mp3 -c copy -shortest -map 0:v:0 -map 1:a:0 output.webm
error i am getting is-
Only VP8 or VP9 or AV1 video and Vorbis or Opus audio and WebVTT subtitles are supported for WebM.
Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument
I have checked other posts before writing this post but those solutions did not work for me.
is there any way to make it work?
The WebM Container does not support the old MP3 audio codec.
Use Opus instead. You need less than half the bitrate for the same quality. Here I choose 96Kbit/s bitrate which should equal to roughly 200 in MP3. Adjust that param. -mapping_family 0 is required for ffmpeg to use most opus optimizations, standard -1 will deactivate most of them. Use mapping_family 1 if the input source has more than 2 channels.
ffmpeg -i 1.webm -stream_loop -1 -i 1.mp3 -vcodec copy -acodec libopus -mapping_family 0 -b:a 96k -shortest -map 0:v:0 -map 1:a:0 output.webm
If you really want to use old MP3 you can also just use the .mkv container. MKV nearly supports everything.
ffmpeg -i 1.webm -stream_loop -1 -i 1.mp3 -c copy -shortest -map 0:v:0 -map 1:a:0 output.mkv
I'm trying to stream MPEG-1 video over FFMPEG with
ffmpeg -i "out.ts" -f flv -listen 1 -i rtmp://localhost:8889/live/app -c copy -f flv -listen 1 rtmp://localhost:1935/live/app
The out.ts file is a MPEG-1 video encoded with
ffmpeg -i out.avi -f mpegts -codec:v mpeg1video -b:v 1500k -r 30 -bf 0 -codec:a mp2 -b 0 -q 5 -t 1 out.ts
When I try to open the stream with VLC: rtmp://localhost:1935/live/app media is not playing. What's the command to stream MPEG-1 video over FFMPEG?
RTMP does not have support for mpeg1 video or mpeg2 audio. You can see the complete list if supported code in the fly specification under the VIDEODATA header.
https://www.adobe.com/content/dam/acom/en/devnet/flv/video_file_format_spec_v10.pdf
To stream MPEG-1 video using ffmpeg:
ffmpeg -re -y -i out.ts -an -f rtp_mpegts rtp://127.0.0.1:1234
Credit to: https://ffmpeg.org/pipermail/ffmpeg-user/2015-October/028879.html
(Although the source video is 720p, the stream in VLC looks like 360p and no audio is streamed, any idea would be appreciated)
I am processing my movie in ffmpeg (file merging, stabilization). The resulting metadata file gets an x264 codec. What prevents it from being reprocessed?
I decided to remove the codec using the Internet.
script:
ffmpeg -i input.mp4 -c copy -map 0 -metadata creation_time="2017-09-18 13:30:04" output.mp4
ffmpeg -i output.mp4 -vcodec copy -acodec copy -vbsf h264_changesps=removesei -map_metadata -1 out.mp4
pause
Unfortunately it does not work:
Unknown bitstream filter h264_changesps
What am I doing wrong?