Is this transcoding the video? - ffmpeg

I have an application used in government and subject to regulation that prevents transcoding or altering the video quality in any way.
I’m attempting to utilize FFmpeg to change a video into an MP4 by copying the raw streams to a new container.
This is the command being used:
ffmpeg.exe -y -i INPUT.ASF -c:av copy OUTPUT.MP4
Notice the -c:av copy. The FFmpeg documentation says, “a special value copy (output only) to indicate that the stream is not to be re-encoded.“
Visually the videos before and after appear to be identical quality with no pixelation on the ships.
Is this altering the video quality or could this be considered transcoding?

There's a syntax error but other than that, yes, copy will avoid transcoding of the stream. The hitch is that the output container may not support all codecs that the input container does.
ffmpeg.exe -y -i INPUT.ASF -c copy OUTPUT.MP4
Your current command was transcoding the video since ffmpeg's parser only consumes the first character in stream type i.e. -c:av is treated as -c:a. -c copy will copy all stream types. Use -c:v copy -c:a copy to separately set codec mode for video and audio.

Related

Ffmpeg -c copy not carrying over audio track from mkv to hls stream

I am using ffmpeg to create an hls stream. The source is an mkv with multiple audio tracks. I have tried using -map to specify the audio stream as well. I also found that when I point ffmpeg to any other audio stream in the file it works. It's just the first audio stream that does not. At one point I replaced -c copy with -acodec aac -ac 6 on the first stream and I got sound which is great but I am only looking to copy the stream and not re-encode it. The next thing I tried was using other mkv videos I have. All are reflecting the same issue. The mkv's by itself play both audio and video fine in VLC. When playing the output.m3u8 in VLC the option to choose different audio tracks is greyed out. Here is the command I'm using:
ffmpeg -i "./video.mkv" -ss 00:00:00 -t 00:00:30 -c copy -f hls "output.m3u8"
I want the audio of my hls stream to reflect that of the mkv source:
Although what I get returned from the command above gives me no sound and shows me this in mediaInfo:
I've aslo noticed that hls does not support pcm. Is it possible dash could work with this stream because it is pcm?
HLS segments can be either MPEG-TS or fragmented MP4. Neither officially support PCM audio, so you'll have to convert it.
DASH uses fragmented MP4 as segment format.

ffmpeg - copy attached-fonts without encode/remux

I have a mkv file with audio, video and subtitles. It also has a lot (~50) fonts (idk why).
The size and all is fine, but I want to make the one subtitle stream, default.
The problem is, when I use "-c copy", it loses all fonts. I know that I can keep everything with "-map 0", but this encodes all streams and goes from 70k fps (-c copy) down to only 20 fps -> takes a very long time.
This is the command I used:
$ ffmpeg -i 1.mkv -c copy -disposition:s:0 default 2.mkv
From the documentation regarding automatic stream selection:
Data or attachment streams are not automatically selected and can only be included using -map.
Example to include all streams:
ffmpeg -i 1.mkv -map 0 -c copy -disposition:s:0 default 2.mkv
See FFmpeg Wiki: Map.

How to convert .m2ts .vob Video to mkv without losing quality in COLAB FFMPEG

I want to convert .m2ts and vob videos to .mkv in same resolution and quality, so how to do it in COLAB?
I used a script All in One 1.9.1 it converts successfully but output file is verly low quality and its avc codec is version 3 while i want it to be version High#L4.1.
I have mounted my gdrive and will use it as source of videos.
All in one 1.9.1
https://colab.research.google.com/github/pcodejs/Codemaster/blob/master/All_in_One_1_9_1.ipynb
Since MKV can handle most formats you can stream copy (like a copy and paste) the contents of the inputs thus fulfilling your requirement of, ".m2ts and .vob videos to .mkv without losing quality."
ffmpeg -i input.vob -map 0 -map -0:d -c copy output.mkv
If you get error Can't write packet with unknown timestamp add the -fflags +genpts input option (put it before -i).

How to use ffmpeg to split an audio file into HLS-compatible chunks? (mp3 format)

I've been looking all over the web & StackOverflow, and can't get this to work. I have an audio file that I'd like to split into mp3 files and generate a corresponding m3u8 file.
I've tried this, which was the closest:
ffmpeg -i sometrack.wav -c:a libmp3lame -b:a 256k -map 0:0 -f segment -segment_time 10 -segment_list outputlist.m3u8 -segment_format mpegts 'output%03d.mp3'
But all the mp3 files are garbled when I play them.
There are two issues here. FFmpeg normally looks at the extension of the output files to determine output container. However, when the output format is forced -segment_format for segment muxer or just -f format for most others, ffmpeg will pay heed to that and no longer look at the extension. In this case, segment_format is set to mpegts so that's what the output files will be. To ensure valid mp3 files, set segment_format to mp3.
The second issue is that since the extension is mp3, my guess is that hls.js is not able to correctly determine the format of the segments, or it assumes a wrong format and tries to parse them that way. Either way, there should be some messages in the browser console to that effect. See https://github.com/video-dev/hls.js/pull/1190 for issues that hls.js has had with format probing.

Change video file container to mp4

I have learned through Google, that to change video containers without losing quality I can run the following command:
ffmpeg -i videofile.mkv -codec copy videofile.mp4
This has worked great for a number of video files I have. However, I am having an issue with three of them (1 mkv file and 2 avi files). When I run that command against them, the video is there, but there is no sound. There is sound in the original video file.
Any ideas how to put the video in a new container while retaining the audio track?
Thanks. Brian
The .mp4 container is not compatible with the audio codecs of the problem files. This should be evident from the logs. So the audio channels of the problem files have to be transcoded to something allowed in .mp4, eg. aac:
ffmpeg -i videofile.mkv -c:v copy -c:a aac videofile.mp4
Maybe the container mp4 it doesn’t compatible whith codec of your input video mkv and avi
By the way, you can try
ffmpeg -i videofile.mkv -c:v copy -c:a copy videofile.mp4
Check this documentation.
https://en.m.wikipedia.org/wiki/Comparison_of_video_codecs
https://trac.ffmpeg.org/wiki/Map

Resources